From 7dd747b58d306d4a4d253cb52b82744f040d3e84 Mon Sep 17 00:00:00 2001 From: Michael Vetter Date: Tue, 29 Oct 2019 10:30:55 +0100 Subject: 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. --- src/xmpp/message.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/xmpp') 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); -- cgit 1.4.1-2-gfad0