1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-11-03 19:37:16 -05:00

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.
This commit is contained in:
Michael Vetter 2020-02-13 12:54:31 +01:00
parent 9b3593bdf9
commit e27c414f1f
2 changed files with 15 additions and 1 deletions

View File

@ -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);

View File

@ -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);