Added support for presence hooks
[cascardo/chat.git] / xmpp.c
diff --git a/xmpp.c b/xmpp.c
index 44f5761..b258984 100644 (file)
--- a/xmpp.c
+++ b/xmpp.c
@@ -175,6 +175,18 @@ hc_xmpp_set_sent_msg_hook (hc_xmpp_t *xmpp, hc_xmpp_hook_t hook)
   xmpp->sentmsghook = hook;
 }
 
+void
+hc_xmpp_set_pres_hook (hc_xmpp_t *xmpp, hc_xmpp_hook_t hook)
+{
+  xmpp->preshook = hook;
+}
+
+void
+hc_xmpp_set_sent_pres_hook (hc_xmpp_t *xmpp, hc_xmpp_hook_t hook)
+{
+  xmpp->sentpreshook = hook;
+}
+
 void
 hc_xmpp_recv_message (hc_xmpp_t *xmpp, iks *stanza)
 {
@@ -188,3 +200,17 @@ hc_xmpp_sent_message (hc_xmpp_t *xmpp, iks *stanza)
   if (xmpp->sentmsghook)
     xmpp->sentmsghook (xmpp, stanza);
 }
+
+void
+hc_xmpp_recv_presence (hc_xmpp_t *xmpp, iks *stanza)
+{
+  if (xmpp->preshook)
+    xmpp->preshook (xmpp, stanza);
+}
+
+void
+hc_xmpp_sent_presence (hc_xmpp_t *xmpp, iks *stanza)
+{
+  if (xmpp->sentpreshook)
+    xmpp->sentpreshook (xmpp, stanza);
+}