mirror of
https://github.com/profanity-im/profanity.git
synced 2024-11-03 19:37:16 -05:00
Tidy xmpp headers
This commit is contained in:
parent
2e1eb9210a
commit
ccabc08fef
@ -61,7 +61,6 @@
|
||||
#include "contact.h"
|
||||
#include "roster_list.h"
|
||||
#include "jid.h"
|
||||
#include "xmpp/form.h"
|
||||
#include "log.h"
|
||||
#include "muc.h"
|
||||
#include "plugins/plugins.h"
|
||||
@ -76,7 +75,6 @@
|
||||
#include "tools/parser.h"
|
||||
#include "tools/tinyurl.h"
|
||||
#include "xmpp/xmpp.h"
|
||||
#include "xmpp/bookmark.h"
|
||||
#include "ui/ui.h"
|
||||
#include "window_list.h"
|
||||
|
||||
|
@ -37,7 +37,6 @@
|
||||
|
||||
#include <glib.h>
|
||||
|
||||
#include "xmpp/form.h"
|
||||
#include "ui/ui.h"
|
||||
|
||||
GHashTable *commands;
|
||||
|
@ -76,7 +76,6 @@
|
||||
#include "tools/parser.h"
|
||||
#include "tools/tinyurl.h"
|
||||
#include "xmpp/xmpp.h"
|
||||
#include "xmpp/bookmark.h"
|
||||
#include "ui/ui.h"
|
||||
#include "window_list.h"
|
||||
#include "event/client_events.h"
|
||||
|
@ -45,6 +45,7 @@
|
||||
#include "window_list.h"
|
||||
#include "command/command.h"
|
||||
#include "ui/ui.h"
|
||||
#include "xmpp/xmpp.h"
|
||||
|
||||
void
|
||||
scripts_init(void)
|
||||
|
@ -39,6 +39,7 @@
|
||||
#include "common.h"
|
||||
#include "config/preferences.h"
|
||||
#include "log.h"
|
||||
#include "xmpp/xmpp.h"
|
||||
#include "plugins/callbacks.h"
|
||||
#include "plugins/autocompleters.h"
|
||||
#include "plugins/api.h"
|
||||
|
@ -55,7 +55,6 @@
|
||||
#include "ui/ui.h"
|
||||
#include "ui/statusbar.h"
|
||||
#include "xmpp/xmpp.h"
|
||||
#include "xmpp/bookmark.h"
|
||||
|
||||
#ifdef HAVE_GIT_VERSION
|
||||
#include "gitversion.h"
|
||||
|
@ -47,6 +47,7 @@
|
||||
#include "ui/statusbar.h"
|
||||
#include "window_list.h"
|
||||
#include "plugins/plugins.h"
|
||||
#include "xmpp/xmpp.h"
|
||||
|
||||
|
||||
static GHashTable *windows;
|
||||
|
@ -48,6 +48,7 @@
|
||||
#include "ui/ui.h"
|
||||
#include "xmpp/connection.h"
|
||||
#include "xmpp/stanza.h"
|
||||
#include "xmpp/iq.h"
|
||||
|
||||
static int _blocklist_result_handler(xmpp_stanza_t *const stanza, void *const userdata);
|
||||
static int _block_add_result_handler(xmpp_stanza_t *const stanza, void *const userdata);
|
||||
@ -77,7 +78,7 @@ blocking_request(void)
|
||||
|
||||
iq = stanza_create_blocked_list_request(ctx);
|
||||
xmpp_stanza_set_id(iq, id);
|
||||
send_iq_stanza(iq);
|
||||
iq_send_stanza(iq);
|
||||
xmpp_stanza_release(iq);
|
||||
free(id);
|
||||
}
|
||||
@ -134,7 +135,7 @@ blocked_add(char *jid)
|
||||
|
||||
iq_id_handler_add(id, _block_add_result_handler, strdup(jid));
|
||||
|
||||
send_iq_stanza(iq);
|
||||
iq_send_stanza(iq);
|
||||
xmpp_stanza_release(iq);
|
||||
free(id);
|
||||
|
||||
@ -173,7 +174,7 @@ blocked_remove(char *jid)
|
||||
|
||||
iq_id_handler_add(id, _block_remove_result_handler, strdup(jid));
|
||||
|
||||
send_iq_stanza(iq);
|
||||
iq_send_stanza(iq);
|
||||
xmpp_stanza_release(iq);
|
||||
free(id);
|
||||
|
||||
|
@ -52,6 +52,7 @@
|
||||
#include "muc.h"
|
||||
#include "event/server_events.h"
|
||||
#include "xmpp/connection.h"
|
||||
#include "xmpp/iq.h"
|
||||
#include "xmpp/stanza.h"
|
||||
#include "xmpp/xmpp.h"
|
||||
#include "xmpp/bookmark.h"
|
||||
@ -90,7 +91,7 @@ bookmark_request(void)
|
||||
|
||||
iq = stanza_create_bookmarks_storage_request(ctx);
|
||||
xmpp_stanza_set_id(iq, id);
|
||||
send_iq_stanza(iq);
|
||||
iq_send_stanza(iq);
|
||||
xmpp_stanza_release(iq);
|
||||
}
|
||||
|
||||
@ -454,6 +455,6 @@ _send_bookmarks(void)
|
||||
xmpp_stanza_release(storage);
|
||||
xmpp_stanza_release(query);
|
||||
|
||||
send_iq_stanza(iq);
|
||||
iq_send_stanza(iq);
|
||||
xmpp_stanza_release(iq);
|
||||
}
|
||||
|
@ -37,15 +37,6 @@
|
||||
|
||||
#include <glib.h>
|
||||
|
||||
struct bookmark_t {
|
||||
char *jid;
|
||||
char *nick;
|
||||
char *password;
|
||||
gboolean autojoin;
|
||||
};
|
||||
|
||||
typedef struct bookmark_t Bookmark;
|
||||
|
||||
void bookmark_request(void);
|
||||
|
||||
#endif
|
||||
|
@ -218,7 +218,7 @@ jabber_connect_with_details(const char *const jid, const char *const passwd, con
|
||||
}
|
||||
|
||||
void
|
||||
jabber_autoping_fail(void)
|
||||
connection_autoping_fail(void)
|
||||
{
|
||||
if (jabber_conn.conn_status == JABBER_CONNECTED) {
|
||||
log_info("Closing connection");
|
||||
@ -332,14 +332,8 @@ jabber_get_connection_status(void)
|
||||
return (jabber_conn.conn_status);
|
||||
}
|
||||
|
||||
void
|
||||
jabber_set_connection_status(jabber_conn_status_t status)
|
||||
{
|
||||
jabber_conn.conn_status = status;
|
||||
}
|
||||
|
||||
GSList*
|
||||
jabber_get_disco_items(void)
|
||||
connection_get_disco_items(void)
|
||||
{
|
||||
return (disco_items);
|
||||
}
|
||||
@ -360,7 +354,7 @@ jabber_service_supports(const char *const feature)
|
||||
}
|
||||
|
||||
void
|
||||
jabber_set_disco_items(GSList *_disco_items)
|
||||
connection_set_disco_items(GSList *_disco_items)
|
||||
{
|
||||
disco_items = _disco_items;
|
||||
}
|
||||
@ -383,12 +377,6 @@ jabber_get_fulljid(void)
|
||||
return xmpp_conn_get_jid(jabber_conn.conn);
|
||||
}
|
||||
|
||||
const char*
|
||||
jabber_get_domain(void)
|
||||
{
|
||||
return jabber_conn.domain;
|
||||
}
|
||||
|
||||
char*
|
||||
jabber_get_presence_message(void)
|
||||
{
|
||||
|
@ -54,11 +54,8 @@ void connection_set_priority(int priority);
|
||||
void connection_set_presence_message(const char *const message);
|
||||
void connection_add_available_resource(Resource *resource);
|
||||
void connection_remove_available_resource(const char *const resource);
|
||||
|
||||
void send_iq_stanza(xmpp_stanza_t *const stanza);
|
||||
|
||||
void roster_set_handler(xmpp_stanza_t *const stanza);
|
||||
void roster_result_handler(xmpp_stanza_t *const stanza);
|
||||
void iq_id_handler_add(const char *const id, ProfIdCallback func, void *userdata);
|
||||
void connection_autoping_fail(void);
|
||||
GSList* connection_get_disco_items(void);
|
||||
void connection_set_disco_items(GSList *disco_items);
|
||||
|
||||
#endif
|
||||
|
@ -46,5 +46,8 @@
|
||||
|
||||
DataForm* form_create(xmpp_stanza_t *const stanza);
|
||||
xmpp_stanza_t* form_create_submission(DataForm *form);
|
||||
char* form_get_form_type_field(DataForm *form);
|
||||
GSList* form_get_non_form_type_fields_sorted(DataForm *form);
|
||||
GSList* form_get_field_values_sorted(FormField *field);
|
||||
|
||||
#endif
|
||||
|
@ -64,6 +64,8 @@
|
||||
#include "xmpp/form.h"
|
||||
#include "roster_list.h"
|
||||
#include "xmpp/xmpp.h"
|
||||
#include "xmpp/iq.h"
|
||||
#include "xmpp/roster.h"
|
||||
#include "plugins/plugins.h"
|
||||
#include "tools/http_upload.h"
|
||||
|
||||
@ -241,7 +243,7 @@ iq_autoping_check(void)
|
||||
if (timeout > 0 && seconds_elapsed >= timeout) {
|
||||
cons_show("Autoping response timed out afer %u seconds.", timeout);
|
||||
log_debug("Autoping check: timed out afer %u seconds, disconnecting", timeout);
|
||||
jabber_autoping_fail();
|
||||
connection_autoping_fail();
|
||||
autoping_wait = FALSE;
|
||||
g_timer_destroy(autoping_time);
|
||||
autoping_time = NULL;
|
||||
@ -272,7 +274,7 @@ iq_room_list_request(gchar *conferencejid)
|
||||
{
|
||||
xmpp_ctx_t * const ctx = connection_get_ctx();
|
||||
xmpp_stanza_t *iq = stanza_create_disco_items_iq(ctx, "confreq", conferencejid);
|
||||
send_iq_stanza(iq);
|
||||
iq_send_stanza(iq);
|
||||
xmpp_stanza_release(iq);
|
||||
}
|
||||
|
||||
@ -285,7 +287,7 @@ iq_enable_carbons(void)
|
||||
|
||||
iq_id_handler_add(id, _enable_carbons_id_handler, NULL);
|
||||
|
||||
send_iq_stanza(iq);
|
||||
iq_send_stanza(iq);
|
||||
xmpp_stanza_release(iq);
|
||||
}
|
||||
|
||||
@ -298,14 +300,14 @@ iq_disable_carbons(void)
|
||||
|
||||
iq_id_handler_add(id, _disable_carbons_id_handler, NULL);
|
||||
|
||||
send_iq_stanza(iq);
|
||||
iq_send_stanza(iq);
|
||||
xmpp_stanza_release(iq);
|
||||
}
|
||||
|
||||
void
|
||||
iq_http_upload_request(HTTPUpload *upload)
|
||||
{
|
||||
GSList *disco_items = jabber_get_disco_items();
|
||||
GSList *disco_items = connection_get_disco_items();
|
||||
DiscoInfo *disco_info;
|
||||
if (disco_items && (g_slist_length(disco_items) > 0)) {
|
||||
while (disco_items) {
|
||||
@ -333,7 +335,7 @@ iq_http_upload_request(HTTPUpload *upload)
|
||||
|
||||
free(id);
|
||||
|
||||
send_iq_stanza(iq);
|
||||
iq_send_stanza(iq);
|
||||
xmpp_stanza_release(iq);
|
||||
return;
|
||||
}
|
||||
@ -349,7 +351,7 @@ iq_disco_info_request(gchar *jid)
|
||||
|
||||
free(id);
|
||||
|
||||
send_iq_stanza(iq);
|
||||
iq_send_stanza(iq);
|
||||
xmpp_stanza_release(iq);
|
||||
}
|
||||
|
||||
@ -364,7 +366,7 @@ iq_disco_info_request_onconnect(gchar *jid)
|
||||
|
||||
free(id);
|
||||
|
||||
send_iq_stanza(iq);
|
||||
iq_send_stanza(iq);
|
||||
xmpp_stanza_release(iq);
|
||||
}
|
||||
|
||||
@ -379,7 +381,7 @@ iq_last_activity_request(gchar *jid)
|
||||
|
||||
free(id);
|
||||
|
||||
send_iq_stanza(iq);
|
||||
iq_send_stanza(iq);
|
||||
xmpp_stanza_release(iq);
|
||||
}
|
||||
|
||||
@ -398,7 +400,7 @@ iq_room_info_request(const char *const room, gboolean display_result)
|
||||
|
||||
free(id);
|
||||
|
||||
send_iq_stanza(iq);
|
||||
iq_send_stanza(iq);
|
||||
xmpp_stanza_release(iq);
|
||||
}
|
||||
|
||||
@ -424,7 +426,7 @@ iq_send_caps_request_for_jid(const char *const to, const char *const id,
|
||||
|
||||
iq_id_handler_add(id, _caps_response_for_jid_id_handler, strdup(to));
|
||||
|
||||
send_iq_stanza(iq);
|
||||
iq_send_stanza(iq);
|
||||
xmpp_stanza_release(iq);
|
||||
}
|
||||
|
||||
@ -450,7 +452,7 @@ iq_send_caps_request(const char *const to, const char *const id,
|
||||
|
||||
iq_id_handler_add(id, _caps_response_id_handler, NULL);
|
||||
|
||||
send_iq_stanza(iq);
|
||||
iq_send_stanza(iq);
|
||||
xmpp_stanza_release(iq);
|
||||
}
|
||||
|
||||
@ -476,7 +478,7 @@ iq_send_caps_request_legacy(const char *const to, const char *const id,
|
||||
iq_id_handler_add(id, _caps_response_legacy_id_handler, node_str->str);
|
||||
g_string_free(node_str, FALSE);
|
||||
|
||||
send_iq_stanza(iq);
|
||||
iq_send_stanza(iq);
|
||||
xmpp_stanza_release(iq);
|
||||
}
|
||||
|
||||
@ -485,7 +487,7 @@ iq_disco_items_request(gchar *jid)
|
||||
{
|
||||
xmpp_ctx_t * const ctx = connection_get_ctx();
|
||||
xmpp_stanza_t *iq = stanza_create_disco_items_iq(ctx, "discoitemsreq", jid);
|
||||
send_iq_stanza(iq);
|
||||
iq_send_stanza(iq);
|
||||
xmpp_stanza_release(iq);
|
||||
}
|
||||
|
||||
@ -494,7 +496,7 @@ iq_disco_items_request_onconnect(gchar *jid)
|
||||
{
|
||||
xmpp_ctx_t * const ctx = connection_get_ctx();
|
||||
xmpp_stanza_t *iq = stanza_create_disco_items_iq(ctx, "discoitemsreq_onconnect", jid);
|
||||
send_iq_stanza(iq);
|
||||
iq_send_stanza(iq);
|
||||
xmpp_stanza_release(iq);
|
||||
}
|
||||
|
||||
@ -507,7 +509,7 @@ iq_send_software_version(const char *const fulljid)
|
||||
const char *id = xmpp_stanza_get_id(iq);
|
||||
iq_id_handler_add(id, _version_result_id_handler, strdup(fulljid));
|
||||
|
||||
send_iq_stanza(iq);
|
||||
iq_send_stanza(iq);
|
||||
xmpp_stanza_release(iq);
|
||||
}
|
||||
|
||||
@ -516,7 +518,7 @@ iq_confirm_instant_room(const char *const room_jid)
|
||||
{
|
||||
xmpp_ctx_t * const ctx = connection_get_ctx();
|
||||
xmpp_stanza_t *iq = stanza_create_instant_room_request_iq(ctx, room_jid);
|
||||
send_iq_stanza(iq);
|
||||
iq_send_stanza(iq);
|
||||
xmpp_stanza_release(iq);
|
||||
}
|
||||
|
||||
@ -529,7 +531,7 @@ iq_destroy_room(const char *const room_jid)
|
||||
const char *id = xmpp_stanza_get_id(iq);
|
||||
iq_id_handler_add(id, _destroy_room_result_id_handler, NULL);
|
||||
|
||||
send_iq_stanza(iq);
|
||||
iq_send_stanza(iq);
|
||||
xmpp_stanza_release(iq);
|
||||
}
|
||||
|
||||
@ -542,7 +544,7 @@ iq_request_room_config_form(const char *const room_jid)
|
||||
const char *id = xmpp_stanza_get_id(iq);
|
||||
iq_id_handler_add(id, _room_config_id_handler, NULL);
|
||||
|
||||
send_iq_stanza(iq);
|
||||
iq_send_stanza(iq);
|
||||
xmpp_stanza_release(iq);
|
||||
}
|
||||
|
||||
@ -555,7 +557,7 @@ iq_submit_room_config(const char *const room, DataForm *form)
|
||||
const char *id = xmpp_stanza_get_id(iq);
|
||||
iq_id_handler_add(id, _room_config_submit_id_handler, NULL);
|
||||
|
||||
send_iq_stanza(iq);
|
||||
iq_send_stanza(iq);
|
||||
xmpp_stanza_release(iq);
|
||||
}
|
||||
|
||||
@ -564,7 +566,7 @@ iq_room_config_cancel(const char *const room_jid)
|
||||
{
|
||||
xmpp_ctx_t * const ctx = connection_get_ctx();
|
||||
xmpp_stanza_t *iq = stanza_create_room_config_cancel_iq(ctx, room_jid);
|
||||
send_iq_stanza(iq);
|
||||
iq_send_stanza(iq);
|
||||
xmpp_stanza_release(iq);
|
||||
}
|
||||
|
||||
@ -577,7 +579,7 @@ iq_room_affiliation_list(const char *const room, char *affiliation)
|
||||
const char *id = xmpp_stanza_get_id(iq);
|
||||
iq_id_handler_add(id, _room_affiliation_list_result_id_handler, strdup(affiliation));
|
||||
|
||||
send_iq_stanza(iq);
|
||||
iq_send_stanza(iq);
|
||||
xmpp_stanza_release(iq);
|
||||
}
|
||||
|
||||
@ -590,7 +592,7 @@ iq_room_kick_occupant(const char *const room, const char *const nick, const char
|
||||
const char *id = xmpp_stanza_get_id(iq);
|
||||
iq_id_handler_add(id, _room_kick_result_id_handler, strdup(nick));
|
||||
|
||||
send_iq_stanza(iq);
|
||||
iq_send_stanza(iq);
|
||||
xmpp_stanza_release(iq);
|
||||
}
|
||||
|
||||
@ -614,7 +616,7 @@ iq_room_affiliation_set(const char *const room, const char *const jid, char *aff
|
||||
|
||||
iq_id_handler_add(id, _room_affiliation_set_result_id_handler, affiliation_set);
|
||||
|
||||
send_iq_stanza(iq);
|
||||
iq_send_stanza(iq);
|
||||
xmpp_stanza_release(iq);
|
||||
}
|
||||
|
||||
@ -633,7 +635,7 @@ iq_room_role_set(const char *const room, const char *const nick, char *role,
|
||||
|
||||
iq_id_handler_add(id, _room_role_set_result_id_handler, role_set);
|
||||
|
||||
send_iq_stanza(iq);
|
||||
iq_send_stanza(iq);
|
||||
xmpp_stanza_release(iq);
|
||||
}
|
||||
|
||||
@ -646,7 +648,7 @@ iq_room_role_list(const char *const room, char *role)
|
||||
const char *id = xmpp_stanza_get_id(iq);
|
||||
iq_id_handler_add(id, _room_role_list_result_id_handler, strdup(role));
|
||||
|
||||
send_iq_stanza(iq);
|
||||
iq_send_stanza(iq);
|
||||
xmpp_stanza_release(iq);
|
||||
}
|
||||
|
||||
@ -660,7 +662,7 @@ iq_send_ping(const char *const target)
|
||||
GDateTime *now = g_date_time_new_now_local();
|
||||
iq_id_handler_add(id, _manual_pong_id_handler, now);
|
||||
|
||||
send_iq_stanza(iq);
|
||||
iq_send_stanza(iq);
|
||||
xmpp_stanza_release(iq);
|
||||
}
|
||||
|
||||
@ -974,7 +976,7 @@ _autoping_timed_send(xmpp_conn_t *const conn, void *const userdata)
|
||||
// add pong handler
|
||||
iq_id_handler_add(id, _auto_pong_id_handler, ctx);
|
||||
|
||||
send_iq_stanza(iq);
|
||||
iq_send_stanza(iq);
|
||||
xmpp_stanza_release(iq);
|
||||
autoping_wait = TRUE;
|
||||
if (autoping_time) {
|
||||
@ -1162,7 +1164,7 @@ _ping_get_handler(xmpp_stanza_t *const stanza)
|
||||
xmpp_stanza_set_attribute(pong, STANZA_ATTR_ID, id);
|
||||
}
|
||||
|
||||
send_iq_stanza(pong);
|
||||
iq_send_stanza(pong);
|
||||
xmpp_stanza_release(pong);
|
||||
}
|
||||
|
||||
@ -1219,7 +1221,7 @@ _version_get_handler(xmpp_stanza_t *const stanza)
|
||||
xmpp_stanza_add_child(query, version);
|
||||
xmpp_stanza_add_child(response, query);
|
||||
|
||||
send_iq_stanza(response);
|
||||
iq_send_stanza(response);
|
||||
|
||||
g_string_free(version_str, TRUE);
|
||||
xmpp_stanza_release(name_txt);
|
||||
@ -1255,7 +1257,7 @@ _disco_items_get_handler(xmpp_stanza_t *const stanza)
|
||||
xmpp_stanza_set_ns(query, XMPP_NS_DISCO_ITEMS);
|
||||
xmpp_stanza_add_child(response, query);
|
||||
|
||||
send_iq_stanza(response);
|
||||
iq_send_stanza(response);
|
||||
|
||||
xmpp_stanza_release(response);
|
||||
}
|
||||
@ -1290,7 +1292,7 @@ _last_activity_get_handler(xmpp_stanza_t *const stanza)
|
||||
xmpp_stanza_add_child(response, query);
|
||||
xmpp_stanza_release(query);
|
||||
|
||||
send_iq_stanza(response);
|
||||
iq_send_stanza(response);
|
||||
|
||||
xmpp_stanza_release(response);
|
||||
} else {
|
||||
@ -1314,7 +1316,7 @@ _last_activity_get_handler(xmpp_stanza_t *const stanza)
|
||||
xmpp_stanza_add_child(response, error);
|
||||
xmpp_stanza_release(error);
|
||||
|
||||
send_iq_stanza(response);
|
||||
iq_send_stanza(response);
|
||||
|
||||
xmpp_stanza_release(response);
|
||||
}
|
||||
@ -1348,7 +1350,7 @@ _disco_info_get_handler(xmpp_stanza_t *const stanza)
|
||||
xmpp_stanza_set_attribute(query, STANZA_ATTR_NODE, node_str);
|
||||
}
|
||||
xmpp_stanza_add_child(response, query);
|
||||
send_iq_stanza(response);
|
||||
iq_send_stanza(response);
|
||||
|
||||
xmpp_stanza_release(query);
|
||||
xmpp_stanza_release(response);
|
||||
@ -1916,7 +1918,7 @@ _disco_info_response_id_handler_onconnect(xmpp_stanza_t *const stanza, void *con
|
||||
if (query) {
|
||||
xmpp_stanza_t *child = xmpp_stanza_get_children(query);
|
||||
|
||||
GSList *disco_items = jabber_get_disco_items();
|
||||
GSList *disco_items = connection_get_disco_items();
|
||||
DiscoInfo *disco_info;
|
||||
if (disco_items && (g_slist_length(disco_items) > 0)) {
|
||||
while (disco_items) {
|
||||
@ -2051,7 +2053,7 @@ _disco_items_result_handler(xmpp_stanza_t *const stanza)
|
||||
DiscoInfo *info = malloc(sizeof(struct disco_info_t));
|
||||
info->item = strdup(item->jid);
|
||||
info->features = g_hash_table_new_full(g_str_hash, g_str_equal, free, NULL);
|
||||
jabber_set_disco_items(g_slist_append(jabber_get_disco_items(), info));
|
||||
connection_set_disco_items(g_slist_append(connection_get_disco_items(), info));
|
||||
iq_disco_info_request_onconnect(info->item);
|
||||
res_items = g_slist_next(res_items);
|
||||
}
|
||||
@ -2062,7 +2064,7 @@ _disco_items_result_handler(xmpp_stanza_t *const stanza)
|
||||
}
|
||||
|
||||
void
|
||||
send_iq_stanza(xmpp_stanza_t *const stanza)
|
||||
iq_send_stanza(xmpp_stanza_t *const stanza)
|
||||
{
|
||||
char *text;
|
||||
size_t text_size;
|
||||
|
@ -36,6 +36,14 @@
|
||||
#define XMPP_IQ_H
|
||||
|
||||
void iq_handlers_init(void);
|
||||
void iq_roster_request(void);
|
||||
void iq_send_stanza(xmpp_stanza_t *const stanza);
|
||||
void iq_id_handler_add(const char *const id, ProfIdCallback func, void *userdata);
|
||||
void iq_disco_info_request_onconnect(gchar *jid);
|
||||
void iq_disco_items_request_onconnect(gchar *jid);
|
||||
void iq_send_caps_request(const char *const to, const char *const id, const char *const node, const char *const ver);
|
||||
void iq_send_caps_request_for_jid(const char *const to, const char *const id, const char *const node,
|
||||
const char *const ver);
|
||||
void iq_send_caps_request_legacy(const char *const to, const char *const id, const char *const node,
|
||||
const char *const ver);
|
||||
|
||||
#endif
|
||||
|
@ -58,6 +58,7 @@
|
||||
#include "xmpp/capabilities.h"
|
||||
#include "xmpp/connection.h"
|
||||
#include "xmpp/stanza.h"
|
||||
#include "xmpp/iq.h"
|
||||
#include "xmpp/xmpp.h"
|
||||
#include "plugins/plugins.h"
|
||||
|
||||
@ -668,7 +669,7 @@ _send_caps_request(char *node, char *caps_key, char *id, char *from)
|
||||
if (!caps_contains(caps_key)) {
|
||||
log_debug("Capabilities not cached for '%s', sending discovery IQ.", from);
|
||||
xmpp_stanza_t *iq = stanza_create_disco_info_iq(ctx, id, from, node);
|
||||
send_iq_stanza(iq);
|
||||
iq_send_stanza(iq);
|
||||
xmpp_stanza_release(iq);
|
||||
} else {
|
||||
log_debug("Capabilities already cached, for %s", caps_key);
|
||||
|
@ -56,6 +56,7 @@
|
||||
#include "tools/autocomplete.h"
|
||||
#include "config/preferences.h"
|
||||
#include "xmpp/connection.h"
|
||||
#include "xmpp/iq.h"
|
||||
#include "xmpp/roster.h"
|
||||
#include "roster_list.h"
|
||||
#include "xmpp/stanza.h"
|
||||
@ -80,7 +81,7 @@ roster_request(void)
|
||||
{
|
||||
xmpp_ctx_t * const ctx = connection_get_ctx();
|
||||
xmpp_stanza_t *iq = stanza_create_roster_iq(ctx);
|
||||
send_iq_stanza(iq);
|
||||
iq_send_stanza(iq);
|
||||
xmpp_stanza_release(iq);
|
||||
}
|
||||
|
||||
@ -91,7 +92,7 @@ roster_send_add_new(const char *const barejid, const char *const name)
|
||||
char *id = create_unique_id("roster");
|
||||
xmpp_stanza_t *iq = stanza_create_roster_set(ctx, id, barejid, name, NULL);
|
||||
free(id);
|
||||
send_iq_stanza(iq);
|
||||
iq_send_stanza(iq);
|
||||
xmpp_stanza_release(iq);
|
||||
}
|
||||
|
||||
@ -100,7 +101,7 @@ roster_send_remove(const char *const barejid)
|
||||
{
|
||||
xmpp_ctx_t * const ctx = connection_get_ctx();
|
||||
xmpp_stanza_t *iq = stanza_create_roster_remove_set(ctx, barejid);
|
||||
send_iq_stanza(iq);
|
||||
iq_send_stanza(iq);
|
||||
xmpp_stanza_release(iq);
|
||||
}
|
||||
|
||||
@ -111,7 +112,7 @@ roster_send_name_change(const char *const barejid, const char *const new_name, G
|
||||
char *id = create_unique_id("roster");
|
||||
xmpp_stanza_t *iq = stanza_create_roster_set(ctx, id, barejid, new_name, groups);
|
||||
free(id);
|
||||
send_iq_stanza(iq);
|
||||
iq_send_stanza(iq);
|
||||
xmpp_stanza_release(iq);
|
||||
}
|
||||
|
||||
@ -140,7 +141,7 @@ roster_send_add_to_group(const char *const group, PContact contact)
|
||||
iq_id_handler_add(unique_id, _group_add_id_handler, data);
|
||||
xmpp_stanza_t *iq = stanza_create_roster_set(ctx, unique_id, p_contact_barejid(contact),
|
||||
p_contact_name(contact), new_groups);
|
||||
send_iq_stanza(iq);
|
||||
iq_send_stanza(iq);
|
||||
xmpp_stanza_release(iq);
|
||||
free(unique_id);
|
||||
}
|
||||
@ -185,7 +186,7 @@ roster_send_remove_from_group(const char *const group, PContact contact)
|
||||
iq_id_handler_add(unique_id, _group_remove_id_handler, data);
|
||||
xmpp_stanza_t *iq = stanza_create_roster_set(ctx, unique_id, p_contact_barejid(contact),
|
||||
p_contact_name(contact), new_groups);
|
||||
send_iq_stanza(iq);
|
||||
iq_send_stanza(iq);
|
||||
xmpp_stanza_release(iq);
|
||||
free(unique_id);
|
||||
}
|
||||
|
@ -35,7 +35,8 @@
|
||||
#ifndef XMPP_ROSTER_H
|
||||
#define XMPP_ROSTER_H
|
||||
|
||||
void roster_add_handlers(void);
|
||||
void roster_request(void);
|
||||
void roster_set_handler(xmpp_stanza_t *const stanza);
|
||||
void roster_result_handler(xmpp_stanza_t *const stanza);
|
||||
|
||||
#endif
|
||||
|
@ -1621,35 +1621,6 @@ stanza_parse_caps(xmpp_stanza_t *const stanza)
|
||||
return caps;
|
||||
}
|
||||
|
||||
char*
|
||||
stanza_get_caps_str(xmpp_stanza_t *const stanza)
|
||||
{
|
||||
xmpp_stanza_t *caps = xmpp_stanza_get_child_by_name(stanza, STANZA_NAME_C);
|
||||
|
||||
if (caps == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (strcmp(xmpp_stanza_get_ns(caps), STANZA_NS_CAPS) != 0) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const char *node = xmpp_stanza_get_attribute(caps, STANZA_ATTR_NODE);
|
||||
const char *ver = xmpp_stanza_get_attribute(caps, STANZA_ATTR_VER);
|
||||
|
||||
if ((node == NULL) || (ver == NULL)) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
GString *caps_gstr = g_string_new(node);
|
||||
g_string_append(caps_gstr, "#");
|
||||
g_string_append(caps_gstr, ver);
|
||||
char *caps_str = caps_gstr->str;
|
||||
g_string_free(caps_gstr, FALSE);
|
||||
|
||||
return caps_str;
|
||||
}
|
||||
|
||||
char*
|
||||
stanza_get_error_message(xmpp_stanza_t *stanza)
|
||||
{
|
||||
|
@ -283,10 +283,6 @@ xmpp_stanza_t* stanza_create_room_kick_iq(xmpp_ctx_t *const ctx, const char *con
|
||||
const char *const reason);
|
||||
|
||||
int stanza_get_idle_time(xmpp_stanza_t *const stanza);
|
||||
char* stanza_get_caps_str(xmpp_stanza_t *const stanza);
|
||||
|
||||
DataForm* stanza_create_form(xmpp_stanza_t *const stanza);
|
||||
void stanza_destroy_form(DataForm *form);
|
||||
|
||||
void stanza_attach_priority(xmpp_ctx_t *const ctx, xmpp_stanza_t *const presence, const int pri);
|
||||
void stanza_attach_last_activity(xmpp_ctx_t *const ctx, xmpp_stanza_t *const presence, const int idle);
|
||||
|
@ -76,6 +76,13 @@ typedef enum {
|
||||
INVITE_MEDIATED
|
||||
} jabber_invite_t;
|
||||
|
||||
typedef struct bookmark_t {
|
||||
char *jid;
|
||||
char *nick;
|
||||
char *password;
|
||||
gboolean autojoin;
|
||||
} Bookmark;
|
||||
|
||||
typedef struct capabilities_t {
|
||||
char *category;
|
||||
char *type;
|
||||
@ -103,21 +110,15 @@ typedef struct disco_info_t {
|
||||
GHashTable *features;
|
||||
} DiscoInfo;
|
||||
|
||||
// connection functions
|
||||
void jabber_init(void);
|
||||
jabber_conn_status_t jabber_connect_with_details(const char *const jid, const char *const passwd,
|
||||
const char *const altdomain, const int port, const char *const tls_policy);
|
||||
jabber_conn_status_t jabber_connect_with_account(const ProfAccount *const account);
|
||||
void jabber_disconnect(void);
|
||||
void jabber_shutdown(void);
|
||||
void jabber_autoping_fail(void);
|
||||
void jabber_process_events(int millis);
|
||||
const char* jabber_get_fulljid(void);
|
||||
const char* jabber_get_domain(void);
|
||||
jabber_conn_status_t jabber_get_connection_status(void);
|
||||
void jabber_set_connection_status(jabber_conn_status_t status);
|
||||
GSList* jabber_get_disco_items(void);
|
||||
void jabber_set_disco_items(GSList *disco_items);
|
||||
char* jabber_get_presence_message(void);
|
||||
char* jabber_get_account_name(void);
|
||||
GList* jabber_get_available_resources(void);
|
||||
@ -130,22 +131,18 @@ gboolean jabber_conn_is_secured(void);
|
||||
gboolean jabber_send_stanza(const char *const stanza);
|
||||
gboolean jabber_service_supports(const char *const feature);
|
||||
|
||||
// message functions
|
||||
char* message_send_chat(const char *const barejid, const char *const msg, const char *const oob_url);
|
||||
char* message_send_chat_otr(const char *const barejid, const char *const msg);
|
||||
char* message_send_chat_pgp(const char *const barejid, const char *const msg);
|
||||
void message_send_private(const char *const fulljid, const char *const msg, const char *const oob_url);
|
||||
void message_send_groupchat(const char *const roomjid, const char *const msg, const char *const oob_url);
|
||||
void message_send_groupchat_subject(const char *const roomjid, const char *const subject);
|
||||
|
||||
void message_send_inactive(const char *const jid);
|
||||
void message_send_composing(const char *const jid);
|
||||
void message_send_paused(const char *const jid);
|
||||
void message_send_gone(const char *const jid);
|
||||
|
||||
void message_send_invite(const char *const room, const char *const contact, const char *const reason);
|
||||
|
||||
// presence functions
|
||||
void presence_subscription(const char *const jid, const jabber_subscr_t action);
|
||||
GSList* presence_get_subscription_requests(void);
|
||||
gint presence_sub_request_count(void);
|
||||
@ -157,15 +154,12 @@ void presence_leave_chat_room(const char *const room_jid);
|
||||
void presence_send(resource_presence_t status, const char *const msg, int idle, char *signed_status);
|
||||
gboolean presence_sub_request_exists(const char *const bare_jid);
|
||||
|
||||
// iq functions
|
||||
void iq_enable_carbons(void);
|
||||
void iq_disable_carbons(void);
|
||||
void iq_send_software_version(const char *const fulljid);
|
||||
void iq_room_list_request(gchar *conferencejid);
|
||||
void iq_disco_info_request(gchar *jid);
|
||||
void iq_disco_info_request_onconnect(gchar *jid);
|
||||
void iq_disco_items_request(gchar *jid);
|
||||
void iq_disco_items_request_onconnect(gchar *jid);
|
||||
void iq_last_activity_request(gchar *jid);
|
||||
void iq_set_autoping(int seconds);
|
||||
void iq_confirm_instant_room(const char *const room_jid);
|
||||
@ -174,11 +168,6 @@ void iq_request_room_config_form(const char *const room_jid);
|
||||
void iq_submit_room_config(const char *const room, DataForm *form);
|
||||
void iq_room_config_cancel(const char *const room_jid);
|
||||
void iq_send_ping(const char *const target);
|
||||
void iq_send_caps_request(const char *const to, const char *const id, const char *const node, const char *const ver);
|
||||
void iq_send_caps_request_for_jid(const char *const to, const char *const id, const char *const node,
|
||||
const char *const ver);
|
||||
void iq_send_caps_request_legacy(const char *const to, const char *const id, const char *const node,
|
||||
const char *const ver);
|
||||
void iq_room_info_request(const char *const room, gboolean display_result);
|
||||
void iq_room_affiliation_list(const char *const room, char *affiliation);
|
||||
void iq_room_affiliation_set(const char *const room, const char *const jid, char *affiliation,
|
||||
@ -189,7 +178,6 @@ void iq_room_role_list(const char * const room, char *role);
|
||||
void iq_autoping_check(void);
|
||||
void iq_http_upload_request(HTTPUpload *upload);
|
||||
|
||||
// caps functions
|
||||
Capabilities* caps_lookup(const char *const jid);
|
||||
void caps_close(void);
|
||||
void caps_destroy(Capabilities *caps);
|
||||
@ -216,7 +204,6 @@ char* blocked_ac_find(const char *const search_str);
|
||||
void blocked_ac_reset(void);
|
||||
|
||||
void form_destroy(DataForm *form);
|
||||
char* form_get_form_type_field(DataForm *form);
|
||||
void form_set_value(DataForm *form, const char *const tag, char *value);
|
||||
gboolean form_add_unique_value(DataForm *form, const char *const tag, char *value);
|
||||
void form_add_value(DataForm *form, const char *const tag, char *value);
|
||||
@ -230,7 +217,4 @@ FormField* form_get_field_by_tag(DataForm *form, const char *const tag);
|
||||
Autocomplete form_get_value_ac(DataForm *form, const char *const tag);
|
||||
void form_reset_autocompleters(DataForm *form);
|
||||
|
||||
GSList* form_get_non_form_type_fields_sorted(DataForm *form);
|
||||
GSList* form_get_field_values_sorted(FormField *field);
|
||||
|
||||
#endif
|
||||
|
@ -18,6 +18,7 @@
|
||||
#include "command/command.h"
|
||||
#include "command/commands.h"
|
||||
#include "window_list.h"
|
||||
#include "xmpp/xmpp.h"
|
||||
|
||||
#include "ui/ui.h"
|
||||
#include "ui/stub_ui.h"
|
||||
|
Loading…
Reference in New Issue
Block a user