Added presence_add_handlers()

This commit is contained in:
James Booth
2013-01-29 00:04:49 +00:00
parent a30474f9fc
commit 0b7a0531d0
3 changed files with 17 additions and 5 deletions

View File

@@ -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);
@@ -43,6 +48,14 @@ presence_init(void)
sub_requests = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free);
}
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)
{
@@ -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);