about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorMichael Vetter <jubalh@iodoru.org>2021-12-06 13:44:04 +0100
committerMichael Vetter <jubalh@iodoru.org>2021-12-06 13:44:04 +0100
commit6c3e6a5262c6009f43dddb6fd5a2fc8204520eef (patch)
treea3c8f606f292391d6c81d08abad8ecc29524ffc1
parent67fea6f3c452dd8c96feb7c2ad8de90eba632ce7 (diff)
downloadprofani-tty-6c3e6a5262c6009f43dddb6fd5a2fc8204520eef.tar.gz
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.
-rw-r--r--src/xmpp/message.c5
1 files 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;