about summary refs log tree commit diff stats
path: root/src/event/server_events.c
diff options
context:
space:
mode:
authorPaul Fariello <paul@fariello.eu>2019-04-01 20:39:39 +0320
committerPaul Fariello <paul@fariello.eu>2019-04-10 17:23:46 +0200
commite69f947547160ea2c965a3d4f5966c5f4a289340 (patch)
treeebb71704f3ce98fdb9494dfcfb1b555dc2d212ce /src/event/server_events.c
parente7be3a605bbb47e462265a379d48aad9cc565fc2 (diff)
downloadprofani-tty-e69f947547160ea2c965a3d4f5966c5f4a289340.tar.gz
Rework MUC reflected message filtering
Reflected messages can't be filtered by nick only otherwise you might
ignore messages comming from you on another devices.

Consequently we maintain a list of sent messages id in mucwin.
To be sure the id will be correctly reflected we use the origin-id
stanza.
Diffstat (limited to 'src/event/server_events.c')
-rw-r--r--src/event/server_events.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/src/event/server_events.c b/src/event/server_events.c
index 023e8a13..f6c640f3 100644
--- a/src/event/server_events.c
+++ b/src/event/server_events.c
@@ -260,7 +260,7 @@ sv_ev_room_history(const char *const room_jid, const char *const nick,
 }
 
 void
-sv_ev_room_message(const char *const room_jid, const char *const nick, const char *const message, gboolean omemo)
+sv_ev_room_message(const char *const room_jid, const char *const nick, const char *const message, const char *const id, gboolean omemo)
 {
     ProfMucWin *mucwin = wins_get_muc(room_jid);
     if (!mucwin) {
@@ -268,10 +268,6 @@ sv_ev_room_message(const char *const room_jid, const char *const nick, const cha
     }
 
     char *mynick = muc_nick(mucwin->roomjid);
-    if (g_strcmp0(mynick, nick) == 0) {
-        /* Ignore message reflection */
-        return;
-    }
 
     if (omemo) {
         groupchat_log_omemo_msg_in(room_jid, nick, message);
@@ -295,9 +291,9 @@ sv_ev_room_message(const char *const room_jid, const char *const nick, const cha
     GList *triggers = prefs_message_get_triggers(new_message);
 
     if (omemo) {
-        mucwin_incoming_msg(mucwin, nick, new_message, mentions, triggers, PROF_MSG_OMEMO);
+        mucwin_incoming_msg(mucwin, nick, new_message, id, mentions, triggers, PROF_MSG_OMEMO);
     } else {
-        mucwin_incoming_msg(mucwin, nick, new_message, mentions, triggers, PROF_MSG_PLAIN);
+        mucwin_incoming_msg(mucwin, nick, new_message, id, mentions, triggers, PROF_MSG_PLAIN);
     }
 
     g_slist_free(mentions);