Start supporting discovery
[cascardo/chat.git] / tictactoe.c
index b57c1b9..b774512 100644 (file)
 #include "xmpp.h"
 #include "sasl.h"
 #include "bind.h"
+#include "disco.h"
 
 static void write_stream (hc_xmpp_t *);
 
 static void
 send_message_test (hc_xmpp_t *xmpp)
 {
-  iks *msg;
-  msg = iks_new ("message");
-  iks_insert_attrib (msg, "to", "metal@jabber-br.org");
-  iks_insert_cdata (iks_insert (msg, "body"), "pubsub", 0);
-  hc_xmpp_send_iks (xmpp, msg);
-  iks_delete (msg);
+  hc_xmpp_send_disco_info (xmpp, "");
 }
 
 static int
@@ -61,6 +57,10 @@ myhook (void *data, int type, iks *stanza)
           if (hc_xmpp_status (data) == HC_XMPP_SESSION)
             send_message_test (data);
         }
+      else if (!iks_strcmp (ns, HC_XMPP_NS_DISCO_INFO))
+        {
+          hc_xmpp_recv_disco (data, stanza);
+        }
     }
   else if (!iks_strcmp (iks_name (stanza), "stream:features"))
     {