diff options
author | James Booth <boothj5@gmail.com> | 2015-10-26 00:14:23 +0000 |
---|---|---|
committer | James Booth <boothj5@gmail.com> | 2015-10-26 00:14:23 +0000 |
commit | c8a6bdb381c9a666fc340e8b7fc74100e7328d8c (patch) | |
tree | 9bed6b621d04fa70a41a896074fec7bd071befe8 | |
parent | 2ce43b633fa7ba1aa15a86a9f1522b85106d77a9 (diff) | |
download | profani-tty-c8a6bdb381c9a666fc340e8b7fc74100e7328d8c.tar.gz |
Applied coding style to src/xmpp/
-rw-r--r-- | src/xmpp/bookmark.c | 22 | ||||
-rw-r--r-- | src/xmpp/capabilities.c | 42 | ||||
-rw-r--r-- | src/xmpp/capabilities.h | 14 | ||||
-rw-r--r-- | src/xmpp/connection.c | 58 | ||||
-rw-r--r-- | src/xmpp/connection.h | 8 | ||||
-rw-r--r-- | src/xmpp/form.c | 52 | ||||
-rw-r--r-- | src/xmpp/form.h | 2 | ||||
-rw-r--r-- | src/xmpp/iq.c | 196 | ||||
-rw-r--r-- | src/xmpp/message.c | 70 | ||||
-rw-r--r-- | src/xmpp/presence.c | 68 | ||||
-rw-r--r-- | src/xmpp/roster.c | 45 | ||||
-rw-r--r-- | src/xmpp/stanza.c | 224 | ||||
-rw-r--r-- | src/xmpp/stanza.h | 149 | ||||
-rw-r--r-- | src/xmpp/xmpp.h | 135 |
14 files changed, 530 insertions, 555 deletions
diff --git a/src/xmpp/bookmark.c b/src/xmpp/bookmark.c index 3705d699..682aa2b2 100644 --- a/src/xmpp/bookmark.c +++ b/src/xmpp/bookmark.c @@ -62,10 +62,10 @@ static Autocomplete bookmark_ac; static GList *bookmark_list; -static int _bookmark_handle_result(xmpp_conn_t * const conn, - xmpp_stanza_t * const stanza, void * const userdata); -static int _bookmark_handle_delete(xmpp_conn_t * const conn, - void * const userdata); +static int _bookmark_handle_result(xmpp_conn_t *const conn, + xmpp_stanza_t *const stanza, void *const userdata); +static int _bookmark_handle_delete(xmpp_conn_t *const conn, + void *const userdata); static void _bookmark_item_destroy(gpointer item); static int _match_bookmark_by_jid(gconstpointer a, gconstpointer b); static void _send_bookmarks(void); @@ -221,14 +221,14 @@ bookmark_remove(const char *jid) } } -const GList * +const GList* bookmark_get_list(void) { return bookmark_list; } -char * -bookmark_find(const char * const search_str) +char* +bookmark_find(const char *const search_str) { return autocomplete_complete(bookmark_ac, search_str, TRUE); } @@ -242,8 +242,8 @@ bookmark_autocomplete_reset(void) } static int -_bookmark_handle_result(xmpp_conn_t * const conn, - xmpp_stanza_t * const stanza, void * const userdata) +_bookmark_handle_result(xmpp_conn_t *const conn, + xmpp_stanza_t *const stanza, void *const userdata) { xmpp_ctx_t *ctx = connection_get_ctx(); char *id = (char *)userdata; @@ -360,8 +360,8 @@ _bookmark_handle_result(xmpp_conn_t * const conn, } static int -_bookmark_handle_delete(xmpp_conn_t * const conn, - void * const userdata) +_bookmark_handle_delete(xmpp_conn_t *const conn, + void *const userdata) { char *id = (char *)userdata; diff --git a/src/xmpp/capabilities.c b/src/xmpp/capabilities.c index cdbb9e4a..b425c6f1 100644 --- a/src/xmpp/capabilities.c +++ b/src/xmpp/capabilities.c @@ -68,9 +68,9 @@ static char *my_sha1; static gchar* _get_cache_file(void); static void _save_cache(void); -static Capabilities * _caps_by_ver(const char * const ver); -static Capabilities * _caps_by_jid(const char * const jid); -Capabilities * _caps_copy(Capabilities *caps); +static Capabilities* _caps_by_ver(const char *const ver); +static Capabilities* _caps_by_jid(const char *const jid); +Capabilities* _caps_copy(Capabilities *caps); void caps_init(void) @@ -93,7 +93,7 @@ caps_init(void) } void -caps_add_by_ver(const char * const ver, Capabilities *caps) +caps_add_by_ver(const char *const ver, Capabilities *caps) { gboolean cached = g_key_file_has_group(cache, ver); if (!cached) { @@ -135,25 +135,25 @@ caps_add_by_ver(const char * const ver, Capabilities *caps) } void -caps_add_by_jid(const char * const jid, Capabilities *caps) +caps_add_by_jid(const char *const jid, Capabilities *caps) { g_hash_table_insert(jid_to_caps, strdup(jid), caps); } void -caps_map_jid_to_ver(const char * const jid, const char * const ver) +caps_map_jid_to_ver(const char *const jid, const char *const ver) { g_hash_table_insert(jid_to_ver, strdup(jid), strdup(ver)); } gboolean -caps_contains(const char * const ver) +caps_contains(const char *const ver) { return (g_key_file_has_group(cache, ver)); } -static Capabilities * -_caps_by_ver(const char * const ver) +static Capabilities* +_caps_by_ver(const char *const ver) { if (g_key_file_has_group(cache, ver)) { Capabilities *new_caps = malloc(sizeof(struct capabilities_t)); @@ -226,14 +226,14 @@ _caps_by_ver(const char * const ver) } } -static Capabilities * -_caps_by_jid(const char * const jid) +static Capabilities* +_caps_by_jid(const char *const jid) { return g_hash_table_lookup(jid_to_caps, jid); } -Capabilities * -caps_lookup(const char * const jid) +Capabilities* +caps_lookup(const char *const jid) { char *ver = g_hash_table_lookup(jid_to_ver, jid); if (ver) { @@ -254,7 +254,7 @@ caps_lookup(const char * const jid) return NULL; } -Capabilities * +Capabilities* _caps_copy(Capabilities *caps) { if (!caps) { @@ -280,8 +280,8 @@ _caps_copy(Capabilities *caps) } } -char * -caps_create_sha1_str(xmpp_stanza_t * const query) +char* +caps_create_sha1_str(xmpp_stanza_t *const query) { char *category = NULL; char *type = NULL; @@ -388,7 +388,7 @@ caps_create_sha1_str(xmpp_stanza_t * const query) return result; } -Capabilities * +Capabilities* caps_create(xmpp_stanza_t *query) { char *category = NULL; @@ -541,7 +541,7 @@ caps_create(xmpp_stanza_t *query) } char* -caps_get_my_sha1(xmpp_ctx_t * const ctx) +caps_get_my_sha1(xmpp_ctx_t *const ctx) { if (my_sha1 == NULL) { xmpp_stanza_t *query = caps_create_query_response_stanza(ctx); @@ -552,8 +552,8 @@ caps_get_my_sha1(xmpp_ctx_t * const ctx) return my_sha1; } -xmpp_stanza_t * -caps_create_query_response_stanza(xmpp_ctx_t * const ctx) +xmpp_stanza_t* +caps_create_query_response_stanza(xmpp_ctx_t *const ctx) { xmpp_stanza_t *query = xmpp_stanza_new(ctx); xmpp_stanza_set_name(query, STANZA_NAME_QUERY); @@ -674,7 +674,7 @@ caps_destroy(Capabilities *caps) } } -static gchar * +static gchar* _get_cache_file(void) { gchar *xdg_data = xdg_get_data_home(); diff --git a/src/xmpp/capabilities.h b/src/xmpp/capabilities.h index 3e281d1c..812a7eb1 100644 --- a/src/xmpp/capabilities.h +++ b/src/xmpp/capabilities.h @@ -48,14 +48,14 @@ void caps_init(void); -void caps_add_by_ver(const char * const ver, Capabilities *caps); -void caps_add_by_jid(const char * const jid, Capabilities *caps); -void caps_map_jid_to_ver(const char * const jid, const char * const ver); -gboolean caps_contains(const char * const ver); +void caps_add_by_ver(const char *const ver, Capabilities *caps); +void caps_add_by_jid(const char *const jid, Capabilities *caps); +void caps_map_jid_to_ver(const char *const jid, const char *const ver); +gboolean caps_contains(const char *const ver); -char* caps_create_sha1_str(xmpp_stanza_t * const query); -xmpp_stanza_t* caps_create_query_response_stanza(xmpp_ctx_t * const ctx); +char* caps_create_sha1_str(xmpp_stanza_t *const query); +xmpp_stanza_t* caps_create_query_response_stanza(xmpp_ctx_t *const ctx); Capabilities* caps_create(xmpp_stanza_t *query); -char* caps_get_my_sha1(xmpp_ctx_t * const ctx); +char* caps_get_my_sha1(xmpp_ctx_t *const ctx); #endif diff --git a/src/xmpp/connection.c b/src/xmpp/connection.c index 4b3ef803..27711a4c 100644 --- a/src/xmpp/connection.c +++ b/src/xmpp/connection.c @@ -95,20 +95,20 @@ static GTimer *reconnect_timer; static log_level_t _get_log_level(xmpp_log_level_t xmpp_level); static xmpp_log_level_t _get_xmpp_log_level(); -static void _xmpp_file_logger(void * const userdata, - const xmpp_log_level_t level, const char * const area, - const char * const msg); +static void _xmpp_file_logger(void *const userdata, + const xmpp_log_level_t level, const char *const area, + const char *const msg); -static xmpp_log_t * _xmpp_get_file_logger(); +static xmpp_log_t* _xmpp_get_file_logger(); -static jabber_conn_status_t _jabber_connect(const char * const fulljid, - const char * const passwd, const char * const altdomain, int port, const char *const tls_policy); +static jabber_conn_status_t _jabber_connect(const char *const fulljid, + const char *const passwd, const char *const altdomain, int port, const char *const tls_policy); static void _jabber_reconnect(void); -static void _connection_handler(xmpp_conn_t * const conn, +static void _connection_handler(xmpp_conn_t *const conn, const xmpp_conn_event_t status, const int error, - xmpp_stream_error_t * const stream_error, void * const userdata); + xmpp_stream_error_t *const stream_error, void *const userdata); void _connection_free_saved_account(void); void _connection_free_saved_details(void); @@ -131,7 +131,7 @@ jabber_init(void) } jabber_conn_status_t -jabber_connect_with_account(const ProfAccount * const account) +jabber_connect_with_account(const ProfAccount *const account) { assert(account != NULL); @@ -157,8 +157,8 @@ jabber_connect_with_account(const ProfAccount * const account) } 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_connect_with_details(const char *const jid, + const char *const passwd, const char *const altdomain, const int port, const char *const tls_policy) { assert(jid != NULL); assert(passwd != NULL); @@ -271,7 +271,7 @@ jabber_process_events(int millis) } } -GList * +GList* jabber_get_available_resources(void) { return g_hash_table_get_values(available_resources); @@ -283,37 +283,37 @@ jabber_get_connection_status(void) return (jabber_conn.conn_status); } -xmpp_conn_t * +xmpp_conn_t* connection_get_conn(void) { return jabber_conn.conn; } -xmpp_ctx_t * +xmpp_ctx_t* connection_get_ctx(void) { return jabber_conn.ctx; } -const char * +const char* jabber_get_fulljid(void) { return xmpp_conn_get_jid(jabber_conn.conn); } -const char * +const char* jabber_get_domain(void) { return jabber_conn.domain; } -char * +char* jabber_get_presence_message(void) { return jabber_conn.presence_message; } -char * +char* jabber_get_account_name(void) { return saved_account.name; @@ -334,7 +334,7 @@ jabber_free_uuid(char *uuid) } void -connection_set_presence_message(const char * const message) +connection_set_presence_message(const char *const message) { FREE_SET_NULL(jabber_conn.presence_message); if (message) { @@ -355,7 +355,7 @@ connection_add_available_resource(Resource *resource) } void -connection_remove_available_resource(const char * const resource) +connection_remove_available_resource(const char *const resource) { g_hash_table_remove(available_resources, resource); } @@ -387,16 +387,16 @@ _connection_free_session_data(void) #ifdef HAVE_LIBMESODE static int -_connection_certfail_cb(const char * const certname, const char * const certfp, - char * const notbefore, const char * const notafter, const char * const errormsg) +_connection_certfail_cb(const char *const certname, const char *const certfp, + char *const notbefore, const char *const notafter, const char *const errormsg) { return sv_ev_certfail(errormsg, certname, certfp, notbefore, notafter); } #endif static jabber_conn_status_t -_jabber_connect(const char * const fulljid, const char * const passwd, - const char * const altdomain, int port, const char *const tls_policy) +_jabber_connect(const char *const fulljid, const char *const passwd, + const char *const altdomain, int port, const char *const tls_policy) { assert(fulljid != NULL); assert(passwd != NULL); @@ -488,9 +488,9 @@ _jabber_reconnect(void) } static void -_connection_handler(xmpp_conn_t * const conn, +_connection_handler(xmpp_conn_t *const conn, const xmpp_conn_event_t status, const int error, - xmpp_stream_error_t * const stream_error, void * const userdata) + xmpp_stream_error_t *const stream_error, void *const userdata) { // login success if (status == XMPP_CONN_CONNECT) { @@ -619,8 +619,8 @@ _get_xmpp_log_level() } static void -_xmpp_file_logger(void * const userdata, const xmpp_log_level_t level, - const char * const area, const char * const msg) +_xmpp_file_logger(void *const userdata, const xmpp_log_level_t level, + const char *const area, const char *const msg) { log_level_t prof_level = _get_log_level(level); log_msg(prof_level, area, msg); @@ -629,7 +629,7 @@ _xmpp_file_logger(void * const userdata, const xmpp_log_level_t level, } } -static xmpp_log_t * +static xmpp_log_t* _xmpp_get_file_logger() { xmpp_log_level_t level = _get_xmpp_log_level(); diff --git a/src/xmpp/connection.h b/src/xmpp/connection.h index 705dd129..0f9407f9 100644 --- a/src/xmpp/connection.h +++ b/src/xmpp/connection.h @@ -46,11 +46,11 @@ #include "resource.h" -xmpp_conn_t *connection_get_conn(void); -xmpp_ctx_t *connection_get_ctx(void); +xmpp_conn_t* connection_get_conn(void); +xmpp_ctx_t* connection_get_ctx(void); void connection_set_priority(int priority); -void connection_set_presence_message(const char * const message); +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 connection_remove_available_resource(const char *const resource); #endif diff --git a/src/xmpp/form.c b/src/xmpp/form.c index fdec2a49..9631e8b6 100644 --- a/src/xmpp/form.c +++ b/src/xmpp/form.c @@ -78,7 +78,7 @@ _is_valid_form_element(xmpp_stanza_t *stanza) return TRUE; } -static DataForm * +static DataForm* _form_new(void) { DataForm *form = malloc(sizeof(DataForm)); @@ -93,7 +93,7 @@ _form_new(void) return form; } -static FormField * +static FormField* _field_new(void) { FormField *field = malloc(sizeof(FormField)); @@ -108,8 +108,8 @@ _field_new(void) return field; } -static char * -_get_property(xmpp_stanza_t * const stanza, const char * const property) +static char* +_get_property(xmpp_stanza_t *const stanza, const char *const property) { char *result = NULL; xmpp_ctx_t *ctx = connection_get_ctx(); @@ -126,8 +126,8 @@ _get_property(xmpp_stanza_t * const stanza, const char * const property) return result; } -static char * -_get_attr(xmpp_stanza_t * const stanza, const char * const attr) +static char* +_get_attr(xmpp_stanza_t *const stanza, const char *const attr) { char *result = xmpp_stanza_get_attribute(stanza, attr); if (result) { @@ -138,7 +138,7 @@ _get_attr(xmpp_stanza_t * const stanza, const char * const attr) } static gboolean -_is_required(xmpp_stanza_t * const stanza) +_is_required(xmpp_stanza_t *const stanza) { xmpp_stanza_t *child = xmpp_stanza_get_child_by_name(stanza, "required"); if (child) { @@ -149,7 +149,7 @@ _is_required(xmpp_stanza_t * const stanza) } static form_field_type_t -_get_field_type(const char * const type) +_get_field_type(const char *const type) { if (g_strcmp0(type, "hidden") == 0) { return FIELD_HIDDEN; @@ -184,8 +184,8 @@ _get_field_type(const char * const type) return FIELD_UNKNOWN; } -DataForm * -form_create(xmpp_stanza_t * const form_stanza) +DataForm* +form_create(xmpp_stanza_t *const form_stanza) { xmpp_ctx_t *ctx = connection_get_ctx(); @@ -281,7 +281,7 @@ form_create(xmpp_stanza_t * const form_stanza) return form; } -xmpp_stanza_t * +xmpp_stanza_t* form_create_submission(DataForm *form) { xmpp_ctx_t *ctx = connection_get_ctx(); @@ -408,7 +408,7 @@ _field_compare_by_var(FormField *a, FormField *b) return g_strcmp0(a->var, b->var); } -GSList * +GSList* form_get_non_form_type_fields_sorted(DataForm *form) { GSList *sorted = NULL; @@ -424,7 +424,7 @@ form_get_non_form_type_fields_sorted(DataForm *form) return sorted; } -GSList * +GSList* form_get_field_values_sorted(FormField *field) { GSList *sorted = NULL; @@ -440,7 +440,7 @@ form_get_field_values_sorted(FormField *field) return sorted; } -char * +char* form_get_form_type_field(DataForm *form) { GSList *curr = form->fields; @@ -456,7 +456,7 @@ form_get_form_type_field(DataForm *form) } gboolean -form_tag_exists(DataForm *form, const char * const tag) +form_tag_exists(DataForm *form, const char *const tag) { GList *tags = g_hash_table_get_keys(form->tag_to_var); GList *curr = tags; @@ -472,7 +472,7 @@ form_tag_exists(DataForm *form, const char * const tag) } form_field_type_t -form_get_field_type(DataForm *form, const char * const tag) +form_get_field_type(DataForm *form, const char *const tag) { char *var = g_hash_table_lookup(form->tag_to_var, tag); if (var) { @@ -489,7 +489,7 @@ form_get_field_type(DataForm *form, const char * const tag) } void -form_set_value(DataForm *form, const char * const tag, char *value) +form_set_value(DataForm *form, const char *const tag, char *value) { char *var = g_hash_table_lookup(form->tag_to_var, tag); if (var) { @@ -514,7 +514,7 @@ form_set_value(DataForm *form, const char * const tag, char *value) } void -form_add_value(DataForm *form, const char * const tag, char *value) +form_add_value(DataForm *form, const char *const tag, char *value) { char *var = g_hash_table_lookup(form->tag_to_var, tag); if (var) { @@ -539,7 +539,7 @@ form_add_value(DataForm *form, const char * const tag, char *value) } gboolean -form_add_unique_value(DataForm *form, const char * const tag, char *value) +form_add_unique_value(DataForm *form, const char *const tag, char *value) { char *var = g_hash_table_lookup(form->tag_to_var, tag); if (var) { @@ -570,7 +570,7 @@ form_add_unique_value(DataForm *form, const char * const tag, char *value) } gboolean -form_remove_value(DataForm *form, const char * const tag, char *value) +form_remove_value(DataForm *form, const char *const tag, char *value) { char *var = g_hash_table_lookup(form->tag_to_var, tag); if (var) { @@ -600,7 +600,7 @@ form_remove_value(DataForm *form, const char * const tag, char *value) } gboolean -form_remove_text_multi_value(DataForm *form, const char * const tag, int index) +form_remove_text_multi_value(DataForm *form, const char *const tag, int index) { index--; char *var = g_hash_table_lookup(form->tag_to_var, tag); @@ -632,7 +632,7 @@ form_remove_text_multi_value(DataForm *form, const char * const tag, int index) } int -form_get_value_count(DataForm *form, const char * const tag) +form_get_value_count(DataForm *form, const char *const tag) { char *var = g_hash_table_lookup(form->tag_to_var, tag); if (var) { @@ -654,7 +654,7 @@ form_get_value_count(DataForm *form, const char * const tag) } gboolean -form_field_contains_option(DataForm *form, const char * const tag, char *value) +form_field_contains_option(DataForm *form, const char *const tag, char *value) { char *var = g_hash_table_lookup(form->tag_to_var, tag); if (var) { @@ -678,8 +678,8 @@ form_field_contains_option(DataForm *form, const char * const tag, char *value) return FALSE; } -FormField * -form_get_field_by_tag(DataForm *form, const char * const tag) +FormField* +form_get_field_by_tag(DataForm *form, const char *const tag) { char *var = g_hash_table_lookup(form->tag_to_var, tag); if (var) { @@ -696,7 +696,7 @@ form_get_field_by_tag(DataForm *form, const char * const tag) } Autocomplete -form_get_value_ac(DataForm *form, const char * const tag) +form_get_value_ac(DataForm *form, const char *const tag) { char *var = g_hash_table_lookup(form->tag_to_var, tag); if (var) { diff --git a/src/xmpp/form.h b/src/xmpp/form.h index 86cd4b7b..5b31141f 100644 --- a/src/xmpp/form.h +++ b/src/xmpp/form.h @@ -37,7 +37,7 @@ #include "xmpp/xmpp.h" -DataForm* form_create(xmpp_stanza_t * const stanza); +DataForm* form_create(xmpp_stanza_t *const stanza); xmpp_stanza_t* form_create_submission(DataForm *form); #endif diff --git a/src/xmpp/iq.c b/src/xmpp/iq.c index 99327b41..8f19871b 100644 --- a/src/xmpp/iq.c +++ b/src/xmpp/iq.c @@ -70,32 +70,32 @@ typedef struct p_room_info_data_t { gboolean display; } ProfRoomInfoData; -static int _error_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, void * const userdata); -static int _ping_get_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, void * const userdata); -static int _version_get_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, void * const userdata); -static int _version_result_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, void * const userdata); -static int _disco_info_get_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, void * const userdata); -static int _disco_info_response_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, void * const userdata); -static int _last_activity_get_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, void * const userdata); -static int _last_activity_response_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, void * const userdata); -static int _room_info_response_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, void * const userdata); -static int _disco_items_result_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, void * const userdata); -static int _disco_items_get_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, void * const userdata); -static int _destroy_room_result_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, void * const userdata); -static int _room_config_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, void * const userdata); -static int _room_config_submit_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, void * const userdata); -static int _room_affiliation_list_result_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, void * const userdata); -static int _room_affiliation_set_result_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, void * const userdata); -static int _room_role_set_result_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, void * const userdata); -static int _room_role_list_result_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, void * const userdata); -static int _room_kick_result_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, void * const userdata); -static int _enable_carbons_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, void * const userdata); -static int _disable_carbons_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, void * const userdata); -static int _manual_pong_handler(xmpp_conn_t *const conn, xmpp_stanza_t * const stanza, void * const userdata); -static int _ping_timed_handler(xmpp_conn_t * const conn, void * const userdata); -static int _caps_response_handler(xmpp_conn_t *const conn, xmpp_stanza_t * const stanza, void * const userdata); -static int _caps_response_handler_for_jid(xmpp_conn_t *const conn, xmpp_stanza_t * const stanza, void * const userdata); -static int _caps_response_handler_legacy(xmpp_conn_t *const conn, xmpp_stanza_t * const stanza, void * const userdata); +static int _error_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, void *const userdata); +static int _ping_get_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, void *const userdata); +static int _version_get_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, void *const userdata); +static int _version_result_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, void *const userdata); +static int _disco_info_get_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, void *const userdata); +static int _disco_info_response_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, void *const userdata); +static int _last_activity_get_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, void *const userdata); +static int _last_activity_response_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, void *const userdata); +static int _room_info_response_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, void *const userdata); +static int _disco_items_result_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, void *const userdata); +static int _disco_items_get_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, void *const userdata); +static int _destroy_room_result_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, void *const userdata); +static int _room_config_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, void *const userdata); +static int _room_config_submit_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, void *const userdata); +static int _room_affiliation_list_result_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, void *const userdata); +static int _room_affiliation_set_result_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, void *const userdata); +static int _room_role_set_result_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, void *const userdata); +static int _room_role_list_result_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, void *const userdata); +static int _room_kick_result_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, void *const userdata); +static int _enable_carbons_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, void *const userdata); +static int _disable_carbons_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, void *const userdata); +static int _manual_pong_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, void *const userdata); +static int _ping_timed_handler(xmpp_conn_t *const conn, void *const userdata); +static int _caps_response_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, void *const userdata); +static int _caps_response_handler_for_jid(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, void *const userdata); +static int _caps_response_handler_legacy(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, void *const userdata); void iq_add_handlers(void) @@ -150,7 +150,7 @@ iq_room_list_request(gchar *conferencejid) } void -iq_enable_carbons() +iq_enable_carbons(void) { xmpp_conn_t * const conn = connection_get_conn(); xmpp_ctx_t * const ctx = connection_get_ctx(); @@ -164,7 +164,7 @@ iq_enable_carbons() } void -iq_disable_carbons() +iq_disable_carbons(void) { xmpp_conn_t * const conn = connection_get_conn(); xmpp_ctx_t * const ctx = connection_get_ctx(); @@ -210,7 +210,7 @@ iq_last_activity_request(gchar *jid) } void -iq_room_info_request(const char * const room, gboolean display_result) +iq_room_info_request(const char *const room, gboolean display_result) { xmpp_conn_t * const conn = connection_get_conn(); xmpp_ctx_t * const ctx = connection_get_ctx(); @@ -232,8 +232,8 @@ iq_room_info_request(const char * const room, gboolean display_result) void -iq_send_caps_request_for_jid(const char * const to, const char * const id, - const char * const node, const char * const ver) +iq_send_caps_request_for_jid(const char *const to, const char *const id, + const char *const node, const char *const ver) { xmpp_conn_t * const conn = connection_get_conn(); xmpp_ctx_t * const ctx = connection_get_ctx(); @@ -259,8 +259,8 @@ iq_send_caps_request_for_jid(const char * const to, const char * const id, } void -iq_send_caps_request(const char * const to, const char * const id, - const char * const node, const char * const ver) +iq_send_caps_request(const char *const to, const char *const id, + const char *const node, const char *const ver) { xmpp_conn_t * const conn = connection_get_conn(); xmpp_ctx_t * const ctx = connection_get_ctx(); @@ -286,8 +286,8 @@ iq_send_caps_request(const char * const to, const char * const id, } void -iq_send_caps_request_legacy(const char * const to, const char * const id, - const char * const node, const char * const ver) +iq_send_caps_request_legacy(const char *const to, const char *const id, + const char *const node, const char *const ver) { xmpp_conn_t * const conn = connection_get_conn(); xmpp_ctx_t * const ctx = connection_get_ctx(); @@ -323,7 +323,7 @@ iq_disco_items_request(gchar *jid) } void -iq_send_software_version(const char * const fulljid) +iq_send_software_version(const char *const fulljid) { xmpp_conn_t * const conn = connection_get_conn(); xmpp_ctx_t * const ctx = connection_get_ctx(); @@ -337,7 +337,7 @@ iq_send_software_version(const char * const fulljid) } void -iq_confirm_instant_room(const char * const room_jid) +iq_confirm_instant_room(const char *const room_jid) { xmpp_conn_t * const conn = connection_get_conn(); xmpp_ctx_t * const ctx = connection_get_ctx(); @@ -347,7 +347,7 @@ iq_confirm_instant_room(const char * const room_jid) } void -iq_destroy_room(const char * const room_jid) +iq_destroy_room(const char *const room_jid) { xmpp_conn_t * const conn = connection_get_conn(); xmpp_ctx_t * const ctx = connection_get_ctx(); @@ -361,7 +361,7 @@ iq_destroy_room(const char * const room_jid) } void -iq_request_room_config_form(const char * const room_jid) +iq_request_room_config_form(const char *const room_jid) { xmpp_conn_t * const conn = connection_get_conn(); xmpp_ctx_t * const ctx = connection_get_ctx(); @@ -375,7 +375,7 @@ iq_request_room_config_form(const char * const room_jid) } void -iq_submit_room_config(const char * const room, DataForm *form) +iq_submit_room_config(const char *const room, DataForm *form) { xmpp_conn_t * const conn = connection_get_conn(); xmpp_ctx_t * const ctx = connection_get_ctx(); @@ -389,7 +389,7 @@ iq_submit_room_config(const char * const room, DataForm *form) } void -iq_room_config_cancel(const char * const room_jid) +iq_room_config_cancel(const char *const room_jid) { xmpp_conn_t * const conn = connection_get_conn(); xmpp_ctx_t * const ctx = connection_get_ctx(); @@ -399,7 +399,7 @@ iq_room_config_cancel(const char * const room_jid) } void -iq_room_affiliation_list(const char * const room, char *affiliation) +iq_room_affiliation_list(const char *const room, char *affiliation) { xmpp_conn_t * const conn = connection_get_conn(); xmpp_ctx_t * const ctx = connection_get_ctx(); @@ -413,7 +413,7 @@ iq_room_affiliation_list(const char * const room, char *affiliation) } void -iq_room_kick_occupant(const char * const room, const char * const nick, const char * const reason) +iq_room_kick_occupant(const char *const room, const char *const nick, const char *const reason) { xmpp_conn_t * const conn = connection_get_conn(); xmpp_ctx_t * const ctx = connection_get_ctx(); @@ -432,8 +432,8 @@ struct privilege_set_t { }; void -iq_room_affiliation_set(const char * const room, const char * const jid, char *affiliation, - const char * const reason) +iq_room_affiliation_set(const char *const room, const char *const jid, char *affiliation, + const char *const reason) { xmpp_conn_t * const conn = connection_get_conn(); xmpp_ctx_t * const ctx = connection_get_ctx(); @@ -452,8 +452,8 @@ iq_room_affiliation_set(const char * const room, const char * const jid, char *a } void -iq_room_role_set(const char * const room, const char * const nick, char *role, - const char * const reason) +iq_room_role_set(const char *const room, const char *const nick, char *role, + const char *const reason) { xmpp_conn_t * const conn = connection_get_conn(); xmpp_ctx_t * const ctx = connection_get_ctx(); @@ -472,7 +472,7 @@ iq_room_role_set(const char * const room, const char * const nick, char *role, } void -iq_room_role_list(const char * const room, char *role) +iq_room_role_list(const char *const room, char *role) { xmpp_conn_t * const conn = connection_get_conn(); xmpp_ctx_t * const ctx = connection_get_ctx(); @@ -486,7 +486,7 @@ iq_room_role_list(const char * const room, char *role) } void -iq_send_ping(const char * const target) +iq_send_ping(const char *const target) { xmpp_conn_t * const conn = connection_get_conn(); xmpp_ctx_t * const ctx = connection_get_ctx(); @@ -501,8 +501,8 @@ iq_send_ping(const char * const target) } static int -_error_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, - void * const userdata) +_error_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, + void *const userdata) { const char *id = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_ID); char *error_msg = stanza_get_error_message(stanza); @@ -521,8 +521,8 @@ _error_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, } static int -_pong_handler(xmpp_conn_t *const conn, xmpp_stanza_t * const stanza, - void * const userdata) +_pong_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, + void *const userdata) { char *id = xmpp_stanza_get_id(stanza); char *type = xmpp_stanza_get_type(stanza); @@ -561,8 +561,8 @@ _pong_handler(xmpp_conn_t *const conn, xmpp_stanza_t * const stanza, } static int -_caps_response_handler(xmpp_conn_t *const conn, xmpp_stanza_t * const stanza, - void * const userdata) +_caps_response_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, + void *const userdata) { const char *id = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_ID); xmpp_stanza_t *query = xmpp_stanza_get_child_by_name(stanza, STANZA_NAME_QUERY); @@ -635,8 +635,8 @@ _caps_response_handler(xmpp_conn_t *const conn, xmpp_stanza_t * const stanza, } static int -_caps_response_handler_for_jid(xmpp_conn_t *const conn, xmpp_stanza_t * const stanza, - void * const userdata) +_caps_response_handler_for_jid(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, + void *const userdata) { char *jid = (char *)userdata; const char *id = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_ID); @@ -694,8 +694,8 @@ _caps_response_handler_for_jid(xmpp_conn_t *const conn, xmpp_stanza_t * const st } static int -_caps_response_handler_legacy(xmpp_conn_t *const conn, xmpp_stanza_t * const stanza, - void * const userdata) +_caps_response_handler_legacy(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, + void *const userdata) { const char *id = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_ID); xmpp_stanza_t *query = xmpp_stanza_get_child_by_name(stanza, STANZA_NAME_QUERY); @@ -767,7 +767,7 @@ _caps_response_handler_legacy(xmpp_conn_t *const conn, xmpp_stanza_t * const sta } static int -_enable_carbons_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, void * const userdata) +_enable_carbons_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, void *const userdata) { char *type = xmpp_stanza_get_type(stanza); if (g_strcmp0(type, "error") == 0) { @@ -783,7 +783,7 @@ _enable_carbons_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, } static int -_disable_carbons_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, void * const userdata) +_disable_carbons_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, void *const userdata) { char *type = xmpp_stanza_get_type(stanza); if (g_strcmp0(type, "error") == 0) { @@ -799,8 +799,8 @@ _disable_carbons_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, } static int -_manual_pong_handler(xmpp_conn_t *const conn, xmpp_stanza_t * const stanza, - void * const userdata) +_manual_pong_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, + void *const userdata) { char *from = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_FROM); char *type = xmpp_stanza_get_type(stanza); @@ -838,7 +838,7 @@ _manual_pong_handler(xmpp_conn_t *const conn, xmpp_stanza_t * const stanza, } static int -_ping_timed_handler(xmpp_conn_t * const conn, void * const userdata) +_ping_timed_handler(xmpp_conn_t *const conn, void *const userdata) { xmpp_ctx_t *ctx = (xmpp_ctx_t *)userdata; @@ -858,8 +858,8 @@ _ping_timed_handler(xmpp_conn_t * const conn, void * const userdata) } static int -_version_result_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, - void * const userdata) +_version_result_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, + void *const userdata) { char *id = xmpp_stanza_get_id(stanza); @@ -953,8 +953,8 @@ _version_result_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, } static int -_ping_get_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, - void * const userdata) +_ping_get_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, + void *const userdata) { xmpp_ctx_t *ctx = (xmpp_ctx_t *)userdata; const char *id = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_ID); @@ -988,8 +988,8 @@ _ping_get_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, } static int -_version_get_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, - void * const userdata) +_version_get_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, + void *const userdata) { xmpp_ctx_t *ctx = (xmpp_ctx_t *)userdata; const char *id = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_ID); @@ -1056,8 +1056,8 @@ _version_get_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, } static int -_disco_items_get_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, - void * const userdata) +_disco_items_get_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, + void *const userdata) { xmpp_ctx_t *ctx = (xmpp_ctx_t *)userdata; const char *id = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_ID); @@ -1088,8 +1088,8 @@ _disco_items_get_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, } static int -_last_activity_get_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, - void * const userdata) +_last_activity_get_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, + void *const userdata) { xmpp_ctx_t *ctx = connection_get_ctx(); const char *from = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_FROM); @@ -1150,8 +1150,8 @@ _last_activity_get_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanz } static int -_disco_info_get_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, - void * const userdata) +_disco_info_get_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, + void *const userdata) { xmpp_ctx_t *ctx = (xmpp_ctx_t *)userdata; const char *from = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_FROM); @@ -1188,8 +1188,8 @@ _disco_info_get_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, } static int -_destroy_room_result_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, - void * const userdata) +_destroy_room_result_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, + void *const userdata) { const char *id = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_ID); @@ -1210,8 +1210,8 @@ _destroy_room_result_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const sta } static int -_room_config_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, - void * const userdata) +_room_config_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, + void *const userdata) { const char *id = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_ID); const char *type = xmpp_stanza_get_type(stanza); @@ -1264,8 +1264,9 @@ _room_config_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, return 0; } -static int _room_affiliation_set_result_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, - void * const userdata) +static int +_room_affiliation_set_result_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, + void *const userdata) { const char *id = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_ID); const char *type = xmpp_stanza_get_type(stanza); @@ -1293,8 +1294,9 @@ static int _room_affiliation_set_result_handler(xmpp_conn_t * const conn, xmpp_s return 0; } -static int _room_role_set_result_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, - void * const userdata) +static int +_room_role_set_result_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, + void *const userdata) { const char *id = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_ID); const char *type = xmpp_stanza_get_type(stanza); @@ -1323,7 +1325,7 @@ static int _room_role_set_result_handler(xmpp_conn_t * const conn, xmpp_stanza_t } static int -_room_affiliation_list_result_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, void * const userdata) +_room_affiliation_list_result_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, void *const userdata) { const char *id = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_ID); const char *type = xmpp_stanza_get_type(stanza); @@ -1371,7 +1373,7 @@ _room_affiliation_list_result_handler(xmpp_conn_t * const conn, xmpp_stanza_t * } static int -_room_role_list_result_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, void * const userdata) +_room_role_list_result_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, void *const userdata) { const char *id = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_ID); const char *type = xmpp_stanza_get_type(stanza); @@ -1418,8 +1420,8 @@ _room_role_list_result_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const s } static int -_room_config_submit_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, - void * const userdata) +_room_config_submit_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, + void *const userdata) { const char *id = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_ID); const char *type = xmpp_stanza_get_type(stanza); @@ -1445,7 +1447,7 @@ _room_config_submit_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stan } static int -_room_kick_result_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, void * const userdata) +_room_kick_result_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, void *const userdata) { const char *id = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_ID); const char *type = xmpp_stanza_get_type(stanza); @@ -1494,8 +1496,8 @@ _item_destroy(DiscoItem *item) } static int -_room_info_response_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, - void * const userdata) +_room_info_response_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, + void *const userdata) { const char *type = xmpp_stanza_get_type(stanza); ProfRoomInfoData *cb_data = (ProfRoomInfoData *)userdata; @@ -1573,8 +1575,8 @@ _room_info_response_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stan } static int -_last_activity_response_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, - void * const userdata) +_last_activity_response_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, + void *const userdata) { const char *from = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_FROM); if (!from) { @@ -1628,8 +1630,8 @@ _last_activity_response_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const } static int -_disco_info_response_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, - void * const userdata) +_disco_info_response_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, + void *const userdata) { const char *from = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_FROM); const char *type = xmpp_stanza_get_type(stanza); @@ -1706,8 +1708,8 @@ _disco_info_response_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const sta } static int -_disco_items_result_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, - void * const userdata) +_disco_items_result_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, + void *const userdata) { log_debug("Received diso#items response"); diff --git a/src/xmpp/message.c b/src/xmpp/message.c index ad75735b..810cb6e1 100644 --- a/src/xmpp/message.c +++ b/src/xmpp/message.c @@ -61,13 +61,13 @@ #define HANDLE(ns, type, func) xmpp_handler_add(conn, func, ns, STANZA_NAME_MESSAGE, type, ctx) -static int _groupchat_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, void * const userdata); -static int _chat_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, void * const userdata); -static int _muc_user_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, void * const userdata); -static int _conference_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, void * const userdata); -static int _captcha_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, void * const userdata); -static int _message_error_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, void * const userdata); -static int _receipt_received_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, void * const userdata); +static int _groupchat_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, void *const userdata); +static int _chat_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, void *const userdata); +static int _muc_user_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, void *const userdata); +static int _conference_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, void *const userdata); +static int _captcha_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, void *const userdata); +static int _message_error_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, void *const userdata); +static int _receipt_received_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, void *const userdata); void message_add_handlers(void) @@ -85,7 +85,7 @@ message_add_handlers(void) } static char* -_session_jid(const char * const barejid) +_session_jid(const char *const barejid) { ChatSession *session = chat_session_get(barejid); char *jid = NULL; @@ -101,7 +101,7 @@ _session_jid(const char * const barejid) } static char* -_session_state(const char * const barejid) +_session_state(const char *const barejid) { ChatSession *session = chat_session_get(barejid); char *state = NULL; @@ -118,8 +118,8 @@ _session_state(const char * const barejid) return state; } -char * -message_send_chat(const char * const barejid, const char * const msg) +char* +message_send_chat(const char *const barejid, const char *const msg) { xmpp_conn_t * const conn = connection_get_conn(); xmpp_ctx_t * const ctx = connection_get_ctx(); @@ -145,8 +145,8 @@ message_send_chat(const char * const barejid, const char * const msg) return id; } -char * -message_send_chat_pgp(const char * const barejid, const char * const msg) +char* +message_send_chat_pgp(const char *const barejid, const char *const msg) { xmpp_conn_t * const conn = connection_get_conn(); xmpp_ctx_t * const ctx = connection_get_ctx(); @@ -203,8 +203,8 @@ message_send_chat_pgp(const char * const barejid, const char * const msg) return id; } -char * -message_send_chat_otr(const char * const barejid, const char * const msg) +char* +message_send_chat_otr(const char *const barejid, const char *const msg) { xmpp_conn_t * const conn = connection_get_conn(); xmpp_ctx_t * const ctx = connection_get_ctx(); @@ -235,7 +235,7 @@ message_send_chat_otr(const char * const barejid, const char * const msg) } void -message_send_private(const char * const fulljid, const char * const msg) +message_send_private(const char *const fulljid, const char *const msg) { xmpp_conn_t * const conn = connection_get_conn(); xmpp_ctx_t * const ctx = connection_get_ctx(); @@ -248,7 +248,7 @@ message_send_private(const char * const fulljid, const char * const msg) } void -message_send_groupchat(const char * const roomjid, const char * const msg) +message_send_groupchat(const char *const roomjid, const char *const msg) { xmpp_conn_t * const conn = connection_get_conn(); xmpp_ctx_t * const ctx = connection_get_ctx(); @@ -261,7 +261,7 @@ message_send_groupchat(const char * const roomjid, const char * const msg) } void -message_send_groupchat_subject(const char * const roomjid, const char * const subject) +message_send_groupchat_subject(const char *const roomjid, const char *const subject) { xmpp_conn_t * const conn = connection_get_conn(); xmpp_ctx_t * const ctx = connection_get_ctx(); @@ -272,8 +272,8 @@ message_send_groupchat_subject(const char * const roomjid, const char * const su } void -message_send_invite(const char * const roomjid, const char * const contact, - const char * const reason) +message_send_invite(const char *const roomjid, const char *const contact, + const char *const reason) { xmpp_conn_t * const conn = connection_get_conn(); xmpp_ctx_t * const ctx = connection_get_ctx(); @@ -295,7 +295,7 @@ message_send_invite(const char * const roomjid, const char * const contact, } void -message_send_composing(const char * const jid) +message_send_composing(const char *const jid) { xmpp_conn_t * const conn = connection_get_conn(); xmpp_ctx_t * const ctx = connection_get_ctx(); @@ -307,7 +307,7 @@ message_send_composing(const char * const jid) } void -message_send_paused(const char * const jid) +message_send_paused(const char *const jid) { xmpp_conn_t * const conn = connection_get_conn(); xmpp_ctx_t * const ctx = connection_get_ctx(); @@ -317,7 +317,7 @@ message_send_paused(const char * const jid) } void -message_send_inactive(const char * const jid) +message_send_inactive(const char *const jid) { xmpp_conn_t * const conn = connection_get_conn(); xmpp_ctx_t * const ctx = connection_get_ctx(); @@ -328,7 +328,7 @@ message_send_inactive(const char * const jid) } void -message_send_gone(const char * const jid) +message_send_gone(const char *const jid) { xmpp_conn_t * const conn = connection_get_conn(); xmpp_ctx_t * const ctx = connection_get_ctx(); @@ -338,7 +338,7 @@ message_send_gone(const char * const jid) } static int -_message_error_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, void * const userdata) +_message_error_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, void *const userdata) { char *id = xmpp_stanza_get_id(stanza); char *jid = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_FROM); @@ -388,7 +388,7 @@ _message_error_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, v } static int -_muc_user_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, void * const userdata) +_muc_user_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, void *const userdata) { xmpp_ctx_t *ctx = connection_get_ctx(); xmpp_stanza_t *xns_muc_user = xmpp_stanza_get_child_by_ns(stanza, STANZA_NS_MUC_USER); @@ -442,7 +442,7 @@ _muc_user_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, void * } static int -_conference_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, void * const userdata) +_conference_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, void *const userdata) { xmpp_stanza_t *xns_conference = xmpp_stanza_get_child_by_ns(stanza, STANZA_NS_CONFERENCE); @@ -474,7 +474,7 @@ _conference_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, void } static int -_captcha_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, void * const userdata) +_captcha_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, void *const userdata) { xmpp_ctx_t *ctx = connection_get_ctx(); char *from = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_FROM); @@ -502,7 +502,7 @@ _captcha_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, void * } static int -_groupchat_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, void * const userdata) +_groupchat_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, void *const userdata) { xmpp_ctx_t *ctx = connection_get_ctx(); char *message = NULL; @@ -584,7 +584,7 @@ _groupchat_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, void } void -_message_send_receipt(const char * const fulljid, const char * const message_id) +_message_send_receipt(const char *const fulljid, const char *const message_id) { xmpp_conn_t * const conn = connection_get_conn(); xmpp_ctx_t * const ctx = connection_get_ctx(); @@ -608,7 +608,7 @@ _message_send_receipt(const char * const fulljid, const char * const message_id) } static int -_receipt_received_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, void * const userdata) +_receipt_received_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, void *const userdata) { xmpp_stanza_t *receipt = xmpp_stanza_get_child_by_ns(stanza, STANZA_NS_RECEIPTS); char *name = xmpp_stanza_get_name(receipt); @@ -634,7 +634,7 @@ _receipt_received_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza } void -_receipt_request_handler(xmpp_stanza_t * const stanza) +_receipt_request_handler(xmpp_stanza_t *const stanza) { if (!prefs_get_boolean(PREF_RECEIPTS_SEND)) { return; @@ -662,7 +662,7 @@ _receipt_request_handler(xmpp_stanza_t * const stanza) } void -_private_chat_handler(xmpp_stanza_t * const stanza, const char * const fulljid) +_private_chat_handler(xmpp_stanza_t *const stanza, const char *const fulljid) { xmpp_stanza_t *body = xmpp_stanza_get_child_by_name(stanza, STANZA_NAME_BODY); if (!body) { @@ -687,7 +687,7 @@ _private_chat_handler(xmpp_stanza_t * const stanza, const char * const fulljid) } static gboolean -_handle_carbons(xmpp_stanza_t * const stanza) +_handle_carbons(xmpp_stanza_t *const stanza) { xmpp_stanza_t *carbons = xmpp_stanza_get_child_by_ns(stanza, STANZA_NS_CARBONS); if (!carbons) { @@ -739,7 +739,7 @@ _handle_carbons(xmpp_stanza_t * const stanza) } static int -_chat_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, void * const userdata) +_chat_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, void *const userdata) { // ignore if type not chat or absent char *type = xmpp_stanza_get_type(stanza); diff --git a/src/xmpp/presence.c b/src/xmpp/presence.c index e475f599..1cfa9e4e 100644 --- a/src/xmpp/presence.c +++ b/src/xmpp/presence.c @@ -62,23 +62,15 @@ static Autocomplete sub_requests_ac; -#define HANDLE(ns, type, func) xmpp_handler_add(conn, func, ns, \ - STANZA_NAME_PRESENCE, type, ctx) - -static int _unavailable_handler(xmpp_conn_t * const conn, - xmpp_stanza_t * const stanza, void * const userdata); -static int _subscribe_handler(xmpp_conn_t * const conn, - xmpp_stanza_t * const stanza, void * const userdata); -static int _subscribed_handler(xmpp_conn_t * const conn, - xmpp_stanza_t * const stanza, void * const userdata); -static int _unsubscribed_handler(xmpp_conn_t * const conn, - xmpp_stanza_t * const stanza, void * const userdata); -static int _available_handler(xmpp_conn_t * const conn, - xmpp_stanza_t * const stanza, void * const userdata); -static int _muc_user_handler(xmpp_conn_t * const conn, - xmpp_stanza_t * const stanza, void * const userdata); -static int _presence_error_handler(xmpp_conn_t * const conn, - xmpp_stanza_t * const stanza, void * const userdata); +#define HANDLE(ns, type, func) xmpp_handler_add(conn, func, ns, STANZA_NAME_PRESENCE, type, ctx) + +static int _unavailable_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, void *const userdata); +static int _subscribe_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, void *const userdata); +static int _subscribed_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, void *const userdata); +static int _unsubscribed_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, void *const userdata); +static int _available_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, void *const userdata); +static int _muc_user_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, void *const userdata); +static int _presence_error_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, void *const userdata); void _send_caps_request(char *node, char *caps_key, char *id, char *from); static void _send_room_presence(xmpp_conn_t *conn, xmpp_stanza_t *presence); @@ -105,7 +97,7 @@ presence_add_handlers(void) } void -presence_subscription(const char * const jid, const jabber_subscr_t action) +presence_subscription(const char *const jid, const jabber_subscr_t action) { assert(jid != NULL); @@ -149,7 +141,7 @@ presence_subscription(const char * const jid, const jabber_subscr_t action) free(id); } -GSList * +GSList* presence_get_subscription_requests(void) { return autocomplete_create_list(sub_requests_ac); @@ -167,14 +159,14 @@ presence_clear_sub_requests(void) autocomplete_clear(sub_requests_ac); } -char * -presence_sub_request_find(const char * const search_str) +char* +presence_sub_request_find(const char *const search_str) { return autocomplete_complete(sub_requests_ac, search_str, TRUE); } gboolean -presence_sub_request_exists(const char * const bare_jid) +presence_sub_request_exists(const char *const bare_jid) { gboolean result = FALSE; GSList *requests_p = autocomplete_create_list(sub_requests_ac); @@ -202,7 +194,7 @@ presence_reset_sub_request_search(void) } void -presence_send(const resource_presence_t presence_type, const char * const msg, const int idle, char *signed_status) +presence_send(const resource_presence_t presence_type, const char *const msg, const int idle, char *signed_status) { if (jabber_get_connection_status() != JABBER_CONNECTED) { log_warning("Error setting presence, not connected."); @@ -317,7 +309,7 @@ presence_join_room(char *room, char *nick, char * passwd) } void -presence_change_room_nick(const char * const room, const char * const nick) +presence_change_room_nick(const char *const room, const char *const nick) { assert(room != NULL); assert(nick != NULL); @@ -347,7 +339,7 @@ presence_change_room_nick(const char * const room, const char * const nick) } void -presence_leave_chat_room(const char * const room_jid) +presence_leave_chat_room(const char *const room_jid) { assert(room_jid != NULL); @@ -365,8 +357,8 @@ presence_leave_chat_room(const char * const room_jid) } static int -_presence_error_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, - void * const userdata) +_presence_error_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, + void *const userdata) { char *id = xmpp_stanza_get_id(stanza); char *from = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_FROM); @@ -439,8 +431,8 @@ _presence_error_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, static int -_unsubscribed_handler(xmpp_conn_t * const conn, - xmpp_stanza_t * const stanza, void * const userdata) +_unsubscribed_handler(xmpp_conn_t *const conn, + xmpp_stanza_t *const stanza, void *const userdata) { char *from = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_FROM); Jid *from_jid = jid_create(from); @@ -455,8 +447,8 @@ _unsubscribed_handler(xmpp_conn_t * const conn, } static int -_subscribed_handler(xmpp_conn_t * const conn, - xmpp_stanza_t * const stanza, void * const userdata) +_subscribed_handler(xmpp_conn_t *const conn, + xmpp_stanza_t *const stanza, void *const userdata) { char *from = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_FROM); Jid *from_jid = jid_create(from); @@ -471,8 +463,8 @@ _subscribed_handler(xmpp_conn_t * const conn, } static int -_subscribe_handler(xmpp_conn_t * const conn, - xmpp_stanza_t * const stanza, void * const userdata) +_subscribe_handler(xmpp_conn_t *const conn, + xmpp_stanza_t *const stanza, void *const userdata) { char *from = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_FROM); log_debug("Subscribe presence handler fired for %s", from); @@ -491,8 +483,8 @@ _subscribe_handler(xmpp_conn_t * const conn, } static int -_unavailable_handler(xmpp_conn_t * const conn, - xmpp_stanza_t * const stanza, void * const userdata) +_unavailable_handler(xmpp_conn_t *const conn, + xmpp_stanza_t *const stanza, void *const userdata) { ui_input_nonblocking(TRUE); @@ -568,8 +560,8 @@ _handle_caps(char *jid, XMPPCaps *caps) } static int -_available_handler(xmpp_conn_t * const conn, - xmpp_stanza_t * const stanza, void * const userdata) +_available_handler(xmpp_conn_t *const conn, + xmpp_stanza_t *const stanza, void *const userdata) { ui_input_nonblocking(TRUE); @@ -668,7 +660,7 @@ _send_caps_request(char *node, char *caps_key, char *id, char *from) } static int -_muc_user_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, void * const userdata) +_muc_user_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, void *const userdata) { ui_input_nonblocking(TRUE); diff --git a/src/xmpp/roster.c b/src/xmpp/roster.c index 1138061b..516d291c 100644 --- a/src/xmpp/roster.c +++ b/src/xmpp/roster.c @@ -60,8 +60,7 @@ #include "xmpp/stanza.h" #include "xmpp/xmpp.h" -#define HANDLE(type, func) xmpp_handler_add(conn, func, XMPP_NS_ROSTER, \ -STANZA_NAME_IQ, type, ctx) +#define HANDLE(type, func) xmpp_handler_add(conn, func, XMPP_NS_ROSTER, STANZA_NAME_IQ, type, ctx) // callback data for group commands typedef struct _group_data { @@ -70,21 +69,15 @@ typedef struct _group_data { } GroupData; // event handlers -static int _roster_set_handler(xmpp_conn_t * const conn, - xmpp_stanza_t * const stanza, void * const userdata); -static int _roster_result_handler(xmpp_conn_t * const conn, - xmpp_stanza_t * const stanza, void * const userdata); +static int _roster_set_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, void *const userdata); +static int _roster_result_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, void *const userdata); // id handlers -static int -_group_add_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, - void * const userdata); -static int -_group_remove_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, - void * const userdata); +static int _group_add_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, void *const userdata); +static int _group_remove_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, void *const userdata); // helper functions -GSList * _get_groups_from_item(xmpp_stanza_t *item); +GSList* _get_groups_from_item(xmpp_stanza_t *item); void roster_add_handlers(void) @@ -107,7 +100,7 @@ roster_request(void) } void -roster_send_add_new(const char * const barejid, const char * const name) +roster_send_add_new(const char *const barejid, const char *const name) { xmpp_conn_t * const conn = connection_get_conn(); xmpp_ctx_t * const ctx = connection_get_ctx(); @@ -119,7 +112,7 @@ roster_send_add_new(const char * const barejid, const char * const name) } void -roster_send_remove(const char * const barejid) +roster_send_remove(const char *const barejid) { xmpp_conn_t * const conn = connection_get_conn(); xmpp_ctx_t * const ctx = connection_get_ctx(); @@ -129,7 +122,7 @@ roster_send_remove(const char * const barejid) } void -roster_send_name_change(const char * const barejid, const char * const new_name, GSList *groups) +roster_send_name_change(const char *const barejid, const char *const new_name, GSList *groups) { xmpp_conn_t * const conn = connection_get_conn(); xmpp_ctx_t * const ctx = connection_get_ctx(); @@ -141,7 +134,7 @@ roster_send_name_change(const char * const barejid, const char * const new_name, } void -roster_send_add_to_group(const char * const group, PContact contact) +roster_send_add_to_group(const char *const group, PContact contact) { GSList *groups = p_contact_groups(contact); GSList *new_groups = NULL; @@ -172,8 +165,8 @@ roster_send_add_to_group(const char * const group, PContact contact) } static int -_group_add_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, - void * const userdata) +_group_add_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, + void *const userdata) { if (userdata) { GroupData *data = userdata; @@ -186,7 +179,7 @@ _group_add_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, } void -roster_send_remove_from_group(const char * const group, PContact contact) +roster_send_remove_from_group(const char *const group, PContact contact) { GSList *groups = p_contact_groups(contact); GSList *new_groups = NULL; @@ -219,8 +212,8 @@ roster_send_remove_from_group(const char * const group, PContact contact) } static int -_group_remove_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, - void * const userdata) +_group_remove_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, + void *const userdata) { if (userdata) { GroupData *data = userdata; @@ -233,8 +226,8 @@ _group_remove_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, } static int -_roster_set_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, - void * const userdata) +_roster_set_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, + void *const userdata) { xmpp_stanza_t *query = xmpp_stanza_get_child_by_name(stanza, STANZA_NAME_QUERY); @@ -303,7 +296,7 @@ _roster_set_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, } static int -_roster_result_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, void * const userdata) +_roster_result_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, void *const userdata) { const char *id = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_ID); @@ -375,7 +368,7 @@ _roster_result_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, v return 1; } -GSList * +GSList* _get_groups_from_item(xmpp_stanza_t *item) { GSList *groups = NULL; diff --git a/src/xmpp/stanza.c b/src/xmpp/stanza.c index 765b9c4b..7679e6c3 100644 --- a/src/xmpp/stanza.c +++ b/src/xmpp/stanza.c @@ -56,7 +56,7 @@ #include "muc.h" #if 0 -xmpp_stanza_t * +xmpp_stanza_t* stanza_create_bookmarks_pubsub_request(xmpp_ctx_t *ctx) { xmpp_stanza_t *iq, *pubsub, *items; @@ -84,7 +84,7 @@ stanza_create_bookmarks_pubsub_request(xmpp_ctx_t *ctx) } #endif -xmpp_stanza_t * +xmpp_stanza_t* stanza_create_bookmarks_storage_request(xmpp_ctx_t *ctx) { xmpp_stanza_t *iq, *query, *storage; @@ -113,9 +113,9 @@ stanza_create_bookmarks_storage_request(xmpp_ctx_t *ctx) } #if 0 -xmpp_stanza_t * -stanza_create_bookmarks_pubsub_add(xmpp_ctx_t *ctx, const char * const jid, - const gboolean autojoin, const char * const nick) +xmpp_stanza_t* +stanza_create_bookmarks_pubsub_add(xmpp_ctx_t *ctx, const char *const jid, + const gboolean autojoin, const char *const nick) { xmpp_stanza_t *stanza = xmpp_stanza_new(ctx); xmpp_stanza_set_name(stanza, STANZA_NAME_IQ); @@ -206,8 +206,9 @@ stanza_create_bookmarks_pubsub_add(xmpp_ctx_t *ctx, const char * const jid, } #endif -xmpp_stanza_t * -stanza_enable_carbons(xmpp_ctx_t *ctx){ +xmpp_stanza_t* +stanza_enable_carbons(xmpp_ctx_t *ctx) +{ xmpp_stanza_t *iq = xmpp_stanza_new(ctx); char *id = create_unique_id("carbons"); @@ -226,8 +227,9 @@ stanza_enable_carbons(xmpp_ctx_t *ctx){ return iq; } -xmpp_stanza_t * -stanza_disable_carbons(xmpp_ctx_t *ctx){ +xmpp_stanza_t* +stanza_disable_carbons(xmpp_ctx_t *ctx) +{ xmpp_stanza_t *iq = xmpp_stanza_new(ctx); char *id = create_unique_id("carbons"); @@ -246,8 +248,8 @@ stanza_disable_carbons(xmpp_ctx_t *ctx){ return iq; } -xmpp_stanza_t * -stanza_create_chat_state(xmpp_ctx_t *ctx, const char * const fulljid, const char * const state) +xmpp_stanza_t* +stanza_create_chat_state(xmpp_ctx_t *ctx, const char *const fulljid, const char *const state) { xmpp_stanza_t *msg, *chat_state; @@ -268,8 +270,8 @@ stanza_create_chat_state(xmpp_ctx_t *ctx, const char * const fulljid, const char return msg; } -xmpp_stanza_t * -stanza_create_room_subject_message(xmpp_ctx_t *ctx, const char * const room, const char * const subject) +xmpp_stanza_t* +stanza_create_room_subject_message(xmpp_ctx_t *ctx, const char *const room, const char *const subject) { xmpp_stanza_t *msg = xmpp_stanza_new(ctx); xmpp_stanza_set_name(msg, STANZA_NAME_MESSAGE); @@ -291,8 +293,8 @@ stanza_create_room_subject_message(xmpp_ctx_t *ctx, const char * const room, con return msg; } -xmpp_stanza_t * -stanza_attach_state(xmpp_ctx_t *ctx, xmpp_stanza_t *stanza, const char * const state) +xmpp_stanza_t* +stanza_attach_state(xmpp_ctx_t *ctx, xmpp_stanza_t *stanza, const char *const state) { xmpp_stanza_t *chat_state = xmpp_stanza_new(ctx); xmpp_stanza_set_name(chat_state, state); @@ -303,7 +305,7 @@ stanza_attach_state(xmpp_ctx_t *ctx, xmpp_stanza_t *stanza, const char * const s return stanza; } -xmpp_stanza_t * +xmpp_stanza_t* stanza_attach_carbons_private(xmpp_ctx_t *ctx, xmpp_stanza_t *stanza) { xmpp_stanza_t *private_carbon = xmpp_stanza_new(ctx); @@ -315,7 +317,7 @@ stanza_attach_carbons_private(xmpp_ctx_t *ctx, xmpp_stanza_t *stanza) return stanza; } -xmpp_stanza_t * +xmpp_stanza_t* stanza_attach_hints_no_copy(xmpp_ctx_t *ctx, xmpp_stanza_t *stanza) { xmpp_stanza_t *no_copy = xmpp_stanza_new(ctx); @@ -327,7 +329,7 @@ stanza_attach_hints_no_copy(xmpp_ctx_t *ctx, xmpp_stanza_t *stanza) return stanza; } -xmpp_stanza_t * +xmpp_stanza_t* stanza_attach_hints_no_store(xmpp_ctx_t *ctx, xmpp_stanza_t *stanza) { xmpp_stanza_t *no_store = xmpp_stanza_new(ctx); @@ -339,7 +341,7 @@ stanza_attach_hints_no_store(xmpp_ctx_t *ctx, xmpp_stanza_t *stanza) return stanza; } -xmpp_stanza_t * +xmpp_stanza_t* stanza_attach_receipt_request(xmpp_ctx_t *ctx, xmpp_stanza_t *stanza) { xmpp_stanza_t *receipet_request = xmpp_stanza_new(ctx); @@ -351,9 +353,9 @@ stanza_attach_receipt_request(xmpp_ctx_t *ctx, xmpp_stanza_t *stanza) return stanza; } -xmpp_stanza_t * -stanza_create_message(xmpp_ctx_t *ctx, char *id, const char * const recipient, - const char * const type, const char * const message) +xmpp_stanza_t* +stanza_create_message(xmpp_ctx_t *ctx, char *id, const char *const recipient, + const char *const type, const char *const message) { xmpp_stanza_t *msg, *body, *text; @@ -376,8 +378,8 @@ stanza_create_message(xmpp_ctx_t *ctx, char *id, const char * const recipient, return msg; } -xmpp_stanza_t * -stanza_create_roster_remove_set(xmpp_ctx_t *ctx, const char * const barejid) +xmpp_stanza_t* +stanza_create_roster_remove_set(xmpp_ctx_t *ctx, const char *const barejid) { xmpp_stanza_t *iq = xmpp_stanza_new(ctx); xmpp_stanza_set_name(iq, STANZA_NAME_IQ); @@ -405,9 +407,9 @@ stanza_create_roster_remove_set(xmpp_ctx_t *ctx, const char * const barejid) } -xmpp_stanza_t * -stanza_create_roster_set(xmpp_ctx_t *ctx, const char * const id, - const char * const jid, const char * const handle, GSList *groups) +xmpp_stanza_t* +stanza_create_roster_set(xmpp_ctx_t *ctx, const char *const id, + const char *const jid, const char *const handle, GSList *groups) { xmpp_stanza_t *iq = xmpp_stanza_new(ctx); xmpp_stanza_set_name(iq, STANZA_NAME_IQ); @@ -450,9 +452,9 @@ stanza_create_roster_set(xmpp_ctx_t *ctx, const char * const id, return iq; } -xmpp_stanza_t * -stanza_create_invite(xmpp_ctx_t *ctx, const char * const room, - const char * const contact, const char * const reason, const char * const password) +xmpp_stanza_t* +stanza_create_invite(xmpp_ctx_t *ctx, const char *const room, + const char *const contact, const char *const reason, const char *const password) { xmpp_stanza_t *message, *x; @@ -481,9 +483,9 @@ stanza_create_invite(xmpp_ctx_t *ctx, const char * const room, return message; } -xmpp_stanza_t * -stanza_create_mediated_invite(xmpp_ctx_t *ctx, const char * const room, - const char * const contact, const char * const reason) +xmpp_stanza_t* +stanza_create_mediated_invite(xmpp_ctx_t *ctx, const char *const room, + const char *const contact, const char *const reason) { xmpp_stanza_t *message, *x, *invite; @@ -521,9 +523,9 @@ stanza_create_mediated_invite(xmpp_ctx_t *ctx, const char * const room, return message; } -xmpp_stanza_t * -stanza_create_room_join_presence(xmpp_ctx_t * const ctx, - const char * const full_room_jid, const char * const passwd) +xmpp_stanza_t* +stanza_create_room_join_presence(xmpp_ctx_t *const ctx, + const char *const full_room_jid, const char *const passwd) { xmpp_stanza_t *presence = xmpp_stanza_new(ctx); xmpp_stanza_set_name(presence, STANZA_NAME_PRESENCE); @@ -554,9 +556,9 @@ stanza_create_room_join_presence(xmpp_ctx_t * const ctx, return presence; } -xmpp_stanza_t * +xmpp_stanza_t* stanza_create_room_newnick_presence(xmpp_ctx_t *ctx, - const char * const full_room_jid) + const char *const full_room_jid) { xmpp_stanza_t *presence = xmpp_stanza_new(ctx); char *id = create_unique_id("sub"); @@ -568,9 +570,9 @@ stanza_create_room_newnick_presence(xmpp_ctx_t *ctx, return presence; } -xmpp_stanza_t * -stanza_create_room_leave_presence(xmpp_ctx_t *ctx, const char * const room, - const char * const nick) +xmpp_stanza_t* +stanza_create_room_leave_presence(xmpp_ctx_t *ctx, const char *const room, + const char *const nick) { GString *full_jid = g_string_new(room); g_string_append(full_jid, "/"); @@ -589,8 +591,8 @@ stanza_create_room_leave_presence(xmpp_ctx_t *ctx, const char * const room, return presence; } -xmpp_stanza_t * -stanza_create_instant_room_request_iq(xmpp_ctx_t *ctx, const char * const room_jid) +xmpp_stanza_t* +stanza_create_instant_room_request_iq(xmpp_ctx_t *ctx, const char *const room_jid) { xmpp_stanza_t *iq = xmpp_stanza_new(ctx); xmpp_stanza_set_name(iq, STANZA_NAME_IQ); @@ -618,8 +620,8 @@ stanza_create_instant_room_request_iq(xmpp_ctx_t *ctx, const char * const room_j return iq; } -xmpp_stanza_t * -stanza_create_instant_room_destroy_iq(xmpp_ctx_t *ctx, const char * const room_jid) +xmpp_stanza_t* +stanza_create_instant_room_destroy_iq(xmpp_ctx_t *ctx, const char *const room_jid) { xmpp_stanza_t *iq = xmpp_stanza_new(ctx); xmpp_stanza_set_name(iq, STANZA_NAME_IQ); @@ -645,8 +647,8 @@ stanza_create_instant_room_destroy_iq(xmpp_ctx_t *ctx, const char * const room_j return iq; } -xmpp_stanza_t * -stanza_create_room_config_request_iq(xmpp_ctx_t *ctx, const char * const room_jid) +xmpp_stanza_t* +stanza_create_room_config_request_iq(xmpp_ctx_t *ctx, const char *const room_jid) { xmpp_stanza_t *iq = xmpp_stanza_new(ctx); xmpp_stanza_set_name(iq, STANZA_NAME_IQ); @@ -666,8 +668,8 @@ stanza_create_room_config_request_iq(xmpp_ctx_t *ctx, const char * const room_ji return iq; } -xmpp_stanza_t * -stanza_create_room_config_cancel_iq(xmpp_ctx_t *ctx, const char * const room_jid) +xmpp_stanza_t* +stanza_create_room_config_cancel_iq(xmpp_ctx_t *ctx, const char *const room_jid) { xmpp_stanza_t *iq = xmpp_stanza_new(ctx); xmpp_stanza_set_name(iq, STANZA_NAME_IQ); @@ -695,8 +697,8 @@ stanza_create_room_config_cancel_iq(xmpp_ctx_t *ctx, const char * const room_jid return iq; } -xmpp_stanza_t * -stanza_create_room_affiliation_list_iq(xmpp_ctx_t *ctx, const char * const room, const char * const affiliation) +xmpp_stanza_t* +stanza_create_room_affiliation_list_iq(xmpp_ctx_t *ctx, const char *const room, const char *const affiliation) { xmpp_stanza_t *iq = xmpp_stanza_new(ctx); xmpp_stanza_set_name(iq, STANZA_NAME_IQ); @@ -722,8 +724,8 @@ stanza_create_room_affiliation_list_iq(xmpp_ctx_t *ctx, const char * const room, return iq; } -xmpp_stanza_t * -stanza_create_room_role_list_iq(xmpp_ctx_t *ctx, const char * const room, const char * const role) +xmpp_stanza_t* +stanza_create_room_role_list_iq(xmpp_ctx_t *ctx, const char *const room, const char *const role) { xmpp_stanza_t *iq = xmpp_stanza_new(ctx); xmpp_stanza_set_name(iq, STANZA_NAME_IQ); @@ -749,9 +751,9 @@ stanza_create_room_role_list_iq(xmpp_ctx_t *ctx, const char * const room, const return iq; } -xmpp_stanza_t * -stanza_create_room_affiliation_set_iq(xmpp_ctx_t *ctx, const char * const room, const char * const jid, - const char * const affiliation, const char * const reason) +xmpp_stanza_t* +stanza_create_room_affiliation_set_iq(xmpp_ctx_t *ctx, const char *const room, const char *const jid, + const char *const affiliation, const char *const reason) { xmpp_stanza_t *iq = xmpp_stanza_new(ctx); xmpp_stanza_set_name(iq, STANZA_NAME_IQ); @@ -790,9 +792,9 @@ stanza_create_room_affiliation_set_iq(xmpp_ctx_t *ctx, const char * const room, return iq; } -xmpp_stanza_t * -stanza_create_room_role_set_iq(xmpp_ctx_t * const ctx, const char * const room, const char * const nick, - const char * const role, const char * const reason) +xmpp_stanza_t* +stanza_create_room_role_set_iq(xmpp_ctx_t *const ctx, const char *const room, const char *const nick, + const char *const role, const char *const reason) { xmpp_stanza_t *iq = xmpp_stanza_new(ctx); xmpp_stanza_set_name(iq, STANZA_NAME_IQ); @@ -831,9 +833,9 @@ stanza_create_room_role_set_iq(xmpp_ctx_t * const ctx, const char * const room, return iq; } -xmpp_stanza_t * -stanza_create_room_kick_iq(xmpp_ctx_t * const ctx, const char * const room, const char * const nick, - const char * const reason) +xmpp_stanza_t* +stanza_create_room_kick_iq(xmpp_ctx_t *const ctx, const char *const room, const char *const nick, + const char *const reason) { xmpp_stanza_t *iq = xmpp_stanza_new(ctx); xmpp_stanza_set_name(iq, STANZA_NAME_IQ); @@ -872,8 +874,8 @@ stanza_create_room_kick_iq(xmpp_ctx_t * const ctx, const char * const room, cons return iq; } -xmpp_stanza_t * -stanza_create_presence(xmpp_ctx_t * const ctx) +xmpp_stanza_t* +stanza_create_presence(xmpp_ctx_t *const ctx) { xmpp_stanza_t *presence = xmpp_stanza_new(ctx); xmpp_stanza_set_name(presence, STANZA_NAME_PRESENCE); @@ -881,8 +883,8 @@ stanza_create_presence(xmpp_ctx_t * const ctx) return presence; } -xmpp_stanza_t * -stanza_create_software_version_iq(xmpp_ctx_t *ctx, const char * const fulljid) +xmpp_stanza_t* +stanza_create_software_version_iq(xmpp_ctx_t *ctx, const char *const fulljid) { xmpp_stanza_t *iq = xmpp_stanza_new(ctx); xmpp_stanza_set_name(iq, STANZA_NAME_IQ); @@ -904,7 +906,7 @@ stanza_create_software_version_iq(xmpp_ctx_t *ctx, const char * const fulljid) return iq; } -xmpp_stanza_t * +xmpp_stanza_t* stanza_create_roster_iq(xmpp_ctx_t *ctx) { xmpp_stanza_t *iq = xmpp_stanza_new(ctx); @@ -922,9 +924,9 @@ stanza_create_roster_iq(xmpp_ctx_t *ctx) return iq; } -xmpp_stanza_t * -stanza_create_disco_info_iq(xmpp_ctx_t *ctx, const char * const id, const char * const to, - const char * const node) +xmpp_stanza_t* +stanza_create_disco_info_iq(xmpp_ctx_t *ctx, const char *const id, const char *const to, + const char *const node) { xmpp_stanza_t *iq = xmpp_stanza_new(ctx); xmpp_stanza_set_name(iq, STANZA_NAME_IQ); @@ -945,9 +947,9 @@ stanza_create_disco_info_iq(xmpp_ctx_t *ctx, const char * const id, const char * return iq; } -xmpp_stanza_t * -stanza_create_disco_items_iq(xmpp_ctx_t *ctx, const char * const id, - const char * const jid) +xmpp_stanza_t* +stanza_create_disco_items_iq(xmpp_ctx_t *ctx, const char *const id, + const char *const jid) { xmpp_stanza_t *iq = xmpp_stanza_new(ctx); xmpp_stanza_set_name(iq, STANZA_NAME_IQ); @@ -965,8 +967,8 @@ stanza_create_disco_items_iq(xmpp_ctx_t *ctx, const char * const id, return iq; } -xmpp_stanza_t * -stanza_create_last_activity_iq(xmpp_ctx_t *ctx, const char * const id, const char * const to) +xmpp_stanza_t* +stanza_create_last_activity_iq(xmpp_ctx_t *ctx, const char *const id, const char *const to) { xmpp_stanza_t *iq = xmpp_stanza_new(ctx); xmpp_stanza_set_name(iq, STANZA_NAME_IQ); @@ -984,8 +986,8 @@ stanza_create_last_activity_iq(xmpp_ctx_t *ctx, const char * const id, const cha return iq; } -xmpp_stanza_t * -stanza_create_room_config_submit_iq(xmpp_ctx_t *ctx, const char * const room, DataForm *form) +xmpp_stanza_t* +stanza_create_room_config_submit_iq(xmpp_ctx_t *ctx, const char *const room, DataForm *form) { xmpp_stanza_t *iq = xmpp_stanza_new(ctx); xmpp_stanza_set_name(iq, STANZA_NAME_IQ); @@ -1019,8 +1021,8 @@ stanza_contains_chat_state(xmpp_stanza_t *stanza) (xmpp_stanza_get_child_by_name(stanza, STANZA_NAME_INACTIVE) != NULL)); } -xmpp_stanza_t * -stanza_create_ping_iq(xmpp_ctx_t *ctx, const char * const target) +xmpp_stanza_t* +stanza_create_ping_iq(xmpp_ctx_t *ctx, const char *const target) { xmpp_stanza_t *iq = xmpp_stanza_new(ctx); xmpp_stanza_set_name(iq, STANZA_NAME_IQ); @@ -1044,7 +1046,7 @@ stanza_create_ping_iq(xmpp_ctx_t *ctx, const char * const target) } GDateTime* -stanza_get_delay(xmpp_stanza_t * const stanza) +stanza_get_delay(xmpp_stanza_t *const stanza) { GTimeVal utc_stamp; // first check for XEP-0203 delayed delivery @@ -1081,7 +1083,7 @@ stanza_get_delay(xmpp_stanza_t * const stanza) return NULL; } -char * +char* stanza_get_status(xmpp_stanza_t *stanza, char *def) { xmpp_ctx_t *ctx = connection_get_ctx(); @@ -1105,7 +1107,7 @@ stanza_get_status(xmpp_stanza_t *stanza, char *def) } } -char * +char* stanza_get_show(xmpp_stanza_t *stanza, char *def) { xmpp_ctx_t *ctx = connection_get_ctx(); @@ -1130,7 +1132,7 @@ stanza_get_show(xmpp_stanza_t *stanza, char *def) } gboolean -stanza_is_muc_presence(xmpp_stanza_t * const stanza) +stanza_is_muc_presence(xmpp_stanza_t *const stanza) { if (stanza == NULL) { return FALSE; @@ -1149,7 +1151,7 @@ stanza_is_muc_presence(xmpp_stanza_t * const stanza) } gboolean -stanza_muc_requires_config(xmpp_stanza_t * const stanza) +stanza_muc_requires_config(xmpp_stanza_t *const stanza) { // no stanza, or not presence stanza if ((stanza == NULL) || (g_strcmp0(xmpp_stanza_get_name(stanza), STANZA_NAME_PRESENCE) != 0)) { @@ -1186,8 +1188,8 @@ stanza_muc_requires_config(xmpp_stanza_t * const stanza) } gboolean -stanza_is_muc_self_presence(xmpp_stanza_t * const stanza, - const char * const self_jid) +stanza_is_muc_self_presence(xmpp_stanza_t *const stanza, + const char *const self_jid) { // no stanza, or not presence stanza if ((stanza == NULL) || (g_strcmp0(xmpp_stanza_get_name(stanza), STANZA_NAME_PRESENCE) != 0)) { @@ -1254,8 +1256,8 @@ stanza_is_muc_self_presence(xmpp_stanza_t * const stanza, return FALSE; } -GSList * -stanza_get_status_codes_by_ns(xmpp_stanza_t * const stanza, char *ns) +GSList* +stanza_get_status_codes_by_ns(xmpp_stanza_t *const stanza, char *ns) { GSList *codes = NULL; xmpp_stanza_t *ns_child = xmpp_stanza_get_child_by_ns(stanza, ns); @@ -1292,7 +1294,7 @@ stanza_room_destroyed(xmpp_stanza_t *stanza) return FALSE; } -char * +char* stanza_get_muc_destroy_alternative_room(xmpp_stanza_t *stanza) { char *stanza_name = xmpp_stanza_get_name(stanza); @@ -1312,7 +1314,7 @@ stanza_get_muc_destroy_alternative_room(xmpp_stanza_t *stanza) return NULL; } -char * +char* stanza_get_muc_destroy_alternative_password(xmpp_stanza_t *stanza) { char *stanza_name = xmpp_stanza_get_name(stanza); @@ -1334,7 +1336,7 @@ stanza_get_muc_destroy_alternative_password(xmpp_stanza_t *stanza) return NULL; } -char * +char* stanza_get_muc_destroy_reason(xmpp_stanza_t *stanza) { char *stanza_name = xmpp_stanza_get_name(stanza); @@ -1356,7 +1358,7 @@ stanza_get_muc_destroy_reason(xmpp_stanza_t *stanza) return NULL; } -char * +char* stanza_get_actor(xmpp_stanza_t *stanza) { char *stanza_name = xmpp_stanza_get_name(stanza); @@ -1382,7 +1384,7 @@ stanza_get_actor(xmpp_stanza_t *stanza) return NULL; } -char * +char* stanza_get_reason(xmpp_stanza_t *stanza) { char *stanza_name = xmpp_stanza_get_name(stanza); @@ -1405,7 +1407,7 @@ stanza_get_reason(xmpp_stanza_t *stanza) } gboolean -stanza_is_room_nick_change(xmpp_stanza_t * const stanza) +stanza_is_room_nick_change(xmpp_stanza_t *const stanza) { // no stanza, or not presence stanza if ((stanza == NULL) || (g_strcmp0(xmpp_stanza_get_name(stanza), STANZA_NAME_PRESENCE) != 0)) { @@ -1432,8 +1434,8 @@ stanza_is_room_nick_change(xmpp_stanza_t * const stanza) return FALSE; } -char * -stanza_get_new_nick(xmpp_stanza_t * const stanza) +char* +stanza_get_new_nick(xmpp_stanza_t *const stanza) { if (!stanza_is_room_nick_change(stanza)) { return NULL; @@ -1456,7 +1458,7 @@ stanza_get_new_nick(xmpp_stanza_t * const stanza) } int -stanza_get_idle_time(xmpp_stanza_t * const stanza) +stanza_get_idle_time(xmpp_stanza_t *const stanza) { xmpp_stanza_t *query = xmpp_stanza_get_child_by_name(stanza, STANZA_NAME_QUERY); @@ -1487,7 +1489,7 @@ stanza_get_idle_time(xmpp_stanza_t * const stanza) } XMPPCaps* -stanza_parse_caps(xmpp_stanza_t * const stanza) +stanza_parse_caps(xmpp_stanza_t *const stanza) { xmpp_stanza_t *caps_st = xmpp_stanza_get_child_by_name(stanza, STANZA_NAME_C); @@ -1512,8 +1514,8 @@ stanza_parse_caps(xmpp_stanza_t * const stanza) return caps; } -char * -stanza_get_caps_str(xmpp_stanza_t * const stanza) +char* +stanza_get_caps_str(xmpp_stanza_t *const stanza) { xmpp_stanza_t *caps = xmpp_stanza_get_child_by_name(stanza, STANZA_NAME_C); @@ -1541,7 +1543,7 @@ stanza_get_caps_str(xmpp_stanza_t * const stanza) return caps_str; } -char * +char* stanza_get_error_message(xmpp_stanza_t *stanza) { xmpp_ctx_t *ctx = connection_get_ctx(); @@ -1607,7 +1609,7 @@ stanza_get_error_message(xmpp_stanza_t *stanza) } void -stanza_attach_priority(xmpp_ctx_t * const ctx, xmpp_stanza_t * const presence, +stanza_attach_priority(xmpp_ctx_t *const ctx, xmpp_stanza_t *const presence, const int pri) { if (pri != 0) { @@ -1627,8 +1629,8 @@ stanza_attach_priority(xmpp_ctx_t * const ctx, xmpp_stanza_t * const presence, } void -stanza_attach_show(xmpp_ctx_t * const ctx, xmpp_stanza_t * const presence, - const char * const show) +stanza_attach_show(xmpp_ctx_t *const ctx, xmpp_stanza_t *const presence, + const char *const show) { if (show) { xmpp_stanza_t *show_stanza = xmpp_stanza_new(ctx); @@ -1643,8 +1645,8 @@ stanza_attach_show(xmpp_ctx_t * const ctx, xmpp_stanza_t * const presence, } void -stanza_attach_status(xmpp_ctx_t * const ctx, xmpp_stanza_t * const presence, - const char * const status) +stanza_attach_status(xmpp_ctx_t *const ctx, xmpp_stanza_t *const presence, + const char *const status) { if (status) { xmpp_stanza_t *status_stanza = xmpp_stanza_new(ctx); @@ -1659,8 +1661,8 @@ stanza_attach_status(xmpp_ctx_t * const ctx, xmpp_stanza_t * const presence, } void -stanza_attach_last_activity(xmpp_ctx_t * const ctx, - xmpp_stanza_t * const presence, const int idle) +stanza_attach_last_activity(xmpp_ctx_t *const ctx, + xmpp_stanza_t *const presence, const int idle) { xmpp_stanza_t *query = xmpp_stanza_new(ctx); xmpp_stanza_set_name(query, STANZA_NAME_QUERY); @@ -1673,7 +1675,7 @@ stanza_attach_last_activity(xmpp_ctx_t * const ctx, } void -stanza_attach_caps(xmpp_ctx_t * const ctx, xmpp_stanza_t * const presence) +stanza_attach_caps(xmpp_ctx_t *const ctx, xmpp_stanza_t *const presence) { xmpp_stanza_t *caps = xmpp_stanza_new(ctx); xmpp_stanza_set_name(caps, STANZA_NAME_C); @@ -1689,7 +1691,7 @@ stanza_attach_caps(xmpp_ctx_t * const ctx, xmpp_stanza_t * const presence) xmpp_stanza_release(query); } -const char * +const char* stanza_get_presence_string_from_type(resource_presence_t presence_type) { switch(presence_type) @@ -1759,7 +1761,7 @@ stanza_free_presence(XMPPPresence *presence) } } -XMPPPresence * +XMPPPresence* stanza_parse_presence(xmpp_stanza_t *stanza, int *err) { char *from = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_FROM); diff --git a/src/xmpp/stanza.h b/src/xmpp/stanza.h index 80a4fd93..7170e204 100644 --- a/src/xmpp/stanza.h +++ b/src/xmpp/stanza.h @@ -195,111 +195,100 @@ typedef enum { xmpp_stanza_t* stanza_create_bookmarks_storage_request(xmpp_ctx_t *ctx); -xmpp_stanza_t * stanza_enable_carbons(xmpp_ctx_t *ctx); +xmpp_stanza_t* stanza_enable_carbons(xmpp_ctx_t *ctx); -xmpp_stanza_t * stanza_disable_carbons(xmpp_ctx_t *ctx); +xmpp_stanza_t* stanza_disable_carbons(xmpp_ctx_t *ctx); xmpp_stanza_t* stanza_create_chat_state(xmpp_ctx_t *ctx, - const char * const fulljid, const char * const state); + const char *const fulljid, const char *const state); -xmpp_stanza_t * stanza_attach_state(xmpp_ctx_t *ctx, xmpp_stanza_t *stanza, const char * const state); -xmpp_stanza_t * stanza_attach_carbons_private(xmpp_ctx_t *ctx, xmpp_stanza_t *stanza); -xmpp_stanza_t * stanza_attach_hints_no_copy(xmpp_ctx_t *ctx, xmpp_stanza_t *stanza); -xmpp_stanza_t * stanza_attach_hints_no_store(xmpp_ctx_t *ctx, xmpp_stanza_t *stanza); -xmpp_stanza_t * stanza_attach_receipt_request(xmpp_ctx_t *ctx, xmpp_stanza_t *stanza); +xmpp_stanza_t* stanza_attach_state(xmpp_ctx_t *ctx, xmpp_stanza_t *stanza, const char *const state); +xmpp_stanza_t* stanza_attach_carbons_private(xmpp_ctx_t *ctx, xmpp_stanza_t *stanza); +xmpp_stanza_t* stanza_attach_hints_no_copy(xmpp_ctx_t *ctx, xmpp_stanza_t *stanza); +xmpp_stanza_t* stanza_attach_hints_no_store(xmpp_ctx_t *ctx, xmpp_stanza_t *stanza); +xmpp_stanza_t* stanza_attach_receipt_request(xmpp_ctx_t *ctx, xmpp_stanza_t *stanza); xmpp_stanza_t* stanza_create_message(xmpp_ctx_t *ctx, char *id, - const char * const recipient, const char * const type, const char * const message); + const char *const recipient, const char *const type, const char *const message); -xmpp_stanza_t* stanza_create_room_join_presence(xmpp_ctx_t * const ctx, - const char * const full_room_jid, const char * const passwd); +xmpp_stanza_t* stanza_create_room_join_presence(xmpp_ctx_t *const ctx, + const char *const full_room_jid, const char *const passwd); xmpp_stanza_t* stanza_create_room_newnick_presence(xmpp_ctx_t *ctx, - const char * const full_room_jid); + const char *const full_room_jid); xmpp_stanza_t* stanza_create_room_leave_presence(xmpp_ctx_t *ctx, - const char * const room, const char * const nick); + const char *const room, const char *const nick); -xmpp_stanza_t* stanza_create_presence(xmpp_ctx_t * const ctx); +xmpp_stanza_t* stanza_create_presence(xmpp_ctx_t *const ctx); xmpp_stanza_t* stanza_create_roster_iq(xmpp_ctx_t *ctx); -xmpp_stanza_t* stanza_create_ping_iq(xmpp_ctx_t *ctx, const char * const target); -xmpp_stanza_t* stanza_create_disco_info_iq(xmpp_ctx_t *ctx, const char * const id, - const char * const to, const char * const node); +xmpp_stanza_t* stanza_create_ping_iq(xmpp_ctx_t *ctx, const char *const target); +xmpp_stanza_t* stanza_create_disco_info_iq(xmpp_ctx_t *ctx, const char *const id, + const char *const to, const char *const node); -xmpp_stanza_t* stanza_create_last_activity_iq(xmpp_ctx_t *ctx, const char * const id, - const char * const to); +xmpp_stanza_t* stanza_create_last_activity_iq(xmpp_ctx_t *ctx, const char *const id, + const char *const to); -xmpp_stanza_t* stanza_create_invite(xmpp_ctx_t *ctx, const char * const room, - const char * const contact, const char * const reason, const char * const password); -xmpp_stanza_t* stanza_create_mediated_invite(xmpp_ctx_t *ctx, const char * const room, - const char * const contact, const char * const reason); +xmpp_stanza_t* stanza_create_invite(xmpp_ctx_t *ctx, const char *const room, + const char *const contact, const char *const reason, const char *const password); +xmpp_stanza_t* stanza_create_mediated_invite(xmpp_ctx_t *ctx, const char *const room, + const char *const contact, const char *const reason); gboolean stanza_contains_chat_state(xmpp_stanza_t *stanza); -GDateTime* stanza_get_delay(xmpp_stanza_t * const stanza); - -gboolean stanza_is_muc_presence(xmpp_stanza_t * const stanza); -gboolean stanza_is_muc_self_presence(xmpp_stanza_t * const stanza, - const char * const self_jid); -gboolean stanza_is_room_nick_change(xmpp_stanza_t * const stanza); -gboolean stanza_muc_requires_config(xmpp_stanza_t * const stanza); - -char * stanza_get_new_nick(xmpp_stanza_t * const stanza); -xmpp_stanza_t* stanza_create_instant_room_request_iq(xmpp_ctx_t *ctx, - const char * const room_jid); -xmpp_stanza_t* stanza_create_instant_room_destroy_iq(xmpp_ctx_t *ctx, - const char * const room_jid); -xmpp_stanza_t* stanza_create_room_config_request_iq(xmpp_ctx_t *ctx, - const char * const room_jid); -xmpp_stanza_t* stanza_create_room_config_cancel_iq(xmpp_ctx_t *ctx, - const char * const room_jid); -xmpp_stanza_t* stanza_create_room_config_submit_iq(xmpp_ctx_t *ctx, - const char * const room, DataForm *form); -xmpp_stanza_t* stanza_create_room_affiliation_list_iq(xmpp_ctx_t *ctx, const char * const room, - const char * const affiliation); -xmpp_stanza_t* stanza_create_room_affiliation_set_iq(xmpp_ctx_t *ctx, const char * const room, const char * const jid, - const char * const affiliation, const char * const reason); -xmpp_stanza_t* stanza_create_room_role_set_iq(xmpp_ctx_t * const ctx, const char * const room, const char * const jid, - const char * const role, const char * const reason); -xmpp_stanza_t* stanza_create_room_role_list_iq(xmpp_ctx_t *ctx, const char * const room, const char * const role); - -xmpp_stanza_t* stanza_create_room_subject_message(xmpp_ctx_t *ctx, const char * const room, const char * const subject); -xmpp_stanza_t* stanza_create_room_kick_iq(xmpp_ctx_t * const ctx, const char * const room, const char * const nick, - 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); +GDateTime* stanza_get_delay(xmpp_stanza_t *const stanza); + +gboolean stanza_is_muc_presence(xmpp_stanza_t *const stanza); +gboolean stanza_is_muc_self_presence(xmpp_stanza_t *const stanza, + const char *const self_jid); +gboolean stanza_is_room_nick_change(xmpp_stanza_t *const stanza); +gboolean stanza_muc_requires_config(xmpp_stanza_t *const stanza); + +char* stanza_get_new_nick(xmpp_stanza_t *const stanza); +xmpp_stanza_t* stanza_create_instant_room_request_iq(xmpp_ctx_t *ctx, const char *const room_jid); +xmpp_stanza_t* stanza_create_instant_room_destroy_iq(xmpp_ctx_t *ctx, const char *const room_jid); +xmpp_stanza_t* stanza_create_room_config_request_iq(xmpp_ctx_t *ctx, const char *const room_jid); +xmpp_stanza_t* stanza_create_room_config_cancel_iq(xmpp_ctx_t *ctx, const char *const room_jid); +xmpp_stanza_t* stanza_create_room_config_submit_iq(xmpp_ctx_t *ctx, const char *const room, DataForm *form); +xmpp_stanza_t* stanza_create_room_affiliation_list_iq(xmpp_ctx_t *ctx, const char *const room, + const char *const affiliation); +xmpp_stanza_t* stanza_create_room_affiliation_set_iq(xmpp_ctx_t *ctx, const char *const room, const char *const jid, + const char *const affiliation, const char *const reason); +xmpp_stanza_t* stanza_create_room_role_set_iq(xmpp_ctx_t *const ctx, const char *const room, const char *const jid, + const char *const role, const char *const reason); +xmpp_stanza_t* stanza_create_room_role_list_iq(xmpp_ctx_t *ctx, const char *const room, const char *const role); + +xmpp_stanza_t* stanza_create_room_subject_message(xmpp_ctx_t *ctx, const char *const room, const char *const subject); +xmpp_stanza_t* stanza_create_room_kick_iq(xmpp_ctx_t *const ctx, const char *const room, const char *const nick, + 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); -void stanza_attach_caps(xmpp_ctx_t * const ctx, xmpp_stanza_t * const presence); -void stanza_attach_show(xmpp_ctx_t * const ctx, xmpp_stanza_t * const presence, - const char * const show); -void stanza_attach_status(xmpp_ctx_t * const ctx, xmpp_stanza_t * const presence, - const char * const status); +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); +void stanza_attach_caps(xmpp_ctx_t *const ctx, xmpp_stanza_t *const presence); +void stanza_attach_show(xmpp_ctx_t *const ctx, xmpp_stanza_t *const presence, const char *const show); +void stanza_attach_status(xmpp_ctx_t *const ctx, xmpp_stanza_t *const presence, const char *const status); -const char * stanza_get_presence_string_from_type(resource_presence_t presence_type); -xmpp_stanza_t * stanza_create_software_version_iq(xmpp_ctx_t *ctx, const char * const fulljid); -xmpp_stanza_t * stanza_create_disco_items_iq(xmpp_ctx_t *ctx, const char * const id, - const char * const jid); +const char* stanza_get_presence_string_from_type(resource_presence_t presence_type); +xmpp_stanza_t* stanza_create_software_version_iq(xmpp_ctx_t *ctx, const char *const fulljid); +xmpp_stanza_t* stanza_create_disco_items_iq(xmpp_ctx_t *ctx, const char *const id, const char *const jid); -char * stanza_get_status(xmpp_stanza_t *stanza, char *def); -char * stanza_get_show(xmpp_stanza_t *stanza, char *def); +char* stanza_get_status(xmpp_stanza_t *stanza, char *def); +char* stanza_get_show(xmpp_stanza_t *stanza, char *def); -xmpp_stanza_t * stanza_create_roster_set(xmpp_ctx_t *ctx, const char * const id, - const char * const jid, const char * const handle, GSList *groups); -xmpp_stanza_t * stanza_create_roster_remove_set(xmpp_ctx_t *ctx, - const char * const barejid); +xmpp_stanza_t* stanza_create_roster_set(xmpp_ctx_t *ctx, const char *const id, const char *const jid, + const char *const handle, GSList *groups); +xmpp_stanza_t* stanza_create_roster_remove_set(xmpp_ctx_t *ctx, const char *const barejid); -char * stanza_get_error_message(xmpp_stanza_t * const stanza); +char* stanza_get_error_message(xmpp_stanza_t *const stanza); -GSList* stanza_get_status_codes_by_ns(xmpp_stanza_t * const stanza, char *ns); +GSList* stanza_get_status_codes_by_ns(xmpp_stanza_t *const stanza, char *ns); gboolean stanza_room_destroyed(xmpp_stanza_t *stanza); char* stanza_get_muc_destroy_alternative_room(xmpp_stanza_t *stanza); char* stanza_get_muc_destroy_alternative_password(xmpp_stanza_t *stanza); @@ -311,7 +300,7 @@ Resource* stanza_resource_from_presence(XMPPPresence *presence); XMPPPresence* stanza_parse_presence(xmpp_stanza_t *stanza, int *err); void stanza_free_presence(XMPPPresence *presence); -XMPPCaps* stanza_parse_caps(xmpp_stanza_t * const stanza); +XMPPCaps* stanza_parse_caps(xmpp_stanza_t *const stanza); void stanza_free_caps(XMPPCaps *caps); #endif diff --git a/src/xmpp/xmpp.h b/src/xmpp/xmpp.h index 43106fa6..d49b106d 100644 --- a/src/xmpp/xmpp.h +++ b/src/xmpp/xmpp.h @@ -138,81 +138,78 @@ typedef struct data_form_t { // 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); +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_process_events(int millis); -const char * jabber_get_fulljid(void); -const char * jabber_get_domain(void); +const char* jabber_get_fulljid(void); +const char* jabber_get_domain(void); jabber_conn_status_t jabber_get_connection_status(void); -char * jabber_get_presence_message(void); +char* jabber_get_presence_message(void); char* jabber_get_account_name(void); -GList * jabber_get_available_resources(void); +GList* jabber_get_available_resources(void); char* jabber_create_uuid(void); void jabber_free_uuid(char *uuid); // message functions -char* message_send_chat(const char * const barejid, const char * const msg); -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); -void message_send_groupchat(const char * const roomjid, const char * const msg); -void message_send_groupchat_subject(const char * const roomjid, const char * const subject); +char* message_send_chat(const char *const barejid, const char *const msg); +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); +void message_send_groupchat(const char *const roomjid, const char *const msg); +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_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); +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); +void presence_subscription(const char *const jid, const jabber_subscr_t action); GSList* presence_get_subscription_requests(void); gint presence_sub_request_count(void); void presence_reset_sub_request_search(void); -char * presence_sub_request_find(const char * const search_str); +char* presence_sub_request_find(const char *const search_str); void presence_join_room(char *room, char *nick, char * passwd); -void presence_change_room_nick(const char * const room, const char * const nick); -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); +void presence_change_room_nick(const char *const room, const char *const nick); +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 iq_disable_carbons(); -void iq_send_software_version(const char * const fulljid); +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_items_request(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); -void iq_destroy_room(const char * const room_jid); -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, - const char * const reason); -void iq_room_kick_occupant(const char * const room, const char * const nick, const char * const reason); -void iq_room_role_set(const char * const room, const char * const nick, char *role, - const char * const reason); +void iq_confirm_instant_room(const char *const room_jid); +void iq_destroy_room(const char *const room_jid); +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, + const char *const reason); +void iq_room_kick_occupant(const char *const room, const char *const nick, const char *const reason); +void iq_room_role_set(const char *const room, const char *const nick, char *role, const char *const reason); void iq_room_role_list(const char * const room, char *role); // caps functions -Capabilities* caps_lookup(const char * const jid); +Capabilities* caps_lookup(const char *const jid); void caps_close(void); void caps_destroy(Capabilities *caps); @@ -220,32 +217,32 @@ gboolean bookmark_add(const char *jid, const char *nick, const char *password, c gboolean bookmark_update(const char *jid, const char *nick, const char *password, const char *autojoin_str); gboolean bookmark_remove(const char *jid); gboolean bookmark_join(const char *jid); -const GList * bookmark_get_list(void); -char * bookmark_find(const char * const search_str); +const GList* bookmark_get_list(void); +char* bookmark_find(const char *const search_str); void bookmark_autocomplete_reset(void); -void roster_send_name_change(const char * const barejid, const char * const new_name, GSList *groups); -void roster_send_add_to_group(const char * const group, PContact contact); -void roster_send_remove_from_group(const char * const group, PContact contact); -void roster_send_add_new(const char * const barejid, const char * const name); -void roster_send_remove(const char * const barejid); +void roster_send_name_change(const char *const barejid, const char *const new_name, GSList *groups); +void roster_send_add_to_group(const char *const group, PContact contact); +void roster_send_remove_from_group(const char *const group, PContact contact); +void roster_send_add_new(const char *const barejid, const char *const name); +void roster_send_remove(const char *const barejid); 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); -gboolean form_remove_value(DataForm *form, const char * const tag, char *value); -gboolean form_remove_text_multi_value(DataForm *form, const char * const tag, int index); -gboolean form_tag_exists(DataForm *form, const char * const tag); -form_field_type_t form_get_field_type(DataForm *form, const char * const tag); -gboolean form_field_contains_option(DataForm *form, const char * const tag, char *value); -int form_get_value_count(DataForm *form, const char * const tag); -FormField* form_get_field_by_tag(DataForm *form, const char * const tag); -Autocomplete form_get_value_ac(DataForm *form, const char * const tag); +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); +gboolean form_remove_value(DataForm *form, const char *const tag, char *value); +gboolean form_remove_text_multi_value(DataForm *form, const char *const tag, int index); +gboolean form_tag_exists(DataForm *form, const char *const tag); +form_field_type_t form_get_field_type(DataForm *form, const char *const tag); +gboolean form_field_contains_option(DataForm *form, const char *const tag, char *value); +int form_get_value_count(DataForm *form, const char *const tag); +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); +GSList* form_get_non_form_type_fields_sorted(DataForm *form); +GSList* form_get_field_values_sorted(FormField *field); #endif |