mirror of
https://github.com/profanity-im/profanity.git
synced 2025-01-03 14:57:42 -05:00
Tidied message handler
This commit is contained in:
parent
ae1e037d0c
commit
3970a4d736
12
jabber.c
12
jabber.c
@ -128,15 +128,15 @@ void jabber_roster_request(void)
|
||||
static int _jabber_message_handler(xmpp_conn_t * const conn,
|
||||
xmpp_stanza_t * const stanza, void * const userdata)
|
||||
{
|
||||
char *message;
|
||||
|
||||
if(!xmpp_stanza_get_child_by_name(stanza, "body"))
|
||||
return 1;
|
||||
if(!strcmp(xmpp_stanza_get_attribute(stanza, "type"), "error"))
|
||||
xmpp_stanza_t *body = xmpp_stanza_get_child_by_name(stanza, "body");
|
||||
if(body == NULL)
|
||||
return 1;
|
||||
|
||||
message = xmpp_stanza_get_text(xmpp_stanza_get_child_by_name(stanza, "body"));
|
||||
char *type = xmpp_stanza_get_attribute(stanza, "type");
|
||||
if(strcmp(type, "error") == 0)
|
||||
return 1;
|
||||
|
||||
char *message = xmpp_stanza_get_text(body);
|
||||
char *from = xmpp_stanza_get_attribute(stanza, "from");
|
||||
win_show_incomming_msg(from, message);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user