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

Don't log own messages on incoming MUC

`sv_ev_room_message()` called `groupchat_log_msg_in()` to log all
incoming MUC messages.

`cl_ev_send_muc_msg()` calls `groupchat_log_msg_out()`.

So messages sent by the user himself was logged two times.

Filter the incoming messages and only log the ones not from our occupant
jid/nick.

Fix https://github.com/profanity-im/profanity/issues/1201
This commit is contained in:
Michael Vetter 2019-10-06 22:32:58 +02:00
parent 7d7997e93c
commit 147be3afdf

View File

@ -294,10 +294,13 @@ sv_ev_room_message(ProfMessage *message)
char *mynick = muc_nick(mucwin->roomjid);
if (message->enc == PROF_MSG_ENC_OMEMO) {
groupchat_log_omemo_msg_in(message->jid->barejid, message->jid->resourcepart, message->plain);
} else {
groupchat_log_msg_in(message->jid->barejid, message->jid->resourcepart, message->plain);
// only log messages from others. we log our own via mucwin_outgoing_msg()
if (g_strcmp0(mynick, message->jid->resourcepart) != 0) {
if (message->enc == PROF_MSG_ENC_OMEMO) {
groupchat_log_omemo_msg_in(message->jid->barejid, message->jid->resourcepart, message->plain);
} else {
groupchat_log_msg_in(message->jid->barejid, message->jid->resourcepart, message->plain);
}
}
char *old_plain = message->plain;