mirror of
https://git.jabber.space/devs/cproof.git
synced 2026-07-17 23:36:22 +00:00
fix(chatwin): only fire plugins_post_chat_message_display on incoming
The trigger was wired into outgoing / outgoing-carbon / history paths too, which made plugins like sounds.py play the "new message" sound when opening a chat (history loads), sending a message yourself, or receiving a carbon of your own sent message from another device. Restrict the call to chatwin_incoming_msg — matches the semantic of "a remote party sent a chat message and it was displayed".
This commit is contained in:
@@ -399,8 +399,6 @@ chatwin_outgoing_msg(ProfChatWin* chatwin, const char* const message, const char
|
||||
win_print_outgoing((ProfWin*)chatwin, enc_char, id, replace_id, display_message);
|
||||
}
|
||||
|
||||
plugins_post_chat_message_display(myjid->barejid, myjid->resourcepart, display_message);
|
||||
|
||||
// Save last id and message for LMC
|
||||
// Note: if the same message is to be corrected several times, the id of the original message is used in each case
|
||||
// https://xmpp.org/extensions/xep-0308.html#rules
|
||||
@@ -434,7 +432,6 @@ chatwin_outgoing_carbon(ProfChatWin* chatwin, ProfMessage* message)
|
||||
|
||||
win_print_outgoing(window, enc_char, message->id, message->replace_id, message->plain);
|
||||
|
||||
plugins_post_chat_message_display(message->from_jid->barejid, message->from_jid->resourcepart, message->plain);
|
||||
message->plain = old_plain;
|
||||
|
||||
int num = wins_get_num(window);
|
||||
@@ -561,7 +558,6 @@ _chatwin_history(ProfChatWin* chatwin, const char* const contact_barejid)
|
||||
if (plugin_msg)
|
||||
msg->plain = plugin_msg;
|
||||
win_print_history((ProfWin*)chatwin, msg);
|
||||
plugins_post_chat_message_display(msg->from_jid->barejid, msg->from_jid->resourcepart, msg->plain);
|
||||
msg->plain = old_plain;
|
||||
curr = g_slist_next(curr);
|
||||
}
|
||||
@@ -601,7 +597,6 @@ chatwin_db_history(ProfChatWin* chatwin, const gchar* start_time, const gchar* e
|
||||
} else {
|
||||
win_print_history((ProfWin*)chatwin, msg);
|
||||
}
|
||||
plugins_post_chat_message_display(msg->from_jid->barejid, msg->from_jid->resourcepart, msg->plain);
|
||||
msg->plain = old_plain;
|
||||
curr = g_slist_next(curr);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user