about summary refs log tree commit diff stats
path: root/src/xmpp/blocking.c
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2016-08-21 15:25:49 +0100
committerJames Booth <boothj5@gmail.com>2016-08-21 15:25:49 +0100
commit088606280626b8b4d7f303e54f69efd7d3bdb76a (patch)
tree6e37efdd1f8cc3a9bb1d5b04507d0c0f4427a5ac /src/xmpp/blocking.c
parenta52230978fbddc7f14460e2543621824689299d9 (diff)
downloadprofani-tty-088606280626b8b4d7f303e54f69efd7d3bdb76a.tar.gz
Use hash table for bookmarks
Diffstat (limited to 'src/xmpp/blocking.c')
-rw-r--r--src/xmpp/blocking.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/xmpp/blocking.c b/src/xmpp/blocking.c
index f00bb429..88266068 100644
--- a/src/xmpp/blocking.c
+++ b/src/xmpp/blocking.c
@@ -63,10 +63,6 @@ static Autocomplete blocked_ac;
 void
 blocking_request(void)
 {
-    char *id = create_unique_id("blocked_list_request");
-    xmpp_ctx_t *ctx = connection_get_ctx();
-    xmpp_stanza_t *iq;
-
     if (blocked) {
         g_list_free_full(blocked, free);
         blocked = NULL;
@@ -77,13 +73,16 @@ blocking_request(void)
     }
     blocked_ac = autocomplete_new();
 
+    char *id = create_unique_id("blocked_list_request");
     iq_id_handler_add(id, _blocklist_result_handler, NULL, NULL);
 
-    iq = stanza_create_blocked_list_request(ctx);
+    xmpp_ctx_t *ctx = connection_get_ctx();
+    xmpp_stanza_t *iq = stanza_create_blocked_list_request(ctx);
     xmpp_stanza_set_id(iq, id);
+    free(id);
+
     iq_send_stanza(iq);
     xmpp_stanza_release(iq);
-    free(id);
 }
 
 GList*
@@ -234,7 +233,7 @@ _block_add_result_handler(xmpp_stanza_t *const stanza, void *const userdata)
     char *jid = (char*)userdata;
 
     const char *type = xmpp_stanza_get_type(stanza);
-    if (type == NULL) {
+    if (!type) {
         log_info("Block response received for %s with no type attribute.", jid);
         free(jid);
         return 0;
@@ -258,7 +257,7 @@ _block_remove_result_handler(xmpp_stanza_t *const stanza, void *const userdata)
     char *jid = (char*)userdata;
 
     const char *type = xmpp_stanza_get_type(stanza);
-    if (type == NULL) {
+    if (!type) {
         log_info("Unblock response received for %s with no type attribute.", jid);
         free(jid);
         return 0;