Allow user to change his status, sending a broadcast presence
[cascardo/hcxmpp.git] / hook.c
diff --git a/hook.c b/hook.c
index e91e9fb..7b95869 100644 (file)
--- a/hook.c
+++ b/hook.c
@@ -58,12 +58,16 @@ hc_xmpp_hook (void *data, int type, iks *stanza)
     {
       hc_xmpp_recv_message (xmpp, stanza);
     }
+  else if (!iks_strcmp (iks_name (stanza), "presence"))
+    {
+      hc_xmpp_recv_presence (xmpp, stanza);
+    }
   else if (!iks_strcmp (iks_name (stanza), "iq"))
     {
       char *ns = iks_find_attrib (iks_child (stanza), "xmlns");
       hc_xmpp_hook_t hook;
-      if (g_hash_table_lookup_extended (xmpp->nshooks, ns,
-                                        NULL, (gpointer *) &hook))
+      if (ns != NULL && g_hash_table_lookup_extended (xmpp->nshooks, ns,
+                                                      NULL, (gpointer *) &hook))
         hook (xmpp, stanza);
     }
   else if (!iks_strcmp (iks_name (stanza), "stream:features"))