Created extensible hooks
[cascardo/chat.git] / xmpp.c
diff --git a/xmpp.c b/xmpp.c
index ca9501e..dc59c17 100644 (file)
--- a/xmpp.c
+++ b/xmpp.c
@@ -38,6 +38,11 @@ hc_xmpp_new (iksStreamHook *hook, char *server, char *user, char *pass)
   xmpp->tls = NONE;
   xmpp->sasl = NONE;
   xmpp->status = HC_XMPP_NONE;
+  xmpp->nshooks = g_hash_table_new (g_str_hash, g_str_equal);
+  g_hash_table_insert (xmpp->nshooks, HC_XMPP_NS_BIND, hc_xmpp_hook_bind);
+  g_hash_table_insert (xmpp->nshooks, HC_XMPP_NS_SESSION, hc_xmpp_hook_session);
+  g_hash_table_insert (xmpp->nshooks, HC_XMPP_NS_DISCO_INFO,
+                       hc_xmpp_hook_disco);
   return xmpp;
 }
 
@@ -89,12 +94,36 @@ hc_xmpp_is_sasl_enabled (hc_xmpp_t *xmpp)
   return xmpp->sasl & ENABLED;
 }
 
+int
+hc_xmpp_is_bind_supported (hc_xmpp_t *xmpp)
+{
+  return xmpp->bind & SUPPORTED;
+}
+
+int
+hc_xmpp_is_session_supported (hc_xmpp_t *xmpp)
+{
+  return xmpp->session & SUPPORTED;
+}
+
+int
+hc_xmpp_is_session_required (hc_xmpp_t *xmpp)
+{
+  return xmpp->session & REQUIRED;
+}
+
 char *
 hc_xmpp_server (hc_xmpp_t *xmpp)
 {
   return xmpp->server;
 }
 
+int
+hc_xmpp_fd (hc_xmpp_t *xmpp)
+{
+  return xmpp->fd;
+}
+
 void
 hc_xmpp_send_buffer (hc_xmpp_t *xmpp, char *buffer, size_t len)
 {