diff options
Diffstat (limited to 'src/xmpp_presence.c')
-rw-r--r-- | src/xmpp_presence.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/src/xmpp_presence.c b/src/xmpp_presence.c index 897204f7..125e1400 100644 --- a/src/xmpp_presence.c +++ b/src/xmpp_presence.c @@ -33,6 +33,11 @@ #include "xmpp.h" static GHashTable *sub_requests; + +#define HANDLE(ns, type, func) xmpp_handler_add(conn, func, ns, STANZA_NAME_PRESENCE, type, ctx) + +static int _presence_handler(xmpp_conn_t * const conn, + xmpp_stanza_t * const stanza, void * const userdata); static char* _handle_presence_caps(xmpp_stanza_t * const stanza); static int _room_presence_handler(const char * const jid, xmpp_stanza_t * const stanza); @@ -44,6 +49,14 @@ presence_init(void) } void +presence_add_handlers(void) +{ + xmpp_conn_t * const conn = jabber_get_conn(); + xmpp_ctx_t * const ctx = jabber_get_ctx(); + HANDLE(NULL, NULL, _presence_handler); +} + +void presence_subscription(const char * const jid, const jabber_subscr_t action) { xmpp_ctx_t *ctx = jabber_get_ctx(); @@ -234,8 +247,8 @@ presence_update(jabber_presence_t status, const char * const msg, } -int -presence_handler(xmpp_conn_t * const conn, +static int +_presence_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, void * const userdata) { const char *jid = xmpp_conn_get_jid(conn); |