Skip to content

Commit

Permalink
Improve chatwin_outgoing_msg for message display consistency
Browse files Browse the repository at this point in the history
Ensure consistent invocation of `plugins_pre_chat_message_display`
for outgoing messages. Before the change, the function was not
called for sent messages upon sending, but only on fetching
sent messages from DB.

Fix #1917
  • Loading branch information
H3rnand3zzz committed Nov 11, 2023
1 parent 498467a commit 4d219ce
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/ui/chatwin.c
Original file line number Diff line number Diff line change
Expand Up @@ -427,15 +427,18 @@ chatwin_outgoing_msg(ProfChatWin* chatwin, const char* const message, char* id,

auto_char char* enc_char = get_enc_char(enc_mode, chatwin->outgoing_char);

auto_jid Jid* myjid = jid_create(connection_get_fulljid());
auto_char char* display_message = plugins_pre_chat_message_display(myjid->barejid, myjid->resourcepart, strdup(message));

if (request_receipt && id) {
win_print_outgoing_with_receipt((ProfWin*)chatwin, enc_char, "me", message, id, replace_id);
win_print_outgoing_with_receipt((ProfWin*)chatwin, enc_char, "me", display_message, id, replace_id);
} else {
win_print_outgoing((ProfWin*)chatwin, enc_char, id, replace_id, message);
win_print_outgoing((ProfWin*)chatwin, enc_char, id, replace_id, display_message);
}

// save last id and message for LMC in case if it's not LMC message
if (id && !replace_id) {
_chatwin_set_last_message(chatwin, id, message);
_chatwin_set_last_message(chatwin, id, display_message);
}
}

Expand Down

0 comments on commit 4d219ce

Please sign in to comment.