mirror of
https://github.com/profanity-im/profanity.git
synced 2024-11-03 19:37:16 -05:00
Added message_add_handlers()
This commit is contained in:
parent
0f01f30b9c
commit
f60864f870
@ -163,9 +163,7 @@ void jabber_conn_set_status(const char * const message);
|
||||
char* jabber_get_account_name(void);
|
||||
|
||||
// message functions
|
||||
|
||||
int message_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza,
|
||||
void * const userdata);
|
||||
void message_add_handlers(void);
|
||||
void message_send(const char * const msg, const char * const recipient);
|
||||
void message_send_groupchat(const char * const msg, const char * const recipient);
|
||||
void message_send_inactive(const char * const recipient);
|
||||
|
@ -403,8 +403,7 @@ _connection_handler(xmpp_conn_t * const conn,
|
||||
|
||||
chat_sessions_init();
|
||||
|
||||
xmpp_handler_add(conn, message_handler, NULL, STANZA_NAME_MESSAGE, NULL, ctx);
|
||||
|
||||
message_add_handlers();
|
||||
presence_add_handlers();
|
||||
iq_add_handlers();
|
||||
|
||||
|
@ -32,9 +32,21 @@
|
||||
#include "profanity.h"
|
||||
#include "xmpp.h"
|
||||
|
||||
#define HANDLE(ns, type, func) xmpp_handler_add(conn, func, ns, STANZA_NAME_MESSAGE, type, ctx)
|
||||
|
||||
static int _message_handler(xmpp_conn_t * const conn,
|
||||
xmpp_stanza_t * const stanza, void * const userdata);
|
||||
static int _groupchat_message_handler(xmpp_stanza_t * const stanza);
|
||||
static int _chat_message_handler(xmpp_stanza_t * const stanza);
|
||||
|
||||
void
|
||||
message_add_handlers(void)
|
||||
{
|
||||
xmpp_conn_t * const conn = jabber_get_conn();
|
||||
xmpp_ctx_t * const ctx = jabber_get_ctx();
|
||||
HANDLE(NULL, NULL, _message_handler);
|
||||
}
|
||||
|
||||
void
|
||||
message_send(const char * const msg, const char * const recipient)
|
||||
{
|
||||
@ -124,8 +136,8 @@ message_send_gone(const char * const recipient)
|
||||
chat_session_set_sent(recipient);
|
||||
}
|
||||
|
||||
int
|
||||
message_handler(xmpp_conn_t * const conn,
|
||||
static int
|
||||
_message_handler(xmpp_conn_t * const conn,
|
||||
xmpp_stanza_t * const stanza, void * const userdata)
|
||||
{
|
||||
gchar *type = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_TYPE);
|
||||
|
Loading…
Reference in New Issue
Block a user