From e27c414f1f22f8905ff2586a39ba91ff2ea23cb8 Mon Sep 17 00:00:00 2001 From: Michael Vetter Date: Thu, 13 Feb 2020 12:54:31 +0100 Subject: [PATCH] xep-0308: enable for carbon copied messages If we are connected with another client and send a message, then correct it. We now display it correctly in Profanity. Id wasn't saved for carbon copied messages too so far. --- src/ui/chatwin.c | 1 - src/xmpp/message.c | 15 +++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/ui/chatwin.c b/src/ui/chatwin.c index 859921b9..4b0fd889 100644 --- a/src/ui/chatwin.c +++ b/src/ui/chatwin.c @@ -351,7 +351,6 @@ chatwin_outgoing_carbon(ProfChatWin *chatwin, ProfMessage *message) ProfWin *window = (ProfWin*)chatwin; - // TODO id set? win_print_outgoing(window, enc_char, message->id, message->replace_id, "%s", message->plain); int num = wins_get_num(window); status_bar_active(num, WIN_CHAT, chatwin->barejid); diff --git a/src/xmpp/message.c b/src/xmpp/message.c index a3f37baf..0caef0f6 100644 --- a/src/xmpp/message.c +++ b/src/xmpp/message.c @@ -1055,6 +1055,21 @@ _handle_carbons(xmpp_stanza_t *const stanza) message->mucuser = TRUE; } + // id + const char *id = xmpp_stanza_get_id(message_stanza); + if (id) { + message->id = strdup(id); + } + + // replace id + xmpp_stanza_t *replace_id_stanza = xmpp_stanza_get_child_by_ns(message_stanza, STANZA_NS_LAST_MESSAGE_CORRECTION); + if (replace_id_stanza) { + const char *replace_id = xmpp_stanza_get_id(replace_id_stanza); + if (replace_id) { + message->replace_id = strdup(replace_id); + } + } + // check omemo encryption #ifdef HAVE_OMEMO message->plain = omemo_receive_message(message_stanza, &message->trusted);