From b19f668392714ebc11557c109e186cf149640c93 Mon Sep 17 00:00:00 2001 From: John Hernandez <129467592+H3rnand3zzz@users.noreply.github.com> Date: Thu, 9 Nov 2023 09:39:41 +0100 Subject: [PATCH] Fix: add `plugins_pre_chat_message_display` call for outgoing messages 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 https://github.com/profanity-im/profanity/issues/1917 --- src/ui/chatwin.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/ui/chatwin.c b/src/ui/chatwin.c index bf302cd0..4317cc78 100644 --- a/src/ui/chatwin.c +++ b/src/ui/chatwin.c @@ -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); } }