about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorPaul Fariello <paul@fariello.eu>2019-02-22 10:40:41 +0100
committerPaul Fariello <paul@fariello.eu>2019-04-10 16:03:50 +0200
commit2d28725c8573c0d7b906f15ff334a8154831661f (patch)
treec547cf74939fd1b274e7d43b10a5df10a16e338c /src
parentfdc5f25f2d1ba2a1b08a5c5b0ca41ed6395a1e76 (diff)
downloadprofani-tty-2d28725c8573c0d7b906f15ff334a8154831661f.tar.gz
Rename ProfIdCallback into ProfIqCallback
Goal is to create other kind of callback no based on id cmp
Diffstat (limited to 'src')
-rw-r--r--src/xmpp/iq.c24
-rw-r--r--src/xmpp/iq.h6
-rw-r--r--src/xmpp/roster.c4
3 files changed, 17 insertions, 17 deletions
diff --git a/src/xmpp/iq.c b/src/xmpp/iq.c
index a77ef59b..e1c3c281 100644
--- a/src/xmpp/iq.c
+++ b/src/xmpp/iq.c
@@ -77,11 +77,11 @@ typedef struct p_room_info_data_t {
     gboolean display;
 } ProfRoomInfoData;
 
-typedef struct p_id_handle_t {
-    ProfIdCallback func;
-    ProfIdFreeCallback free_func;
+typedef struct p_iq_handle_t {
+    ProfIqCallback func;
+    ProfIqFreeCallback free_func;
     void *userdata;
-} ProfIdHandler;
+} ProfIqHandler;
 
 typedef struct privilege_set_t {
     char *item;
@@ -205,7 +205,7 @@ _iq_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, void *const us
 
     const char *id = xmpp_stanza_get_id(stanza);
     if (id) {
-        ProfIdHandler *handler = g_hash_table_lookup(id_handlers, id);
+        ProfIqHandler *handler = g_hash_table_lookup(id_handlers, id);
         if (handler) {
             int keep = handler->func(stanza, handler->userdata);
             if (!keep) {
@@ -234,7 +234,7 @@ iq_handlers_init(void)
         GList *keys = g_hash_table_get_keys(id_handlers);
         GList *curr = keys;
         while (curr) {
-            ProfIdHandler *handler = g_hash_table_lookup(id_handlers, curr->data);
+            ProfIqHandler *handler = g_hash_table_lookup(id_handlers, curr->data);
             if (handler->free_func && handler->userdata) {
                 handler->free_func(handler->userdata);
             }
@@ -248,9 +248,9 @@ iq_handlers_init(void)
 }
 
 void
-iq_id_handler_add(const char *const id, ProfIdCallback func, ProfIdFreeCallback free_func, void *userdata)
+iq_id_handler_add(const char *const id, ProfIqCallback func, ProfIqFreeCallback free_func, void *userdata)
 {
-    ProfIdHandler *handler = malloc(sizeof(ProfIdHandler));
+    ProfIqHandler *handler = malloc(sizeof(ProfIqHandler));
     handler->func = func;
     handler->free_func = free_func;
     handler->userdata = userdata;
@@ -438,7 +438,7 @@ iq_room_info_request(const char *const room, gboolean display_result)
     cb_data->room = strdup(room);
     cb_data->display = display_result;
 
-    iq_id_handler_add(id, _room_info_response_id_handler, (ProfIdFreeCallback)_iq_free_room_data, cb_data);
+    iq_id_handler_add(id, _room_info_response_id_handler, (ProfIqFreeCallback)_iq_free_room_data, cb_data);
 
     free(id);
 
@@ -651,7 +651,7 @@ iq_room_affiliation_set(const char *const room, const char *const jid, char *aff
     affiliation_set->item = strdup(jid);
     affiliation_set->privilege = strdup(affiliation);
 
-    iq_id_handler_add(id, _room_affiliation_set_result_id_handler, (ProfIdFreeCallback)_iq_free_affiliation_set, affiliation_set);
+    iq_id_handler_add(id, _room_affiliation_set_result_id_handler, (ProfIqFreeCallback)_iq_free_affiliation_set, affiliation_set);
 
     iq_send_stanza(iq);
     xmpp_stanza_release(iq);
@@ -670,7 +670,7 @@ iq_room_role_set(const char *const room, const char *const nick, char *role,
     role_set->item = strdup(nick);
     role_set->privilege = strdup(role);
 
-    iq_id_handler_add(id, _room_role_set_result_id_handler, (ProfIdFreeCallback)_iq_free_affiliation_set, role_set);
+    iq_id_handler_add(id, _room_role_set_result_id_handler, (ProfIqFreeCallback)_iq_free_affiliation_set, role_set);
 
     iq_send_stanza(iq);
     xmpp_stanza_release(iq);
@@ -697,7 +697,7 @@ iq_send_ping(const char *const target)
     const char *id = xmpp_stanza_get_id(iq);
 
     GDateTime *now = g_date_time_new_now_local();
-    iq_id_handler_add(id, _manual_pong_id_handler, (ProfIdFreeCallback)g_date_time_unref, now);
+    iq_id_handler_add(id, _manual_pong_id_handler, (ProfIqFreeCallback)g_date_time_unref, now);
 
     iq_send_stanza(iq);
     xmpp_stanza_release(iq);
diff --git a/src/xmpp/iq.h b/src/xmpp/iq.h
index 025d5e9f..bc273db4 100644
--- a/src/xmpp/iq.h
+++ b/src/xmpp/iq.h
@@ -35,12 +35,12 @@
 #ifndef XMPP_IQ_H
 #define XMPP_IQ_H
 
-typedef int(*ProfIdCallback)(xmpp_stanza_t *const stanza, void *const userdata);
-typedef void(*ProfIdFreeCallback)(void *userdata);
+typedef int(*ProfIqCallback)(xmpp_stanza_t *const stanza, void *const userdata);
+typedef void(*ProfIqFreeCallback)(void *userdata);
 
 void iq_handlers_init(void);
 void iq_send_stanza(xmpp_stanza_t *const stanza);
-void iq_id_handler_add(const char *const id, ProfIdCallback func, ProfIdFreeCallback free_func, void *userdata);
+void iq_id_handler_add(const char *const id, ProfIqCallback func, ProfIqFreeCallback free_func, void *userdata);
 void iq_disco_info_request_onconnect(gchar *jid);
 void iq_disco_items_request_onconnect(gchar *jid);
 void iq_send_caps_request(const char *const to, const char *const id, const char *const node, const char *const ver);
diff --git a/src/xmpp/roster.c b/src/xmpp/roster.c
index 9be154e7..fe15515f 100644
--- a/src/xmpp/roster.c
+++ b/src/xmpp/roster.c
@@ -137,7 +137,7 @@ roster_send_add_to_group(const char *const group, PContact contact)
     }
 
     xmpp_ctx_t * const ctx = connection_get_ctx();
-    iq_id_handler_add(unique_id, _group_add_id_handler, (ProfIdFreeCallback)_free_group_data, data);
+    iq_id_handler_add(unique_id, _group_add_id_handler, (ProfIqFreeCallback)_free_group_data, data);
     xmpp_stanza_t *iq = stanza_create_roster_set(ctx, unique_id, p_contact_barejid(contact),
         p_contact_name(contact), new_groups);
     iq_send_stanza(iq);
@@ -180,7 +180,7 @@ roster_send_remove_from_group(const char *const group, PContact contact)
         data->name = strdup(p_contact_barejid(contact));
     }
 
-    iq_id_handler_add(unique_id, _group_remove_id_handler, (ProfIdFreeCallback)_free_group_data, data);
+    iq_id_handler_add(unique_id, _group_remove_id_handler, (ProfIqFreeCallback)_free_group_data, data);
     xmpp_stanza_t *iq = stanza_create_roster_set(ctx, unique_id, p_contact_barejid(contact),
         p_contact_name(contact), new_groups);
     iq_send_stanza(iq);