From 6c3e6a5262c6009f43dddb6fd5a2fc8204520eef Mon Sep 17 00:00:00 2001 From: Michael Vetter Date: Mon, 6 Dec 2021 13:44:04 +0100 Subject: xep-0107: adapting the pubsub/headline code Like mentioned on the review at https://github.com/profanity-im/profanity/pull/1605 I don't ge why @DebXWoody changed the code like he did. I changed it to something that made more sense to me now. Instead of looking for headline in two places and checking for pubsub in a headline place (only). I didn't check this deeply. And still have a feeling that this is not the best way to go. But I didn't read the XEP yet. Added a TODO to the code regarding this too. A quick skimming through https://xmpp.org/extensions/xep-0107.html doesn't show me anything regarding headline. So I really don't see why this needs to go here. Hopefully @DebXWoody checks this in the future. But since he didn't react on the PR I decided to make some adjustments myself so we can merge it. --- src/xmpp/message.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/xmpp/message.c b/src/xmpp/message.c index 17ef979b..ab4d48c6 100644 --- a/src/xmpp/message.c +++ b/src/xmpp/message.c @@ -164,9 +164,12 @@ _message_handler(xmpp_conn_t* const conn, xmpp_stanza_t* const stanza, void* con } else if (type && g_strcmp0(type, STANZA_TYPE_HEADLINE) == 0) { xmpp_stanza_t* event = xmpp_stanza_get_child_by_ns(stanza, STANZA_NS_PUBSUB_EVENT); + // TODO: do we want to handle all pubsub here or should additionaly check for STANZA_NS_MOOD? if (event) { _handle_pubsub(stanza, event); return 1; + } else { + _handle_headline(stanza); } } else if (type == NULL || g_strcmp0(type, STANZA_TYPE_CHAT) == 0 || g_strcmp0(type, STANZA_TYPE_NORMAL) == 0) { // type: chat, normal (==NULL) @@ -252,8 +255,6 @@ _message_handler(xmpp_conn_t* const conn, xmpp_stanza_t* const stanza, void* con if (msg_stanza) { _handle_chat(msg_stanza, FALSE, is_carbon, NULL, NULL); } - } else if (type && g_strcmp0(type, STANZA_TYPE_HEADLINE) == 0) { - _handle_headline(stanza); } else { // none of the allowed types char* text; -- cgit 1.4.1-2-gfad0