about summary refs log tree commit diff stats
path: root/src/xmpp
diff options
context:
space:
mode:
authorMichael Vetter <jubalh@iodoru.org>2019-10-29 10:30:55 +0100
committerMichael Vetter <jubalh@iodoru.org>2019-10-29 10:41:07 +0100
commit7dd747b58d306d4a4d253cb52b82744f040d3e84 (patch)
tree2ec864532d61edcac1c407fc500f78565d949036 /src/xmpp
parent8c8c18c6fddec89cbaa83abfcac29a97ef98c294 (diff)
downloadprofani-tty-7dd747b58d306d4a4d253cb52b82744f040d3e84.tar.gz
Set mucuser in carbon case
Also we initialize mucuser properly.

Now in case of a carbon of a MUC PM we sv_ev_incoming_carbon() which
calls _sv_ev_incoming_plain() and then we log it via chat_log_msg_in()
in there.
But we also get the sv_ev_incoming_private_message() and call
chat_log_msg_in() in there too. So the incoming message get's logged
twice.
Diffstat (limited to 'src/xmpp')
-rw-r--r--src/xmpp/message.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/xmpp/message.c b/src/xmpp/message.c
index 9a82b1f4..b8a6d3a8 100644
--- a/src/xmpp/message.c
+++ b/src/xmpp/message.c
@@ -192,6 +192,7 @@ message_init(void)
     message->enc = PROF_MSG_ENC_PLAIN;
     message->timestamp = NULL;
     message->trusted = true;
+    message->mucuser = false;
 
     return message;
 }
@@ -914,6 +915,7 @@ _private_chat_handler(xmpp_stanza_t *const stanza)
 {
     // standard chat message, use jid without resource
     ProfMessage *message = message_init();
+    message->mucuser = TRUE;
 
     const gchar *from = xmpp_stanza_get_from(stanza);
     message->jid = jid_create(from);
@@ -991,6 +993,12 @@ _handle_carbons(xmpp_stanza_t *const stanza)
 
     ProfMessage *message = message_init();
 
+    // check whether message was a MUC PM
+    xmpp_stanza_t *mucuser = xmpp_stanza_get_child_by_ns(message_stanza, STANZA_NS_MUC_USER);
+    if (mucuser) {
+        message->mucuser = TRUE;
+    }
+
     // check omemo encryption
 #ifdef HAVE_OMEMO
     message->plain = omemo_receive_message(message_stanza, &message->trusted);