mirror of
https://github.com/profanity-im/profanity.git
synced 2024-11-03 19:37:16 -05:00
Added presence_add_handlers()
This commit is contained in:
parent
a30474f9fc
commit
0b7a0531d0
@ -172,12 +172,11 @@ char* jabber_get_account_name(void);
|
|||||||
void iq_add_handlers(void);
|
void iq_add_handlers(void);
|
||||||
|
|
||||||
// presence functions
|
// presence functions
|
||||||
|
void presence_add_handlers(void);
|
||||||
void presence_init(void);
|
void presence_init(void);
|
||||||
void presence_subscription(const char * const jid, const jabber_subscr_t action);
|
void presence_subscription(const char * const jid, const jabber_subscr_t action);
|
||||||
GList* presence_get_subscription_requests(void);
|
GList* presence_get_subscription_requests(void);
|
||||||
void presence_free_sub_requests(void);
|
void presence_free_sub_requests(void);
|
||||||
int presence_handler(xmpp_conn_t * const conn,
|
|
||||||
xmpp_stanza_t * const stanza, void * const userdata);
|
|
||||||
void presence_join_room(Jid *jid);
|
void presence_join_room(Jid *jid);
|
||||||
void presence_change_room_nick(const char * const room, const char * const nick);
|
void presence_change_room_nick(const char * const room, const char * const nick);
|
||||||
void presence_leave_chat_room(const char * const room_jid);
|
void presence_leave_chat_room(const char * const room_jid);
|
||||||
|
@ -663,8 +663,8 @@ _connection_handler(xmpp_conn_t * const conn,
|
|||||||
chat_sessions_init();
|
chat_sessions_init();
|
||||||
|
|
||||||
xmpp_handler_add(conn, _message_handler, NULL, STANZA_NAME_MESSAGE, NULL, ctx);
|
xmpp_handler_add(conn, _message_handler, NULL, STANZA_NAME_MESSAGE, NULL, ctx);
|
||||||
xmpp_handler_add(conn, presence_handler, NULL, STANZA_NAME_PRESENCE, NULL, ctx);
|
|
||||||
|
|
||||||
|
presence_add_handlers();
|
||||||
iq_add_handlers();
|
iq_add_handlers();
|
||||||
|
|
||||||
if (prefs_get_autoping() != 0) {
|
if (prefs_get_autoping() != 0) {
|
||||||
|
@ -33,6 +33,11 @@
|
|||||||
#include "xmpp.h"
|
#include "xmpp.h"
|
||||||
|
|
||||||
static GHashTable *sub_requests;
|
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 char* _handle_presence_caps(xmpp_stanza_t * const stanza);
|
||||||
static int _room_presence_handler(const char * const jid,
|
static int _room_presence_handler(const char * const jid,
|
||||||
xmpp_stanza_t * const stanza);
|
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);
|
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
|
void
|
||||||
presence_subscription(const char * const jid, const jabber_subscr_t action)
|
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
|
static int
|
||||||
presence_handler(xmpp_conn_t * const conn,
|
_presence_handler(xmpp_conn_t * const conn,
|
||||||
xmpp_stanza_t * const stanza, void * const userdata)
|
xmpp_stanza_t * const stanza, void * const userdata)
|
||||||
{
|
{
|
||||||
const char *jid = xmpp_conn_get_jid(conn);
|
const char *jid = xmpp_conn_get_jid(conn);
|
||||||
|
Loading…
Reference in New Issue
Block a user