1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-12-04 14:46:46 -05:00

Applied coding style to src/xmpp/

This commit is contained in:
James Booth 2015-10-26 00:14:23 +00:00
parent 2ce43b633f
commit c8a6bdb381
14 changed files with 524 additions and 549 deletions

View File

@ -62,10 +62,10 @@
static Autocomplete bookmark_ac; static Autocomplete bookmark_ac;
static GList *bookmark_list; static GList *bookmark_list;
static int _bookmark_handle_result(xmpp_conn_t * const conn, static int _bookmark_handle_result(xmpp_conn_t *const conn,
xmpp_stanza_t * const stanza, void * const userdata); xmpp_stanza_t *const stanza, void *const userdata);
static int _bookmark_handle_delete(xmpp_conn_t * const conn, static int _bookmark_handle_delete(xmpp_conn_t *const conn,
void * const userdata); void *const userdata);
static void _bookmark_item_destroy(gpointer item); static void _bookmark_item_destroy(gpointer item);
static int _match_bookmark_by_jid(gconstpointer a, gconstpointer b); static int _match_bookmark_by_jid(gconstpointer a, gconstpointer b);
static void _send_bookmarks(void); static void _send_bookmarks(void);
@ -221,14 +221,14 @@ bookmark_remove(const char *jid)
} }
} }
const GList * const GList*
bookmark_get_list(void) bookmark_get_list(void)
{ {
return bookmark_list; return bookmark_list;
} }
char * char*
bookmark_find(const char * const search_str) bookmark_find(const char *const search_str)
{ {
return autocomplete_complete(bookmark_ac, search_str, TRUE); return autocomplete_complete(bookmark_ac, search_str, TRUE);
} }
@ -242,8 +242,8 @@ bookmark_autocomplete_reset(void)
} }
static int static int
_bookmark_handle_result(xmpp_conn_t * const conn, _bookmark_handle_result(xmpp_conn_t *const conn,
xmpp_stanza_t * const stanza, void * const userdata) xmpp_stanza_t *const stanza, void *const userdata)
{ {
xmpp_ctx_t *ctx = connection_get_ctx(); xmpp_ctx_t *ctx = connection_get_ctx();
char *id = (char *)userdata; char *id = (char *)userdata;
@ -360,8 +360,8 @@ _bookmark_handle_result(xmpp_conn_t * const conn,
} }
static int static int
_bookmark_handle_delete(xmpp_conn_t * const conn, _bookmark_handle_delete(xmpp_conn_t *const conn,
void * const userdata) void *const userdata)
{ {
char *id = (char *)userdata; char *id = (char *)userdata;

View File

@ -68,9 +68,9 @@ static char *my_sha1;
static gchar* _get_cache_file(void); static gchar* _get_cache_file(void);
static void _save_cache(void); static void _save_cache(void);
static Capabilities * _caps_by_ver(const char * const ver); static Capabilities* _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);
Capabilities * _caps_copy(Capabilities *caps); Capabilities* _caps_copy(Capabilities *caps);
void void
caps_init(void) caps_init(void)
@ -93,7 +93,7 @@ caps_init(void)
} }
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); gboolean cached = g_key_file_has_group(cache, ver);
if (!cached) { if (!cached) {
@ -135,25 +135,25 @@ caps_add_by_ver(const char * const ver, Capabilities *caps)
} }
void 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); g_hash_table_insert(jid_to_caps, strdup(jid), caps);
} }
void 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)); g_hash_table_insert(jid_to_ver, strdup(jid), strdup(ver));
} }
gboolean gboolean
caps_contains(const char * const ver) caps_contains(const char *const ver)
{ {
return (g_key_file_has_group(cache, ver)); return (g_key_file_has_group(cache, ver));
} }
static Capabilities * static Capabilities*
_caps_by_ver(const char * const ver) _caps_by_ver(const char *const ver)
{ {
if (g_key_file_has_group(cache, ver)) { if (g_key_file_has_group(cache, ver)) {
Capabilities *new_caps = malloc(sizeof(struct capabilities_t)); Capabilities *new_caps = malloc(sizeof(struct capabilities_t));
@ -226,14 +226,14 @@ _caps_by_ver(const char * const ver)
} }
} }
static Capabilities * static Capabilities*
_caps_by_jid(const char * const jid) _caps_by_jid(const char *const jid)
{ {
return g_hash_table_lookup(jid_to_caps, jid); return g_hash_table_lookup(jid_to_caps, jid);
} }
Capabilities * Capabilities*
caps_lookup(const char * const jid) caps_lookup(const char *const jid)
{ {
char *ver = g_hash_table_lookup(jid_to_ver, jid); char *ver = g_hash_table_lookup(jid_to_ver, jid);
if (ver) { if (ver) {
@ -254,7 +254,7 @@ caps_lookup(const char * const jid)
return NULL; return NULL;
} }
Capabilities * Capabilities*
_caps_copy(Capabilities *caps) _caps_copy(Capabilities *caps)
{ {
if (!caps) { if (!caps) {
@ -280,8 +280,8 @@ _caps_copy(Capabilities *caps)
} }
} }
char * char*
caps_create_sha1_str(xmpp_stanza_t * const query) caps_create_sha1_str(xmpp_stanza_t *const query)
{ {
char *category = NULL; char *category = NULL;
char *type = NULL; char *type = NULL;
@ -388,7 +388,7 @@ caps_create_sha1_str(xmpp_stanza_t * const query)
return result; return result;
} }
Capabilities * Capabilities*
caps_create(xmpp_stanza_t *query) caps_create(xmpp_stanza_t *query)
{ {
char *category = NULL; char *category = NULL;
@ -541,7 +541,7 @@ caps_create(xmpp_stanza_t *query)
} }
char* char*
caps_get_my_sha1(xmpp_ctx_t * const ctx) caps_get_my_sha1(xmpp_ctx_t *const ctx)
{ {
if (my_sha1 == NULL) { if (my_sha1 == NULL) {
xmpp_stanza_t *query = caps_create_query_response_stanza(ctx); 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; return my_sha1;
} }
xmpp_stanza_t * xmpp_stanza_t*
caps_create_query_response_stanza(xmpp_ctx_t * const ctx) caps_create_query_response_stanza(xmpp_ctx_t *const ctx)
{ {
xmpp_stanza_t *query = xmpp_stanza_new(ctx); xmpp_stanza_t *query = xmpp_stanza_new(ctx);
xmpp_stanza_set_name(query, STANZA_NAME_QUERY); xmpp_stanza_set_name(query, STANZA_NAME_QUERY);
@ -674,7 +674,7 @@ caps_destroy(Capabilities *caps)
} }
} }
static gchar * static gchar*
_get_cache_file(void) _get_cache_file(void)
{ {
gchar *xdg_data = xdg_get_data_home(); gchar *xdg_data = xdg_get_data_home();

View File

@ -48,14 +48,14 @@
void caps_init(void); void caps_init(void);
void caps_add_by_ver(const char * const ver, Capabilities *caps); void caps_add_by_ver(const char *const ver, Capabilities *caps);
void caps_add_by_jid(const char * const jid, 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); void caps_map_jid_to_ver(const char *const jid, const char *const ver);
gboolean caps_contains(const char * const ver); gboolean caps_contains(const char *const ver);
char* caps_create_sha1_str(xmpp_stanza_t * const query); char* caps_create_sha1_str(xmpp_stanza_t *const query);
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);
Capabilities* caps_create(xmpp_stanza_t *query); 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 #endif

View File

@ -95,20 +95,20 @@ static GTimer *reconnect_timer;
static log_level_t _get_log_level(xmpp_log_level_t xmpp_level); static log_level_t _get_log_level(xmpp_log_level_t xmpp_level);
static xmpp_log_level_t _get_xmpp_log_level(); static xmpp_log_level_t _get_xmpp_log_level();
static void _xmpp_file_logger(void * const userdata, static void _xmpp_file_logger(void *const userdata,
const xmpp_log_level_t level, const char * const area, const xmpp_log_level_t level, const char *const area,
const char * const msg); 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, 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); const char *const passwd, const char *const altdomain, int port, const char *const tls_policy);
static void _jabber_reconnect(void); 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, 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_account(void);
void _connection_free_saved_details(void); void _connection_free_saved_details(void);
@ -131,7 +131,7 @@ jabber_init(void)
} }
jabber_conn_status_t jabber_conn_status_t
jabber_connect_with_account(const ProfAccount * const account) jabber_connect_with_account(const ProfAccount *const account)
{ {
assert(account != NULL); assert(account != NULL);
@ -157,8 +157,8 @@ jabber_connect_with_account(const ProfAccount * const account)
} }
jabber_conn_status_t jabber_conn_status_t
jabber_connect_with_details(const char * const jid, jabber_connect_with_details(const char *const jid,
const char * const passwd, const char * const altdomain, const int port, const char *const tls_policy) const char *const passwd, const char *const altdomain, const int port, const char *const tls_policy)
{ {
assert(jid != NULL); assert(jid != NULL);
assert(passwd != NULL); assert(passwd != NULL);
@ -271,7 +271,7 @@ jabber_process_events(int millis)
} }
} }
GList * GList*
jabber_get_available_resources(void) jabber_get_available_resources(void)
{ {
return g_hash_table_get_values(available_resources); return g_hash_table_get_values(available_resources);
@ -283,37 +283,37 @@ jabber_get_connection_status(void)
return (jabber_conn.conn_status); return (jabber_conn.conn_status);
} }
xmpp_conn_t * xmpp_conn_t*
connection_get_conn(void) connection_get_conn(void)
{ {
return jabber_conn.conn; return jabber_conn.conn;
} }
xmpp_ctx_t * xmpp_ctx_t*
connection_get_ctx(void) connection_get_ctx(void)
{ {
return jabber_conn.ctx; return jabber_conn.ctx;
} }
const char * const char*
jabber_get_fulljid(void) jabber_get_fulljid(void)
{ {
return xmpp_conn_get_jid(jabber_conn.conn); return xmpp_conn_get_jid(jabber_conn.conn);
} }
const char * const char*
jabber_get_domain(void) jabber_get_domain(void)
{ {
return jabber_conn.domain; return jabber_conn.domain;
} }
char * char*
jabber_get_presence_message(void) jabber_get_presence_message(void)
{ {
return jabber_conn.presence_message; return jabber_conn.presence_message;
} }
char * char*
jabber_get_account_name(void) jabber_get_account_name(void)
{ {
return saved_account.name; return saved_account.name;
@ -334,7 +334,7 @@ jabber_free_uuid(char *uuid)
} }
void void
connection_set_presence_message(const char * const message) connection_set_presence_message(const char *const message)
{ {
FREE_SET_NULL(jabber_conn.presence_message); FREE_SET_NULL(jabber_conn.presence_message);
if (message) { if (message) {
@ -355,7 +355,7 @@ connection_add_available_resource(Resource *resource)
} }
void void
connection_remove_available_resource(const char * const resource) connection_remove_available_resource(const char *const resource)
{ {
g_hash_table_remove(available_resources, resource); g_hash_table_remove(available_resources, resource);
} }
@ -387,16 +387,16 @@ _connection_free_session_data(void)
#ifdef HAVE_LIBMESODE #ifdef HAVE_LIBMESODE
static int static int
_connection_certfail_cb(const char * const certname, const char * const certfp, _connection_certfail_cb(const char *const certname, const char *const certfp,
char * const notbefore, const char * const notafter, const char * const errormsg) char *const notbefore, const char *const notafter, const char *const errormsg)
{ {
return sv_ev_certfail(errormsg, certname, certfp, notbefore, notafter); return sv_ev_certfail(errormsg, certname, certfp, notbefore, notafter);
} }
#endif #endif
static jabber_conn_status_t static jabber_conn_status_t
_jabber_connect(const char * const fulljid, const char * const passwd, _jabber_connect(const char *const fulljid, const char *const passwd,
const char * const altdomain, int port, const char *const tls_policy) const char *const altdomain, int port, const char *const tls_policy)
{ {
assert(fulljid != NULL); assert(fulljid != NULL);
assert(passwd != NULL); assert(passwd != NULL);
@ -488,9 +488,9 @@ _jabber_reconnect(void)
} }
static 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, 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 // login success
if (status == XMPP_CONN_CONNECT) { if (status == XMPP_CONN_CONNECT) {
@ -619,8 +619,8 @@ _get_xmpp_log_level()
} }
static void static void
_xmpp_file_logger(void * const userdata, const xmpp_log_level_t level, _xmpp_file_logger(void *const userdata, const xmpp_log_level_t level,
const char * const area, const char * const msg) const char *const area, const char *const msg)
{ {
log_level_t prof_level = _get_log_level(level); log_level_t prof_level = _get_log_level(level);
log_msg(prof_level, area, msg); 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_get_file_logger()
{ {
xmpp_log_level_t level = _get_xmpp_log_level(); xmpp_log_level_t level = _get_xmpp_log_level();

View File

@ -46,11 +46,11 @@
#include "resource.h" #include "resource.h"
xmpp_conn_t *connection_get_conn(void); xmpp_conn_t* connection_get_conn(void);
xmpp_ctx_t *connection_get_ctx(void); xmpp_ctx_t* connection_get_ctx(void);
void connection_set_priority(int priority); 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_add_available_resource(Resource *resource);
void connection_remove_available_resource(const char * const resource); void connection_remove_available_resource(const char *const resource);
#endif #endif

View File

@ -78,7 +78,7 @@ _is_valid_form_element(xmpp_stanza_t *stanza)
return TRUE; return TRUE;
} }
static DataForm * static DataForm*
_form_new(void) _form_new(void)
{ {
DataForm *form = malloc(sizeof(DataForm)); DataForm *form = malloc(sizeof(DataForm));
@ -93,7 +93,7 @@ _form_new(void)
return form; return form;
} }
static FormField * static FormField*
_field_new(void) _field_new(void)
{ {
FormField *field = malloc(sizeof(FormField)); FormField *field = malloc(sizeof(FormField));
@ -108,8 +108,8 @@ _field_new(void)
return field; return field;
} }
static char * static char*
_get_property(xmpp_stanza_t * const stanza, const char * const property) _get_property(xmpp_stanza_t *const stanza, const char *const property)
{ {
char *result = NULL; char *result = NULL;
xmpp_ctx_t *ctx = connection_get_ctx(); xmpp_ctx_t *ctx = connection_get_ctx();
@ -126,8 +126,8 @@ _get_property(xmpp_stanza_t * const stanza, const char * const property)
return result; return result;
} }
static char * static char*
_get_attr(xmpp_stanza_t * const stanza, const char * const attr) _get_attr(xmpp_stanza_t *const stanza, const char *const attr)
{ {
char *result = xmpp_stanza_get_attribute(stanza, attr); char *result = xmpp_stanza_get_attribute(stanza, attr);
if (result) { if (result) {
@ -138,7 +138,7 @@ _get_attr(xmpp_stanza_t * const stanza, const char * const attr)
} }
static gboolean 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"); xmpp_stanza_t *child = xmpp_stanza_get_child_by_name(stanza, "required");
if (child) { if (child) {
@ -149,7 +149,7 @@ _is_required(xmpp_stanza_t * const stanza)
} }
static form_field_type_t 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) { if (g_strcmp0(type, "hidden") == 0) {
return FIELD_HIDDEN; return FIELD_HIDDEN;
@ -184,8 +184,8 @@ _get_field_type(const char * const type)
return FIELD_UNKNOWN; return FIELD_UNKNOWN;
} }
DataForm * DataForm*
form_create(xmpp_stanza_t * const form_stanza) form_create(xmpp_stanza_t *const form_stanza)
{ {
xmpp_ctx_t *ctx = connection_get_ctx(); xmpp_ctx_t *ctx = connection_get_ctx();
@ -281,7 +281,7 @@ form_create(xmpp_stanza_t * const form_stanza)
return form; return form;
} }
xmpp_stanza_t * xmpp_stanza_t*
form_create_submission(DataForm *form) form_create_submission(DataForm *form)
{ {
xmpp_ctx_t *ctx = connection_get_ctx(); 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); return g_strcmp0(a->var, b->var);
} }
GSList * GSList*
form_get_non_form_type_fields_sorted(DataForm *form) form_get_non_form_type_fields_sorted(DataForm *form)
{ {
GSList *sorted = NULL; GSList *sorted = NULL;
@ -424,7 +424,7 @@ form_get_non_form_type_fields_sorted(DataForm *form)
return sorted; return sorted;
} }
GSList * GSList*
form_get_field_values_sorted(FormField *field) form_get_field_values_sorted(FormField *field)
{ {
GSList *sorted = NULL; GSList *sorted = NULL;
@ -440,7 +440,7 @@ form_get_field_values_sorted(FormField *field)
return sorted; return sorted;
} }
char * char*
form_get_form_type_field(DataForm *form) form_get_form_type_field(DataForm *form)
{ {
GSList *curr = form->fields; GSList *curr = form->fields;
@ -456,7 +456,7 @@ form_get_form_type_field(DataForm *form)
} }
gboolean 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 *tags = g_hash_table_get_keys(form->tag_to_var);
GList *curr = tags; GList *curr = tags;
@ -472,7 +472,7 @@ form_tag_exists(DataForm *form, const char * const tag)
} }
form_field_type_t 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); char *var = g_hash_table_lookup(form->tag_to_var, tag);
if (var) { if (var) {
@ -489,7 +489,7 @@ form_get_field_type(DataForm *form, const char * const tag)
} }
void 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); char *var = g_hash_table_lookup(form->tag_to_var, tag);
if (var) { if (var) {
@ -514,7 +514,7 @@ form_set_value(DataForm *form, const char * const tag, char *value)
} }
void 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); char *var = g_hash_table_lookup(form->tag_to_var, tag);
if (var) { if (var) {
@ -539,7 +539,7 @@ form_add_value(DataForm *form, const char * const tag, char *value)
} }
gboolean 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); char *var = g_hash_table_lookup(form->tag_to_var, tag);
if (var) { if (var) {
@ -570,7 +570,7 @@ form_add_unique_value(DataForm *form, const char * const tag, char *value)
} }
gboolean 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); char *var = g_hash_table_lookup(form->tag_to_var, tag);
if (var) { if (var) {
@ -600,7 +600,7 @@ form_remove_value(DataForm *form, const char * const tag, char *value)
} }
gboolean 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--; index--;
char *var = g_hash_table_lookup(form->tag_to_var, tag); 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 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); char *var = g_hash_table_lookup(form->tag_to_var, tag);
if (var) { if (var) {
@ -654,7 +654,7 @@ form_get_value_count(DataForm *form, const char * const tag)
} }
gboolean 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); char *var = g_hash_table_lookup(form->tag_to_var, tag);
if (var) { if (var) {
@ -678,8 +678,8 @@ form_field_contains_option(DataForm *form, const char * const tag, char *value)
return FALSE; return FALSE;
} }
FormField * FormField*
form_get_field_by_tag(DataForm *form, const char * const tag) form_get_field_by_tag(DataForm *form, const char *const tag)
{ {
char *var = g_hash_table_lookup(form->tag_to_var, tag); char *var = g_hash_table_lookup(form->tag_to_var, tag);
if (var) { if (var) {
@ -696,7 +696,7 @@ form_get_field_by_tag(DataForm *form, const char * const tag)
} }
Autocomplete 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); char *var = g_hash_table_lookup(form->tag_to_var, tag);
if (var) { if (var) {

View File

@ -37,7 +37,7 @@
#include "xmpp/xmpp.h" #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); xmpp_stanza_t* form_create_submission(DataForm *form);
#endif #endif

View File

@ -70,32 +70,32 @@ typedef struct p_room_info_data_t {
gboolean display; gboolean display;
} ProfRoomInfoData; } ProfRoomInfoData;
static int _error_handler(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 _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_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 _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_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 _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_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 _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 _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_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 _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 _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_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_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_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_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_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_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 _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 _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 _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 _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 _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(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_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 _caps_response_handler_legacy(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, void *const userdata);
void void
iq_add_handlers(void) iq_add_handlers(void)
@ -150,7 +150,7 @@ iq_room_list_request(gchar *conferencejid)
} }
void void
iq_enable_carbons() iq_enable_carbons(void)
{ {
xmpp_conn_t * const conn = connection_get_conn(); xmpp_conn_t * const conn = connection_get_conn();
xmpp_ctx_t * const ctx = connection_get_ctx(); xmpp_ctx_t * const ctx = connection_get_ctx();
@ -164,7 +164,7 @@ iq_enable_carbons()
} }
void void
iq_disable_carbons() iq_disable_carbons(void)
{ {
xmpp_conn_t * const conn = connection_get_conn(); xmpp_conn_t * const conn = connection_get_conn();
xmpp_ctx_t * const ctx = connection_get_ctx(); xmpp_ctx_t * const ctx = connection_get_ctx();
@ -210,7 +210,7 @@ iq_last_activity_request(gchar *jid)
} }
void 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_conn_t * const conn = connection_get_conn();
xmpp_ctx_t * const ctx = connection_get_ctx(); xmpp_ctx_t * const ctx = connection_get_ctx();
@ -232,8 +232,8 @@ iq_room_info_request(const char * const room, gboolean display_result)
void void
iq_send_caps_request_for_jid(const char * const to, const char * const id, iq_send_caps_request_for_jid(const char *const to, const char *const id,
const char * const node, const char * const ver) const char *const node, const char *const ver)
{ {
xmpp_conn_t * const conn = connection_get_conn(); xmpp_conn_t * const conn = connection_get_conn();
xmpp_ctx_t * const ctx = connection_get_ctx(); 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 void
iq_send_caps_request(const char * const to, const char * const id, iq_send_caps_request(const char *const to, const char *const id,
const char * const node, const char * const ver) const char *const node, const char *const ver)
{ {
xmpp_conn_t * const conn = connection_get_conn(); xmpp_conn_t * const conn = connection_get_conn();
xmpp_ctx_t * const ctx = connection_get_ctx(); 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 void
iq_send_caps_request_legacy(const char * const to, const char * const id, iq_send_caps_request_legacy(const char *const to, const char *const id,
const char * const node, const char * const ver) const char *const node, const char *const ver)
{ {
xmpp_conn_t * const conn = connection_get_conn(); xmpp_conn_t * const conn = connection_get_conn();
xmpp_ctx_t * const ctx = connection_get_ctx(); xmpp_ctx_t * const ctx = connection_get_ctx();
@ -323,7 +323,7 @@ iq_disco_items_request(gchar *jid)
} }
void 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_conn_t * const conn = connection_get_conn();
xmpp_ctx_t * const ctx = connection_get_ctx(); xmpp_ctx_t * const ctx = connection_get_ctx();
@ -337,7 +337,7 @@ iq_send_software_version(const char * const fulljid)
} }
void 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_conn_t * const conn = connection_get_conn();
xmpp_ctx_t * const ctx = connection_get_ctx(); xmpp_ctx_t * const ctx = connection_get_ctx();
@ -347,7 +347,7 @@ iq_confirm_instant_room(const char * const room_jid)
} }
void 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_conn_t * const conn = connection_get_conn();
xmpp_ctx_t * const ctx = connection_get_ctx(); xmpp_ctx_t * const ctx = connection_get_ctx();
@ -361,7 +361,7 @@ iq_destroy_room(const char * const room_jid)
} }
void 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_conn_t * const conn = connection_get_conn();
xmpp_ctx_t * const ctx = connection_get_ctx(); xmpp_ctx_t * const ctx = connection_get_ctx();
@ -375,7 +375,7 @@ iq_request_room_config_form(const char * const room_jid)
} }
void 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_conn_t * const conn = connection_get_conn();
xmpp_ctx_t * const ctx = connection_get_ctx(); xmpp_ctx_t * const ctx = connection_get_ctx();
@ -389,7 +389,7 @@ iq_submit_room_config(const char * const room, DataForm *form)
} }
void 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_conn_t * const conn = connection_get_conn();
xmpp_ctx_t * const ctx = connection_get_ctx(); xmpp_ctx_t * const ctx = connection_get_ctx();
@ -399,7 +399,7 @@ iq_room_config_cancel(const char * const room_jid)
} }
void 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_conn_t * const conn = connection_get_conn();
xmpp_ctx_t * const ctx = connection_get_ctx(); xmpp_ctx_t * const ctx = connection_get_ctx();
@ -413,7 +413,7 @@ iq_room_affiliation_list(const char * const room, char *affiliation)
} }
void 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_conn_t * const conn = connection_get_conn();
xmpp_ctx_t * const ctx = connection_get_ctx(); xmpp_ctx_t * const ctx = connection_get_ctx();
@ -432,8 +432,8 @@ struct privilege_set_t {
}; };
void void
iq_room_affiliation_set(const char * const room, const char * const jid, char *affiliation, iq_room_affiliation_set(const char *const room, const char *const jid, char *affiliation,
const char * const reason) const char *const reason)
{ {
xmpp_conn_t * const conn = connection_get_conn(); xmpp_conn_t * const conn = connection_get_conn();
xmpp_ctx_t * const ctx = connection_get_ctx(); 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 void
iq_room_role_set(const char * const room, const char * const nick, char *role, iq_room_role_set(const char *const room, const char *const nick, char *role,
const char * const reason) const char *const reason)
{ {
xmpp_conn_t * const conn = connection_get_conn(); xmpp_conn_t * const conn = connection_get_conn();
xmpp_ctx_t * const ctx = connection_get_ctx(); 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 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_conn_t * const conn = connection_get_conn();
xmpp_ctx_t * const ctx = connection_get_ctx(); xmpp_ctx_t * const ctx = connection_get_ctx();
@ -486,7 +486,7 @@ iq_room_role_list(const char * const room, char *role)
} }
void void
iq_send_ping(const char * const target) iq_send_ping(const char *const target)
{ {
xmpp_conn_t * const conn = connection_get_conn(); xmpp_conn_t * const conn = connection_get_conn();
xmpp_ctx_t * const ctx = connection_get_ctx(); xmpp_ctx_t * const ctx = connection_get_ctx();
@ -501,8 +501,8 @@ iq_send_ping(const char * const target)
} }
static int static int
_error_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, _error_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza,
void * const userdata) void *const userdata)
{ {
const char *id = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_ID); const char *id = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_ID);
char *error_msg = stanza_get_error_message(stanza); 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 static int
_pong_handler(xmpp_conn_t *const conn, xmpp_stanza_t * const stanza, _pong_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza,
void * const userdata) void *const userdata)
{ {
char *id = xmpp_stanza_get_id(stanza); char *id = xmpp_stanza_get_id(stanza);
char *type = xmpp_stanza_get_type(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 static int
_caps_response_handler(xmpp_conn_t *const conn, xmpp_stanza_t * const stanza, _caps_response_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza,
void * const userdata) void *const userdata)
{ {
const char *id = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_ID); 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); 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 static int
_caps_response_handler_for_jid(xmpp_conn_t *const conn, xmpp_stanza_t * const stanza, _caps_response_handler_for_jid(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza,
void * const userdata) void *const userdata)
{ {
char *jid = (char *)userdata; char *jid = (char *)userdata;
const char *id = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_ID); 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 static int
_caps_response_handler_legacy(xmpp_conn_t *const conn, xmpp_stanza_t * const stanza, _caps_response_handler_legacy(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza,
void * const userdata) void *const userdata)
{ {
const char *id = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_ID); 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); 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 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); char *type = xmpp_stanza_get_type(stanza);
if (g_strcmp0(type, "error") == 0) { 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 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); char *type = xmpp_stanza_get_type(stanza);
if (g_strcmp0(type, "error") == 0) { 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 static int
_manual_pong_handler(xmpp_conn_t *const conn, xmpp_stanza_t * const stanza, _manual_pong_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza,
void * const userdata) void *const userdata)
{ {
char *from = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_FROM); char *from = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_FROM);
char *type = xmpp_stanza_get_type(stanza); 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 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; 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 static int
_version_result_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, _version_result_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza,
void * const userdata) void *const userdata)
{ {
char *id = xmpp_stanza_get_id(stanza); 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 static int
_ping_get_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, _ping_get_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza,
void * const userdata) void *const userdata)
{ {
xmpp_ctx_t *ctx = (xmpp_ctx_t *)userdata; xmpp_ctx_t *ctx = (xmpp_ctx_t *)userdata;
const char *id = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_ID); 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 static int
_version_get_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, _version_get_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza,
void * const userdata) void *const userdata)
{ {
xmpp_ctx_t *ctx = (xmpp_ctx_t *)userdata; xmpp_ctx_t *ctx = (xmpp_ctx_t *)userdata;
const char *id = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_ID); 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 static int
_disco_items_get_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, _disco_items_get_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza,
void * const userdata) void *const userdata)
{ {
xmpp_ctx_t *ctx = (xmpp_ctx_t *)userdata; xmpp_ctx_t *ctx = (xmpp_ctx_t *)userdata;
const char *id = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_ID); 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 static int
_last_activity_get_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, _last_activity_get_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza,
void * const userdata) void *const userdata)
{ {
xmpp_ctx_t *ctx = connection_get_ctx(); xmpp_ctx_t *ctx = connection_get_ctx();
const char *from = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_FROM); 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 static int
_disco_info_get_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, _disco_info_get_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza,
void * const userdata) void *const userdata)
{ {
xmpp_ctx_t *ctx = (xmpp_ctx_t *)userdata; xmpp_ctx_t *ctx = (xmpp_ctx_t *)userdata;
const char *from = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_FROM); 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 static int
_destroy_room_result_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, _destroy_room_result_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza,
void * const userdata) void *const userdata)
{ {
const char *id = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_ID); 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 static int
_room_config_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, _room_config_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza,
void * const userdata) void *const userdata)
{ {
const char *id = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_ID); const char *id = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_ID);
const char *type = xmpp_stanza_get_type(stanza); 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; return 0;
} }
static int _room_affiliation_set_result_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, static int
void * const userdata) _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 *id = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_ID);
const char *type = xmpp_stanza_get_type(stanza); 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; return 0;
} }
static int _room_role_set_result_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, static int
void * const userdata) _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 *id = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_ID);
const char *type = xmpp_stanza_get_type(stanza); 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 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 *id = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_ID);
const char *type = xmpp_stanza_get_type(stanza); 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 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 *id = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_ID);
const char *type = xmpp_stanza_get_type(stanza); 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 static int
_room_config_submit_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, _room_config_submit_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza,
void * const userdata) void *const userdata)
{ {
const char *id = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_ID); const char *id = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_ID);
const char *type = xmpp_stanza_get_type(stanza); 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 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 *id = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_ID);
const char *type = xmpp_stanza_get_type(stanza); const char *type = xmpp_stanza_get_type(stanza);
@ -1494,8 +1496,8 @@ _item_destroy(DiscoItem *item)
} }
static int static int
_room_info_response_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, _room_info_response_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza,
void * const userdata) void *const userdata)
{ {
const char *type = xmpp_stanza_get_type(stanza); const char *type = xmpp_stanza_get_type(stanza);
ProfRoomInfoData *cb_data = (ProfRoomInfoData *)userdata; 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 static int
_last_activity_response_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, _last_activity_response_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza,
void * const userdata) void *const userdata)
{ {
const char *from = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_FROM); const char *from = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_FROM);
if (!from) { if (!from) {
@ -1628,8 +1630,8 @@ _last_activity_response_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const
} }
static int static int
_disco_info_response_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, _disco_info_response_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza,
void * const userdata) void *const userdata)
{ {
const char *from = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_FROM); const char *from = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_FROM);
const char *type = xmpp_stanza_get_type(stanza); 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 static int
_disco_items_result_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, _disco_items_result_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza,
void * const userdata) void *const userdata)
{ {
log_debug("Received diso#items response"); log_debug("Received diso#items response");

View File

@ -61,13 +61,13 @@
#define HANDLE(ns, type, func) xmpp_handler_add(conn, func, ns, STANZA_NAME_MESSAGE, type, ctx) #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 _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 _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 _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 _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 _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 _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 _receipt_received_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, void *const userdata);
void void
message_add_handlers(void) message_add_handlers(void)
@ -85,7 +85,7 @@ message_add_handlers(void)
} }
static char* static char*
_session_jid(const char * const barejid) _session_jid(const char *const barejid)
{ {
ChatSession *session = chat_session_get(barejid); ChatSession *session = chat_session_get(barejid);
char *jid = NULL; char *jid = NULL;
@ -101,7 +101,7 @@ _session_jid(const char * const barejid)
} }
static char* static char*
_session_state(const char * const barejid) _session_state(const char *const barejid)
{ {
ChatSession *session = chat_session_get(barejid); ChatSession *session = chat_session_get(barejid);
char *state = NULL; char *state = NULL;
@ -118,8 +118,8 @@ _session_state(const char * const barejid)
return state; return state;
} }
char * char*
message_send_chat(const char * const barejid, const char * const msg) message_send_chat(const char *const barejid, const char *const msg)
{ {
xmpp_conn_t * const conn = connection_get_conn(); xmpp_conn_t * const conn = connection_get_conn();
xmpp_ctx_t * const ctx = connection_get_ctx(); 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; return id;
} }
char * char*
message_send_chat_pgp(const char * const barejid, const char * const msg) message_send_chat_pgp(const char *const barejid, const char *const msg)
{ {
xmpp_conn_t * const conn = connection_get_conn(); xmpp_conn_t * const conn = connection_get_conn();
xmpp_ctx_t * const ctx = connection_get_ctx(); 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; return id;
} }
char * char*
message_send_chat_otr(const char * const barejid, const char * const msg) message_send_chat_otr(const char *const barejid, const char *const msg)
{ {
xmpp_conn_t * const conn = connection_get_conn(); xmpp_conn_t * const conn = connection_get_conn();
xmpp_ctx_t * const ctx = connection_get_ctx(); 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 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_conn_t * const conn = connection_get_conn();
xmpp_ctx_t * const ctx = connection_get_ctx(); xmpp_ctx_t * const ctx = connection_get_ctx();
@ -248,7 +248,7 @@ message_send_private(const char * const fulljid, const char * const msg)
} }
void 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_conn_t * const conn = connection_get_conn();
xmpp_ctx_t * const ctx = connection_get_ctx(); xmpp_ctx_t * const ctx = connection_get_ctx();
@ -261,7 +261,7 @@ message_send_groupchat(const char * const roomjid, const char * const msg)
} }
void 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_conn_t * const conn = connection_get_conn();
xmpp_ctx_t * const ctx = connection_get_ctx(); 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 void
message_send_invite(const char * const roomjid, const char * const contact, message_send_invite(const char *const roomjid, const char *const contact,
const char * const reason) const char *const reason)
{ {
xmpp_conn_t * const conn = connection_get_conn(); xmpp_conn_t * const conn = connection_get_conn();
xmpp_ctx_t * const ctx = connection_get_ctx(); xmpp_ctx_t * const ctx = connection_get_ctx();
@ -295,7 +295,7 @@ message_send_invite(const char * const roomjid, const char * const contact,
} }
void void
message_send_composing(const char * const jid) message_send_composing(const char *const jid)
{ {
xmpp_conn_t * const conn = connection_get_conn(); xmpp_conn_t * const conn = connection_get_conn();
xmpp_ctx_t * const ctx = connection_get_ctx(); xmpp_ctx_t * const ctx = connection_get_ctx();
@ -307,7 +307,7 @@ message_send_composing(const char * const jid)
} }
void void
message_send_paused(const char * const jid) message_send_paused(const char *const jid)
{ {
xmpp_conn_t * const conn = connection_get_conn(); xmpp_conn_t * const conn = connection_get_conn();
xmpp_ctx_t * const ctx = connection_get_ctx(); xmpp_ctx_t * const ctx = connection_get_ctx();
@ -317,7 +317,7 @@ message_send_paused(const char * const jid)
} }
void void
message_send_inactive(const char * const jid) message_send_inactive(const char *const jid)
{ {
xmpp_conn_t * const conn = connection_get_conn(); xmpp_conn_t * const conn = connection_get_conn();
xmpp_ctx_t * const ctx = connection_get_ctx(); xmpp_ctx_t * const ctx = connection_get_ctx();
@ -328,7 +328,7 @@ message_send_inactive(const char * const jid)
} }
void void
message_send_gone(const char * const jid) message_send_gone(const char *const jid)
{ {
xmpp_conn_t * const conn = connection_get_conn(); xmpp_conn_t * const conn = connection_get_conn();
xmpp_ctx_t * const ctx = connection_get_ctx(); xmpp_ctx_t * const ctx = connection_get_ctx();
@ -338,7 +338,7 @@ message_send_gone(const char * const jid)
} }
static int 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 *id = xmpp_stanza_get_id(stanza);
char *jid = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_FROM); 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 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_ctx_t *ctx = connection_get_ctx();
xmpp_stanza_t *xns_muc_user = xmpp_stanza_get_child_by_ns(stanza, STANZA_NS_MUC_USER); 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 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); 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 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(); xmpp_ctx_t *ctx = connection_get_ctx();
char *from = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_FROM); 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 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(); xmpp_ctx_t *ctx = connection_get_ctx();
char *message = NULL; char *message = NULL;
@ -584,7 +584,7 @@ _groupchat_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, void
} }
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_conn_t * const conn = connection_get_conn();
xmpp_ctx_t * const ctx = connection_get_ctx(); 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 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); xmpp_stanza_t *receipt = xmpp_stanza_get_child_by_ns(stanza, STANZA_NS_RECEIPTS);
char *name = xmpp_stanza_get_name(receipt); 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 void
_receipt_request_handler(xmpp_stanza_t * const stanza) _receipt_request_handler(xmpp_stanza_t *const stanza)
{ {
if (!prefs_get_boolean(PREF_RECEIPTS_SEND)) { if (!prefs_get_boolean(PREF_RECEIPTS_SEND)) {
return; return;
@ -662,7 +662,7 @@ _receipt_request_handler(xmpp_stanza_t * const stanza)
} }
void 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); xmpp_stanza_t *body = xmpp_stanza_get_child_by_name(stanza, STANZA_NAME_BODY);
if (!body) { if (!body) {
@ -687,7 +687,7 @@ _private_chat_handler(xmpp_stanza_t * const stanza, const char * const fulljid)
} }
static gboolean 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); xmpp_stanza_t *carbons = xmpp_stanza_get_child_by_ns(stanza, STANZA_NS_CARBONS);
if (!carbons) { if (!carbons) {
@ -739,7 +739,7 @@ _handle_carbons(xmpp_stanza_t * const stanza)
} }
static int 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 // ignore if type not chat or absent
char *type = xmpp_stanza_get_type(stanza); char *type = xmpp_stanza_get_type(stanza);

View File

@ -62,23 +62,15 @@
static Autocomplete sub_requests_ac; static Autocomplete sub_requests_ac;
#define HANDLE(ns, type, func) xmpp_handler_add(conn, func, ns, \ #define HANDLE(ns, type, func) xmpp_handler_add(conn, func, ns, STANZA_NAME_PRESENCE, type, ctx)
STANZA_NAME_PRESENCE, type, ctx)
static int _unavailable_handler(xmpp_conn_t * const conn, static int _unavailable_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, void *const userdata);
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 _subscribe_handler(xmpp_conn_t * const conn, static int _subscribed_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, void *const userdata);
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 _subscribed_handler(xmpp_conn_t * const conn, static int _available_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, void *const userdata);
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 _unsubscribed_handler(xmpp_conn_t * const conn, static int _presence_error_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, void *const userdata);
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); 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); static void _send_room_presence(xmpp_conn_t *conn, xmpp_stanza_t *presence);
@ -105,7 +97,7 @@ presence_add_handlers(void)
} }
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); assert(jid != NULL);
@ -149,7 +141,7 @@ presence_subscription(const char * const jid, const jabber_subscr_t action)
free(id); free(id);
} }
GSList * GSList*
presence_get_subscription_requests(void) presence_get_subscription_requests(void)
{ {
return autocomplete_create_list(sub_requests_ac); return autocomplete_create_list(sub_requests_ac);
@ -167,14 +159,14 @@ presence_clear_sub_requests(void)
autocomplete_clear(sub_requests_ac); autocomplete_clear(sub_requests_ac);
} }
char * char*
presence_sub_request_find(const char * const search_str) presence_sub_request_find(const char *const search_str)
{ {
return autocomplete_complete(sub_requests_ac, search_str, TRUE); return autocomplete_complete(sub_requests_ac, search_str, TRUE);
} }
gboolean gboolean
presence_sub_request_exists(const char * const bare_jid) presence_sub_request_exists(const char *const bare_jid)
{ {
gboolean result = FALSE; gboolean result = FALSE;
GSList *requests_p = autocomplete_create_list(sub_requests_ac); GSList *requests_p = autocomplete_create_list(sub_requests_ac);
@ -202,7 +194,7 @@ presence_reset_sub_request_search(void)
} }
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) { if (jabber_get_connection_status() != JABBER_CONNECTED) {
log_warning("Error setting presence, not connected."); log_warning("Error setting presence, not connected.");
@ -317,7 +309,7 @@ presence_join_room(char *room, char *nick, char * passwd)
} }
void 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(room != NULL);
assert(nick != NULL); assert(nick != NULL);
@ -347,7 +339,7 @@ presence_change_room_nick(const char * const room, const char * const nick)
} }
void void
presence_leave_chat_room(const char * const room_jid) presence_leave_chat_room(const char *const room_jid)
{ {
assert(room_jid != NULL); assert(room_jid != NULL);
@ -365,8 +357,8 @@ presence_leave_chat_room(const char * const room_jid)
} }
static int static int
_presence_error_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, _presence_error_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza,
void * const userdata) void *const userdata)
{ {
char *id = xmpp_stanza_get_id(stanza); char *id = xmpp_stanza_get_id(stanza);
char *from = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_FROM); 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 static int
_unsubscribed_handler(xmpp_conn_t * const conn, _unsubscribed_handler(xmpp_conn_t *const conn,
xmpp_stanza_t * const stanza, void * const userdata) xmpp_stanza_t *const stanza, void *const userdata)
{ {
char *from = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_FROM); char *from = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_FROM);
Jid *from_jid = jid_create(from); Jid *from_jid = jid_create(from);
@ -455,8 +447,8 @@ _unsubscribed_handler(xmpp_conn_t * const conn,
} }
static int static int
_subscribed_handler(xmpp_conn_t * const conn, _subscribed_handler(xmpp_conn_t *const conn,
xmpp_stanza_t * const stanza, void * const userdata) xmpp_stanza_t *const stanza, void *const userdata)
{ {
char *from = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_FROM); char *from = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_FROM);
Jid *from_jid = jid_create(from); Jid *from_jid = jid_create(from);
@ -471,8 +463,8 @@ _subscribed_handler(xmpp_conn_t * const conn,
} }
static int static int
_subscribe_handler(xmpp_conn_t * const conn, _subscribe_handler(xmpp_conn_t *const conn,
xmpp_stanza_t * const stanza, void * const userdata) xmpp_stanza_t *const stanza, void *const userdata)
{ {
char *from = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_FROM); char *from = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_FROM);
log_debug("Subscribe presence handler fired for %s", from); log_debug("Subscribe presence handler fired for %s", from);
@ -491,8 +483,8 @@ _subscribe_handler(xmpp_conn_t * const conn,
} }
static int static int
_unavailable_handler(xmpp_conn_t * const conn, _unavailable_handler(xmpp_conn_t *const conn,
xmpp_stanza_t * const stanza, void * const userdata) xmpp_stanza_t *const stanza, void *const userdata)
{ {
ui_input_nonblocking(TRUE); ui_input_nonblocking(TRUE);
@ -568,8 +560,8 @@ _handle_caps(char *jid, XMPPCaps *caps)
} }
static int static int
_available_handler(xmpp_conn_t * const conn, _available_handler(xmpp_conn_t *const conn,
xmpp_stanza_t * const stanza, void * const userdata) xmpp_stanza_t *const stanza, void *const userdata)
{ {
ui_input_nonblocking(TRUE); ui_input_nonblocking(TRUE);
@ -668,7 +660,7 @@ _send_caps_request(char *node, char *caps_key, char *id, char *from)
} }
static int 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); ui_input_nonblocking(TRUE);

View File

@ -60,8 +60,7 @@
#include "xmpp/stanza.h" #include "xmpp/stanza.h"
#include "xmpp/xmpp.h" #include "xmpp/xmpp.h"
#define HANDLE(type, func) xmpp_handler_add(conn, func, XMPP_NS_ROSTER, \ #define HANDLE(type, func) xmpp_handler_add(conn, func, XMPP_NS_ROSTER, STANZA_NAME_IQ, type, ctx)
STANZA_NAME_IQ, type, ctx)
// callback data for group commands // callback data for group commands
typedef struct _group_data { typedef struct _group_data {
@ -70,21 +69,15 @@ typedef struct _group_data {
} GroupData; } GroupData;
// event handlers // event handlers
static int _roster_set_handler(xmpp_conn_t * const conn, static int _roster_set_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, void *const userdata);
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_result_handler(xmpp_conn_t * const conn,
xmpp_stanza_t * const stanza, void * const userdata);
// id handlers // id handlers
static int 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, static int _group_remove_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, void *const userdata);
void * const userdata);
static int
_group_remove_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza,
void * const userdata);
// helper functions // helper functions
GSList * _get_groups_from_item(xmpp_stanza_t *item); GSList* _get_groups_from_item(xmpp_stanza_t *item);
void void
roster_add_handlers(void) roster_add_handlers(void)
@ -107,7 +100,7 @@ roster_request(void)
} }
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_conn_t * const conn = connection_get_conn();
xmpp_ctx_t * const ctx = connection_get_ctx(); 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 void
roster_send_remove(const char * const barejid) roster_send_remove(const char *const barejid)
{ {
xmpp_conn_t * const conn = connection_get_conn(); xmpp_conn_t * const conn = connection_get_conn();
xmpp_ctx_t * const ctx = connection_get_ctx(); xmpp_ctx_t * const ctx = connection_get_ctx();
@ -129,7 +122,7 @@ roster_send_remove(const char * const barejid)
} }
void 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_conn_t * const conn = connection_get_conn();
xmpp_ctx_t * const ctx = connection_get_ctx(); 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 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 *groups = p_contact_groups(contact);
GSList *new_groups = NULL; GSList *new_groups = NULL;
@ -172,8 +165,8 @@ roster_send_add_to_group(const char * const group, PContact contact)
} }
static int static int
_group_add_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, _group_add_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza,
void * const userdata) void *const userdata)
{ {
if (userdata) { if (userdata) {
GroupData *data = userdata; GroupData *data = userdata;
@ -186,7 +179,7 @@ _group_add_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza,
} }
void 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 *groups = p_contact_groups(contact);
GSList *new_groups = NULL; GSList *new_groups = NULL;
@ -219,8 +212,8 @@ roster_send_remove_from_group(const char * const group, PContact contact)
} }
static int static int
_group_remove_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, _group_remove_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza,
void * const userdata) void *const userdata)
{ {
if (userdata) { if (userdata) {
GroupData *data = userdata; GroupData *data = userdata;
@ -233,8 +226,8 @@ _group_remove_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza,
} }
static int static int
_roster_set_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, _roster_set_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza,
void * const userdata) void *const userdata)
{ {
xmpp_stanza_t *query = xmpp_stanza_t *query =
xmpp_stanza_get_child_by_name(stanza, STANZA_NAME_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 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); 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; return 1;
} }
GSList * GSList*
_get_groups_from_item(xmpp_stanza_t *item) _get_groups_from_item(xmpp_stanza_t *item)
{ {
GSList *groups = NULL; GSList *groups = NULL;

View File

@ -56,7 +56,7 @@
#include "muc.h" #include "muc.h"
#if 0 #if 0
xmpp_stanza_t * xmpp_stanza_t*
stanza_create_bookmarks_pubsub_request(xmpp_ctx_t *ctx) stanza_create_bookmarks_pubsub_request(xmpp_ctx_t *ctx)
{ {
xmpp_stanza_t *iq, *pubsub, *items; xmpp_stanza_t *iq, *pubsub, *items;
@ -84,7 +84,7 @@ stanza_create_bookmarks_pubsub_request(xmpp_ctx_t *ctx)
} }
#endif #endif
xmpp_stanza_t * xmpp_stanza_t*
stanza_create_bookmarks_storage_request(xmpp_ctx_t *ctx) stanza_create_bookmarks_storage_request(xmpp_ctx_t *ctx)
{ {
xmpp_stanza_t *iq, *query, *storage; xmpp_stanza_t *iq, *query, *storage;
@ -113,9 +113,9 @@ stanza_create_bookmarks_storage_request(xmpp_ctx_t *ctx)
} }
#if 0 #if 0
xmpp_stanza_t * xmpp_stanza_t*
stanza_create_bookmarks_pubsub_add(xmpp_ctx_t *ctx, const char * const jid, stanza_create_bookmarks_pubsub_add(xmpp_ctx_t *ctx, const char *const jid,
const gboolean autojoin, const char * const nick) const gboolean autojoin, const char *const nick)
{ {
xmpp_stanza_t *stanza = xmpp_stanza_new(ctx); xmpp_stanza_t *stanza = xmpp_stanza_new(ctx);
xmpp_stanza_set_name(stanza, STANZA_NAME_IQ); 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 #endif
xmpp_stanza_t * xmpp_stanza_t*
stanza_enable_carbons(xmpp_ctx_t *ctx){ stanza_enable_carbons(xmpp_ctx_t *ctx)
{
xmpp_stanza_t *iq = xmpp_stanza_new(ctx); xmpp_stanza_t *iq = xmpp_stanza_new(ctx);
char *id = create_unique_id("carbons"); char *id = create_unique_id("carbons");
@ -226,8 +227,9 @@ stanza_enable_carbons(xmpp_ctx_t *ctx){
return iq; return iq;
} }
xmpp_stanza_t * xmpp_stanza_t*
stanza_disable_carbons(xmpp_ctx_t *ctx){ stanza_disable_carbons(xmpp_ctx_t *ctx)
{
xmpp_stanza_t *iq = xmpp_stanza_new(ctx); xmpp_stanza_t *iq = xmpp_stanza_new(ctx);
char *id = create_unique_id("carbons"); char *id = create_unique_id("carbons");
@ -246,8 +248,8 @@ stanza_disable_carbons(xmpp_ctx_t *ctx){
return iq; return iq;
} }
xmpp_stanza_t * xmpp_stanza_t*
stanza_create_chat_state(xmpp_ctx_t *ctx, const char * const fulljid, const char * const state) stanza_create_chat_state(xmpp_ctx_t *ctx, const char *const fulljid, const char *const state)
{ {
xmpp_stanza_t *msg, *chat_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; return msg;
} }
xmpp_stanza_t * xmpp_stanza_t*
stanza_create_room_subject_message(xmpp_ctx_t *ctx, const char * const room, const char * const subject) 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_t *msg = xmpp_stanza_new(ctx);
xmpp_stanza_set_name(msg, STANZA_NAME_MESSAGE); 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; return msg;
} }
xmpp_stanza_t * xmpp_stanza_t*
stanza_attach_state(xmpp_ctx_t *ctx, xmpp_stanza_t *stanza, const char * const state) 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_t *chat_state = xmpp_stanza_new(ctx);
xmpp_stanza_set_name(chat_state, state); 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; return stanza;
} }
xmpp_stanza_t * xmpp_stanza_t*
stanza_attach_carbons_private(xmpp_ctx_t *ctx, xmpp_stanza_t *stanza) stanza_attach_carbons_private(xmpp_ctx_t *ctx, xmpp_stanza_t *stanza)
{ {
xmpp_stanza_t *private_carbon = xmpp_stanza_new(ctx); 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; return stanza;
} }
xmpp_stanza_t * xmpp_stanza_t*
stanza_attach_hints_no_copy(xmpp_ctx_t *ctx, xmpp_stanza_t *stanza) stanza_attach_hints_no_copy(xmpp_ctx_t *ctx, xmpp_stanza_t *stanza)
{ {
xmpp_stanza_t *no_copy = xmpp_stanza_new(ctx); 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; return stanza;
} }
xmpp_stanza_t * xmpp_stanza_t*
stanza_attach_hints_no_store(xmpp_ctx_t *ctx, xmpp_stanza_t *stanza) stanza_attach_hints_no_store(xmpp_ctx_t *ctx, xmpp_stanza_t *stanza)
{ {
xmpp_stanza_t *no_store = xmpp_stanza_new(ctx); 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; return stanza;
} }
xmpp_stanza_t * xmpp_stanza_t*
stanza_attach_receipt_request(xmpp_ctx_t *ctx, xmpp_stanza_t *stanza) stanza_attach_receipt_request(xmpp_ctx_t *ctx, xmpp_stanza_t *stanza)
{ {
xmpp_stanza_t *receipet_request = xmpp_stanza_new(ctx); 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; return stanza;
} }
xmpp_stanza_t * xmpp_stanza_t*
stanza_create_message(xmpp_ctx_t *ctx, char *id, const char * const recipient, stanza_create_message(xmpp_ctx_t *ctx, char *id, const char *const recipient,
const char * const type, const char * const message) const char *const type, const char *const message)
{ {
xmpp_stanza_t *msg, *body, *text; 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; return msg;
} }
xmpp_stanza_t * xmpp_stanza_t*
stanza_create_roster_remove_set(xmpp_ctx_t *ctx, const char * const barejid) stanza_create_roster_remove_set(xmpp_ctx_t *ctx, const char *const barejid)
{ {
xmpp_stanza_t *iq = xmpp_stanza_new(ctx); xmpp_stanza_t *iq = xmpp_stanza_new(ctx);
xmpp_stanza_set_name(iq, STANZA_NAME_IQ); 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 * xmpp_stanza_t*
stanza_create_roster_set(xmpp_ctx_t *ctx, const char * const id, stanza_create_roster_set(xmpp_ctx_t *ctx, const char *const id,
const char * const jid, const char * const handle, GSList *groups) const char *const jid, const char *const handle, GSList *groups)
{ {
xmpp_stanza_t *iq = xmpp_stanza_new(ctx); xmpp_stanza_t *iq = xmpp_stanza_new(ctx);
xmpp_stanza_set_name(iq, STANZA_NAME_IQ); 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; return iq;
} }
xmpp_stanza_t * xmpp_stanza_t*
stanza_create_invite(xmpp_ctx_t *ctx, const char * const room, stanza_create_invite(xmpp_ctx_t *ctx, const char *const room,
const char * const contact, const char * const reason, const char * const password) const char *const contact, const char *const reason, const char *const password)
{ {
xmpp_stanza_t *message, *x; xmpp_stanza_t *message, *x;
@ -481,9 +483,9 @@ stanza_create_invite(xmpp_ctx_t *ctx, const char * const room,
return message; return message;
} }
xmpp_stanza_t * xmpp_stanza_t*
stanza_create_mediated_invite(xmpp_ctx_t *ctx, const char * const room, stanza_create_mediated_invite(xmpp_ctx_t *ctx, const char *const room,
const char * const contact, const char * const reason) const char *const contact, const char *const reason)
{ {
xmpp_stanza_t *message, *x, *invite; xmpp_stanza_t *message, *x, *invite;
@ -521,9 +523,9 @@ stanza_create_mediated_invite(xmpp_ctx_t *ctx, const char * const room,
return message; return message;
} }
xmpp_stanza_t * xmpp_stanza_t*
stanza_create_room_join_presence(xmpp_ctx_t * const ctx, stanza_create_room_join_presence(xmpp_ctx_t *const ctx,
const char * const full_room_jid, const char * const passwd) const char *const full_room_jid, const char *const passwd)
{ {
xmpp_stanza_t *presence = xmpp_stanza_new(ctx); xmpp_stanza_t *presence = xmpp_stanza_new(ctx);
xmpp_stanza_set_name(presence, STANZA_NAME_PRESENCE); xmpp_stanza_set_name(presence, STANZA_NAME_PRESENCE);
@ -554,9 +556,9 @@ stanza_create_room_join_presence(xmpp_ctx_t * const ctx,
return presence; return presence;
} }
xmpp_stanza_t * xmpp_stanza_t*
stanza_create_room_newnick_presence(xmpp_ctx_t *ctx, 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); xmpp_stanza_t *presence = xmpp_stanza_new(ctx);
char *id = create_unique_id("sub"); char *id = create_unique_id("sub");
@ -568,9 +570,9 @@ stanza_create_room_newnick_presence(xmpp_ctx_t *ctx,
return presence; return presence;
} }
xmpp_stanza_t * xmpp_stanza_t*
stanza_create_room_leave_presence(xmpp_ctx_t *ctx, const char * const room, stanza_create_room_leave_presence(xmpp_ctx_t *ctx, const char *const room,
const char * const nick) const char *const nick)
{ {
GString *full_jid = g_string_new(room); GString *full_jid = g_string_new(room);
g_string_append(full_jid, "/"); g_string_append(full_jid, "/");
@ -589,8 +591,8 @@ stanza_create_room_leave_presence(xmpp_ctx_t *ctx, const char * const room,
return presence; return presence;
} }
xmpp_stanza_t * xmpp_stanza_t*
stanza_create_instant_room_request_iq(xmpp_ctx_t *ctx, const char * const room_jid) 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_t *iq = xmpp_stanza_new(ctx);
xmpp_stanza_set_name(iq, STANZA_NAME_IQ); 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; return iq;
} }
xmpp_stanza_t * xmpp_stanza_t*
stanza_create_instant_room_destroy_iq(xmpp_ctx_t *ctx, const char * const room_jid) 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_t *iq = xmpp_stanza_new(ctx);
xmpp_stanza_set_name(iq, STANZA_NAME_IQ); 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; return iq;
} }
xmpp_stanza_t * xmpp_stanza_t*
stanza_create_room_config_request_iq(xmpp_ctx_t *ctx, const char * const room_jid) 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_t *iq = xmpp_stanza_new(ctx);
xmpp_stanza_set_name(iq, STANZA_NAME_IQ); 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; return iq;
} }
xmpp_stanza_t * xmpp_stanza_t*
stanza_create_room_config_cancel_iq(xmpp_ctx_t *ctx, const char * const room_jid) 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_t *iq = xmpp_stanza_new(ctx);
xmpp_stanza_set_name(iq, STANZA_NAME_IQ); 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; return iq;
} }
xmpp_stanza_t * xmpp_stanza_t*
stanza_create_room_affiliation_list_iq(xmpp_ctx_t *ctx, const char * const room, const char * const affiliation) 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_t *iq = xmpp_stanza_new(ctx);
xmpp_stanza_set_name(iq, STANZA_NAME_IQ); 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; return iq;
} }
xmpp_stanza_t * xmpp_stanza_t*
stanza_create_room_role_list_iq(xmpp_ctx_t *ctx, const char * const room, const char * const role) 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_t *iq = xmpp_stanza_new(ctx);
xmpp_stanza_set_name(iq, STANZA_NAME_IQ); 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; return iq;
} }
xmpp_stanza_t * xmpp_stanza_t*
stanza_create_room_affiliation_set_iq(xmpp_ctx_t *ctx, const char * const room, const char * const jid, 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) const char *const affiliation, const char *const reason)
{ {
xmpp_stanza_t *iq = xmpp_stanza_new(ctx); xmpp_stanza_t *iq = xmpp_stanza_new(ctx);
xmpp_stanza_set_name(iq, STANZA_NAME_IQ); 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; return iq;
} }
xmpp_stanza_t * xmpp_stanza_t*
stanza_create_room_role_set_iq(xmpp_ctx_t * const ctx, const char * const room, const char * const nick, 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) const char *const role, const char *const reason)
{ {
xmpp_stanza_t *iq = xmpp_stanza_new(ctx); xmpp_stanza_t *iq = xmpp_stanza_new(ctx);
xmpp_stanza_set_name(iq, STANZA_NAME_IQ); 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; return iq;
} }
xmpp_stanza_t * xmpp_stanza_t*
stanza_create_room_kick_iq(xmpp_ctx_t * const ctx, const char * const room, const char * const nick, stanza_create_room_kick_iq(xmpp_ctx_t *const ctx, const char *const room, const char *const nick,
const char * const reason) const char *const reason)
{ {
xmpp_stanza_t *iq = xmpp_stanza_new(ctx); xmpp_stanza_t *iq = xmpp_stanza_new(ctx);
xmpp_stanza_set_name(iq, STANZA_NAME_IQ); 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; return iq;
} }
xmpp_stanza_t * xmpp_stanza_t*
stanza_create_presence(xmpp_ctx_t * const ctx) stanza_create_presence(xmpp_ctx_t *const ctx)
{ {
xmpp_stanza_t *presence = xmpp_stanza_new(ctx); xmpp_stanza_t *presence = xmpp_stanza_new(ctx);
xmpp_stanza_set_name(presence, STANZA_NAME_PRESENCE); xmpp_stanza_set_name(presence, STANZA_NAME_PRESENCE);
@ -881,8 +883,8 @@ stanza_create_presence(xmpp_ctx_t * const ctx)
return presence; return presence;
} }
xmpp_stanza_t * xmpp_stanza_t*
stanza_create_software_version_iq(xmpp_ctx_t *ctx, const char * const fulljid) stanza_create_software_version_iq(xmpp_ctx_t *ctx, const char *const fulljid)
{ {
xmpp_stanza_t *iq = xmpp_stanza_new(ctx); xmpp_stanza_t *iq = xmpp_stanza_new(ctx);
xmpp_stanza_set_name(iq, STANZA_NAME_IQ); 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; return iq;
} }
xmpp_stanza_t * xmpp_stanza_t*
stanza_create_roster_iq(xmpp_ctx_t *ctx) stanza_create_roster_iq(xmpp_ctx_t *ctx)
{ {
xmpp_stanza_t *iq = xmpp_stanza_new(ctx); xmpp_stanza_t *iq = xmpp_stanza_new(ctx);
@ -922,9 +924,9 @@ stanza_create_roster_iq(xmpp_ctx_t *ctx)
return iq; return iq;
} }
xmpp_stanza_t * xmpp_stanza_t*
stanza_create_disco_info_iq(xmpp_ctx_t *ctx, const char * const id, const char * const to, stanza_create_disco_info_iq(xmpp_ctx_t *ctx, const char *const id, const char *const to,
const char * const node) const char *const node)
{ {
xmpp_stanza_t *iq = xmpp_stanza_new(ctx); xmpp_stanza_t *iq = xmpp_stanza_new(ctx);
xmpp_stanza_set_name(iq, STANZA_NAME_IQ); 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; return iq;
} }
xmpp_stanza_t * xmpp_stanza_t*
stanza_create_disco_items_iq(xmpp_ctx_t *ctx, const char * const id, stanza_create_disco_items_iq(xmpp_ctx_t *ctx, const char *const id,
const char * const jid) const char *const jid)
{ {
xmpp_stanza_t *iq = xmpp_stanza_new(ctx); xmpp_stanza_t *iq = xmpp_stanza_new(ctx);
xmpp_stanza_set_name(iq, STANZA_NAME_IQ); 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; return iq;
} }
xmpp_stanza_t * xmpp_stanza_t*
stanza_create_last_activity_iq(xmpp_ctx_t *ctx, const char * const id, const char * const to) 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_t *iq = xmpp_stanza_new(ctx);
xmpp_stanza_set_name(iq, STANZA_NAME_IQ); 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; return iq;
} }
xmpp_stanza_t * xmpp_stanza_t*
stanza_create_room_config_submit_iq(xmpp_ctx_t *ctx, const char * const room, DataForm *form) 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_t *iq = xmpp_stanza_new(ctx);
xmpp_stanza_set_name(iq, STANZA_NAME_IQ); 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_get_child_by_name(stanza, STANZA_NAME_INACTIVE) != NULL));
} }
xmpp_stanza_t * xmpp_stanza_t*
stanza_create_ping_iq(xmpp_ctx_t *ctx, const char * const target) stanza_create_ping_iq(xmpp_ctx_t *ctx, const char *const target)
{ {
xmpp_stanza_t *iq = xmpp_stanza_new(ctx); xmpp_stanza_t *iq = xmpp_stanza_new(ctx);
xmpp_stanza_set_name(iq, STANZA_NAME_IQ); 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* GDateTime*
stanza_get_delay(xmpp_stanza_t * const stanza) stanza_get_delay(xmpp_stanza_t *const stanza)
{ {
GTimeVal utc_stamp; GTimeVal utc_stamp;
// first check for XEP-0203 delayed delivery // first check for XEP-0203 delayed delivery
@ -1081,7 +1083,7 @@ stanza_get_delay(xmpp_stanza_t * const stanza)
return NULL; return NULL;
} }
char * char*
stanza_get_status(xmpp_stanza_t *stanza, char *def) stanza_get_status(xmpp_stanza_t *stanza, char *def)
{ {
xmpp_ctx_t *ctx = connection_get_ctx(); 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) stanza_get_show(xmpp_stanza_t *stanza, char *def)
{ {
xmpp_ctx_t *ctx = connection_get_ctx(); xmpp_ctx_t *ctx = connection_get_ctx();
@ -1130,7 +1132,7 @@ stanza_get_show(xmpp_stanza_t *stanza, char *def)
} }
gboolean gboolean
stanza_is_muc_presence(xmpp_stanza_t * const stanza) stanza_is_muc_presence(xmpp_stanza_t *const stanza)
{ {
if (stanza == NULL) { if (stanza == NULL) {
return FALSE; return FALSE;
@ -1149,7 +1151,7 @@ stanza_is_muc_presence(xmpp_stanza_t * const stanza)
} }
gboolean 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 // no stanza, or not presence stanza
if ((stanza == NULL) || (g_strcmp0(xmpp_stanza_get_name(stanza), STANZA_NAME_PRESENCE) != 0)) { 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 gboolean
stanza_is_muc_self_presence(xmpp_stanza_t * const stanza, stanza_is_muc_self_presence(xmpp_stanza_t *const stanza,
const char * const self_jid) const char *const self_jid)
{ {
// no stanza, or not presence stanza // no stanza, or not presence stanza
if ((stanza == NULL) || (g_strcmp0(xmpp_stanza_get_name(stanza), STANZA_NAME_PRESENCE) != 0)) { 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; return FALSE;
} }
GSList * GSList*
stanza_get_status_codes_by_ns(xmpp_stanza_t * const stanza, char *ns) stanza_get_status_codes_by_ns(xmpp_stanza_t *const stanza, char *ns)
{ {
GSList *codes = NULL; GSList *codes = NULL;
xmpp_stanza_t *ns_child = xmpp_stanza_get_child_by_ns(stanza, ns); 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; return FALSE;
} }
char * char*
stanza_get_muc_destroy_alternative_room(xmpp_stanza_t *stanza) stanza_get_muc_destroy_alternative_room(xmpp_stanza_t *stanza)
{ {
char *stanza_name = xmpp_stanza_get_name(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; return NULL;
} }
char * char*
stanza_get_muc_destroy_alternative_password(xmpp_stanza_t *stanza) stanza_get_muc_destroy_alternative_password(xmpp_stanza_t *stanza)
{ {
char *stanza_name = xmpp_stanza_get_name(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; return NULL;
} }
char * char*
stanza_get_muc_destroy_reason(xmpp_stanza_t *stanza) stanza_get_muc_destroy_reason(xmpp_stanza_t *stanza)
{ {
char *stanza_name = xmpp_stanza_get_name(stanza); char *stanza_name = xmpp_stanza_get_name(stanza);
@ -1356,7 +1358,7 @@ stanza_get_muc_destroy_reason(xmpp_stanza_t *stanza)
return NULL; return NULL;
} }
char * char*
stanza_get_actor(xmpp_stanza_t *stanza) stanza_get_actor(xmpp_stanza_t *stanza)
{ {
char *stanza_name = xmpp_stanza_get_name(stanza); char *stanza_name = xmpp_stanza_get_name(stanza);
@ -1382,7 +1384,7 @@ stanza_get_actor(xmpp_stanza_t *stanza)
return NULL; return NULL;
} }
char * char*
stanza_get_reason(xmpp_stanza_t *stanza) stanza_get_reason(xmpp_stanza_t *stanza)
{ {
char *stanza_name = xmpp_stanza_get_name(stanza); char *stanza_name = xmpp_stanza_get_name(stanza);
@ -1405,7 +1407,7 @@ stanza_get_reason(xmpp_stanza_t *stanza)
} }
gboolean 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 // no stanza, or not presence stanza
if ((stanza == NULL) || (g_strcmp0(xmpp_stanza_get_name(stanza), STANZA_NAME_PRESENCE) != 0)) { 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; return FALSE;
} }
char * char*
stanza_get_new_nick(xmpp_stanza_t * const stanza) stanza_get_new_nick(xmpp_stanza_t *const stanza)
{ {
if (!stanza_is_room_nick_change(stanza)) { if (!stanza_is_room_nick_change(stanza)) {
return NULL; return NULL;
@ -1456,7 +1458,7 @@ stanza_get_new_nick(xmpp_stanza_t * const stanza)
} }
int 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); 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* 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); 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; return caps;
} }
char * char*
stanza_get_caps_str(xmpp_stanza_t * const stanza) stanza_get_caps_str(xmpp_stanza_t *const stanza)
{ {
xmpp_stanza_t *caps = xmpp_stanza_get_child_by_name(stanza, STANZA_NAME_C); 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; return caps_str;
} }
char * char*
stanza_get_error_message(xmpp_stanza_t *stanza) stanza_get_error_message(xmpp_stanza_t *stanza)
{ {
xmpp_ctx_t *ctx = connection_get_ctx(); xmpp_ctx_t *ctx = connection_get_ctx();
@ -1607,7 +1609,7 @@ stanza_get_error_message(xmpp_stanza_t *stanza)
} }
void 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) const int pri)
{ {
if (pri != 0) { if (pri != 0) {
@ -1627,8 +1629,8 @@ stanza_attach_priority(xmpp_ctx_t * const ctx, xmpp_stanza_t * const presence,
} }
void void
stanza_attach_show(xmpp_ctx_t * const ctx, xmpp_stanza_t * const presence, stanza_attach_show(xmpp_ctx_t *const ctx, xmpp_stanza_t *const presence,
const char * const show) const char *const show)
{ {
if (show) { if (show) {
xmpp_stanza_t *show_stanza = xmpp_stanza_new(ctx); 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 void
stanza_attach_status(xmpp_ctx_t * const ctx, xmpp_stanza_t * const presence, stanza_attach_status(xmpp_ctx_t *const ctx, xmpp_stanza_t *const presence,
const char * const status) const char *const status)
{ {
if (status) { if (status) {
xmpp_stanza_t *status_stanza = xmpp_stanza_new(ctx); 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 void
stanza_attach_last_activity(xmpp_ctx_t * const ctx, stanza_attach_last_activity(xmpp_ctx_t *const ctx,
xmpp_stanza_t * const presence, const int idle) xmpp_stanza_t *const presence, const int idle)
{ {
xmpp_stanza_t *query = xmpp_stanza_new(ctx); xmpp_stanza_t *query = xmpp_stanza_new(ctx);
xmpp_stanza_set_name(query, STANZA_NAME_QUERY); xmpp_stanza_set_name(query, STANZA_NAME_QUERY);
@ -1673,7 +1675,7 @@ stanza_attach_last_activity(xmpp_ctx_t * const ctx,
} }
void 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_t *caps = xmpp_stanza_new(ctx);
xmpp_stanza_set_name(caps, STANZA_NAME_C); 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); xmpp_stanza_release(query);
} }
const char * const char*
stanza_get_presence_string_from_type(resource_presence_t presence_type) stanza_get_presence_string_from_type(resource_presence_t presence_type)
{ {
switch(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) stanza_parse_presence(xmpp_stanza_t *stanza, int *err)
{ {
char *from = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_FROM); char *from = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_FROM);

View File

@ -195,111 +195,100 @@ typedef enum {
xmpp_stanza_t* stanza_create_bookmarks_storage_request(xmpp_ctx_t *ctx); 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, 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_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_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_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_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_receipt_request(xmpp_ctx_t *ctx, xmpp_stanza_t *stanza);
xmpp_stanza_t* stanza_create_message(xmpp_ctx_t *ctx, char *id, 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, xmpp_stanza_t* stanza_create_room_join_presence(xmpp_ctx_t *const ctx,
const char * const full_room_jid, const char * const passwd); const char *const full_room_jid, const char *const passwd);
xmpp_stanza_t* stanza_create_room_newnick_presence(xmpp_ctx_t *ctx, 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, 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_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_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, xmpp_stanza_t* stanza_create_disco_info_iq(xmpp_ctx_t *ctx, const char *const id,
const char * const to, const char * const node); const char *const to, const char *const node);
xmpp_stanza_t* stanza_create_last_activity_iq(xmpp_ctx_t *ctx, const char * const id, xmpp_stanza_t* stanza_create_last_activity_iq(xmpp_ctx_t *ctx, const char *const id,
const char * const to); const char *const to);
xmpp_stanza_t* stanza_create_invite(xmpp_ctx_t *ctx, const char * const room, 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); 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, xmpp_stanza_t* stanza_create_mediated_invite(xmpp_ctx_t *ctx, const char *const room,
const char * const contact, const char * const reason); const char *const contact, const char *const reason);
gboolean stanza_contains_chat_state(xmpp_stanza_t *stanza); gboolean stanza_contains_chat_state(xmpp_stanza_t *stanza);
GDateTime* stanza_get_delay(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_presence(xmpp_stanza_t *const stanza);
gboolean stanza_is_muc_self_presence(xmpp_stanza_t * const stanza, gboolean stanza_is_muc_self_presence(xmpp_stanza_t *const stanza,
const char * const self_jid); const char *const self_jid);
gboolean stanza_is_room_nick_change(xmpp_stanza_t * const stanza); gboolean stanza_is_room_nick_change(xmpp_stanza_t *const stanza);
gboolean stanza_muc_requires_config(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); char* stanza_get_new_nick(xmpp_stanza_t *const stanza);
xmpp_stanza_t* stanza_create_instant_room_request_iq(xmpp_ctx_t *ctx, xmpp_stanza_t* stanza_create_instant_room_request_iq(xmpp_ctx_t *ctx, const char *const room_jid);
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_instant_room_destroy_iq(xmpp_ctx_t *ctx, xmpp_stanza_t* stanza_create_room_config_request_iq(xmpp_ctx_t *ctx, const char *const room_jid);
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_request_iq(xmpp_ctx_t *ctx, xmpp_stanza_t* stanza_create_room_config_submit_iq(xmpp_ctx_t *ctx, const char *const room, DataForm *form);
const char * const room_jid); xmpp_stanza_t* stanza_create_room_affiliation_list_iq(xmpp_ctx_t *ctx, const char *const room,
xmpp_stanza_t* stanza_create_room_config_cancel_iq(xmpp_ctx_t *ctx, const char *const affiliation);
const char * const room_jid); xmpp_stanza_t* stanza_create_room_affiliation_set_iq(xmpp_ctx_t *ctx, const char *const room, const char *const jid,
xmpp_stanza_t* stanza_create_room_config_submit_iq(xmpp_ctx_t *ctx, const char *const affiliation, const char *const reason);
const char * const room, DataForm *form); xmpp_stanza_t* stanza_create_room_role_set_iq(xmpp_ctx_t *const ctx, const char *const room, const char *const jid,
xmpp_stanza_t* stanza_create_room_affiliation_list_iq(xmpp_ctx_t *ctx, const char * const room, const char *const role, const char *const reason);
const char * const affiliation); 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_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_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, 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); const char *const reason);
int stanza_get_idle_time(xmpp_stanza_t * const stanza); int stanza_get_idle_time(xmpp_stanza_t *const stanza);
char * stanza_get_caps_str(xmpp_stanza_t * const stanza); char* stanza_get_caps_str(xmpp_stanza_t *const stanza);
DataForm * stanza_create_form(xmpp_stanza_t * const stanza); DataForm* stanza_create_form(xmpp_stanza_t *const stanza);
void stanza_destroy_form(DataForm *form); void stanza_destroy_form(DataForm *form);
void stanza_attach_priority(xmpp_ctx_t * const ctx, void stanza_attach_priority(xmpp_ctx_t *const ctx, xmpp_stanza_t *const presence, const int pri);
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_last_activity(xmpp_ctx_t * const ctx, void stanza_attach_caps(xmpp_ctx_t *const ctx, xmpp_stanza_t *const presence);
xmpp_stanza_t * const presence, const int idle); void stanza_attach_show(xmpp_ctx_t *const ctx, xmpp_stanza_t *const presence, const char *const show);
void stanza_attach_caps(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);
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); 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_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, xmpp_stanza_t* stanza_create_disco_items_iq(xmpp_ctx_t *ctx, const char *const id, const char *const jid);
const char * const jid);
char * stanza_get_status(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); 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, xmpp_stanza_t* stanza_create_roster_set(xmpp_ctx_t *ctx, const char *const id, const char *const jid,
const char * const jid, const char * const handle, GSList *groups); const char *const handle, GSList *groups);
xmpp_stanza_t * stanza_create_roster_remove_set(xmpp_ctx_t *ctx, xmpp_stanza_t* stanza_create_roster_remove_set(xmpp_ctx_t *ctx, const char *const barejid);
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); 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_room(xmpp_stanza_t *stanza);
char* stanza_get_muc_destroy_alternative_password(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); XMPPPresence* stanza_parse_presence(xmpp_stanza_t *stanza, int *err);
void stanza_free_presence(XMPPPresence *presence); 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); void stanza_free_caps(XMPPCaps *caps);
#endif #endif

View File

@ -138,81 +138,78 @@ typedef struct data_form_t {
// connection functions // connection functions
void jabber_init(void); void jabber_init(void);
jabber_conn_status_t jabber_connect_with_details(const char * const jid, jabber_conn_status_t jabber_connect_with_details(const char *const jid, const char *const passwd,
const char * const passwd, const char * const altdomain, const int port, const char *const tls_policy); 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_account(const ProfAccount *const account);
void jabber_disconnect(void); void jabber_disconnect(void);
void jabber_shutdown(void); void jabber_shutdown(void);
void jabber_process_events(int millis); void jabber_process_events(int millis);
const char * jabber_get_fulljid(void); const char* jabber_get_fulljid(void);
const char * jabber_get_domain(void); const char* jabber_get_domain(void);
jabber_conn_status_t jabber_get_connection_status(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); char* jabber_get_account_name(void);
GList * jabber_get_available_resources(void); GList* jabber_get_available_resources(void);
char* jabber_create_uuid(void); char* jabber_create_uuid(void);
void jabber_free_uuid(char *uuid); void jabber_free_uuid(char *uuid);
// message functions // message functions
char* message_send_chat(const char * const barejid, const char * const msg); 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_otr(const char *const barejid, const char *const msg);
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);
void message_send_private(const char * const fulljid, 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(const char *const roomjid, const char *const msg);
void message_send_groupchat_subject(const char * const roomjid, const char * const subject); void message_send_groupchat_subject(const char *const roomjid, const char *const subject);
void message_send_inactive(const char * const jid); void message_send_inactive(const char *const jid);
void message_send_composing(const char * const jid); void message_send_composing(const char *const jid);
void message_send_paused(const char * const jid); void message_send_paused(const char *const jid);
void message_send_gone(const char * const jid); void message_send_gone(const char *const jid);
void message_send_invite(const char * const room, const char * const contact, void message_send_invite(const char *const room, const char *const contact, const char *const reason);
const char * const reason);
// presence functions // 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); GSList* presence_get_subscription_requests(void);
gint presence_sub_request_count(void); gint presence_sub_request_count(void);
void presence_reset_sub_request_search(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_join_room(char *room, char *nick, char * passwd);
void presence_change_room_nick(const char * const room, const char * const nick); 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_leave_chat_room(const char *const room_jid);
void presence_send(resource_presence_t status, const char * const msg, int idle, char *signed_status); 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); gboolean presence_sub_request_exists(const char *const bare_jid);
// iq functions // iq functions
void iq_enable_carbons(); void iq_enable_carbons(void);
void iq_disable_carbons(); void iq_disable_carbons(void);
void iq_send_software_version(const char * const fulljid); void iq_send_software_version(const char *const fulljid);
void iq_room_list_request(gchar *conferencejid); void iq_room_list_request(gchar *conferencejid);
void iq_disco_info_request(gchar *jid); void iq_disco_info_request(gchar *jid);
void iq_disco_items_request(gchar *jid); void iq_disco_items_request(gchar *jid);
void iq_last_activity_request(gchar *jid); void iq_last_activity_request(gchar *jid);
void iq_set_autoping(int seconds); void iq_set_autoping(int seconds);
void iq_confirm_instant_room(const char * const room_jid); void iq_confirm_instant_room(const char *const room_jid);
void iq_destroy_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_request_room_config_form(const char *const room_jid);
void iq_submit_room_config(const char * const room, DataForm *form); void iq_submit_room_config(const char *const room, DataForm *form);
void iq_room_config_cancel(const char * const room_jid); void iq_room_config_cancel(const char *const room_jid);
void iq_send_ping(const char * const target); void iq_send_ping(const char *const target);
void iq_send_caps_request(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);
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,
void iq_send_caps_request_for_jid(const char * const to, const char * const id, const char *const ver);
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,
void iq_send_caps_request_legacy(const char * const to, const char * const id, const char *const ver);
const char * const node, const char * const ver); void iq_room_info_request(const char *const room, gboolean display_result);
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_list(const char * const room, char *affiliation); void iq_room_affiliation_set(const char *const room, const char *const jid, char *affiliation,
void iq_room_affiliation_set(const char * const room, const char * const jid, char *affiliation, const char *const reason);
const char * const reason); void iq_room_kick_occupant(const char *const room, const char *const nick, 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_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); void iq_room_role_list(const char * const room, char *role);
// caps functions // caps functions
Capabilities* caps_lookup(const char * const jid); Capabilities* caps_lookup(const char *const jid);
void caps_close(void); void caps_close(void);
void caps_destroy(Capabilities *caps); 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_update(const char *jid, const char *nick, const char *password, const char *autojoin_str);
gboolean bookmark_remove(const char *jid); gboolean bookmark_remove(const char *jid);
gboolean bookmark_join(const char *jid); gboolean bookmark_join(const char *jid);
const GList * bookmark_get_list(void); const GList* bookmark_get_list(void);
char * bookmark_find(const char * const search_str); char* bookmark_find(const char *const search_str);
void bookmark_autocomplete_reset(void); void bookmark_autocomplete_reset(void);
void roster_send_name_change(const char * const barejid, const char * const new_name, GSList *groups); 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_add_to_group(const char *const group, PContact contact);
void roster_send_remove_from_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_add_new(const char *const barejid, const char *const name);
void roster_send_remove(const char * const barejid); void roster_send_remove(const char *const barejid);
void form_destroy(DataForm *form); void form_destroy(DataForm *form);
char * form_get_form_type_field(DataForm *form); char* form_get_form_type_field(DataForm *form);
void form_set_value(DataForm *form, const char * const tag, char *value); 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); 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); 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_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_remove_text_multi_value(DataForm *form, const char *const tag, int index);
gboolean form_tag_exists(DataForm *form, const char * const tag); gboolean form_tag_exists(DataForm *form, const char *const tag);
form_field_type_t form_get_field_type(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); gboolean form_field_contains_option(DataForm *form, const char *const tag, char *value);
int form_get_value_count(DataForm *form, const char * const tag); int form_get_value_count(DataForm *form, const char *const tag);
FormField* form_get_field_by_tag(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); Autocomplete form_get_value_ac(DataForm *form, const char *const tag);
void form_reset_autocompleters(DataForm *form); void form_reset_autocompleters(DataForm *form);
GSList * form_get_non_form_type_fields_sorted(DataForm *form); GSList* form_get_non_form_type_fields_sorted(DataForm *form);
GSList * form_get_field_values_sorted(FormField *field); GSList* form_get_field_values_sorted(FormField *field);
#endif #endif