Question about XMPP handlers in message.c

26 views
Skip to first unread message

Olivier

unread,
Jan 28, 2015, 11:42:32 AM1/28/15
to profan...@googlegroups.com, ma...@olivierlemoal.fr
Hello,

I am trying to fiddle a bit with the code to add some features.
In message.c, you are user the following handlers for chat messages :



HANDLE
(NULL, NULL, _chat_handler);


Then in the callback function you check if the type is chat :

    // ignore if type not chat or absent
   
char *type = xmpp_stanza_get_type(stanza);
   
if (!(g_strcmp0(type, "chat") == 0 || type == NULL)) {
       
return 1;
   
}

Is there a reason not to use the following handler instead ?

HANDLE(NULL,                 STANZA_TYPE_CHAT,       _chat_handler);

Thanks !

Boothj5

unread,
Jan 28, 2015, 5:58:02 PM1/28/15
to profan...@googlegroups.com, ma...@olivierlemoal.fr
Originally the handler was defined as you suggest, but was changed in the following commit:

https://github.com/boothj5/profanity/commit/4898ed10a45581a98986fed5a2fabe6a6e7a9dab

This commit fixes a bug where messages were not getting displayed, due to receiving 'message' stanzas with no 'type' attribute, which is valid according to the specification and should be treated as normal messages:

http://xmpp.org/rfcs/rfc6121.html#message-syntax-type
Reply all
Reply to author
Forward
0 new messages