mirror of
https://git.jabber.space/devs/cproof.git
synced 2026-07-24 06:26:21 +00:00
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.
This commit is contained in:
@@ -353,12 +353,13 @@ cl_ev_send_muc_msg(ProfMucWin *mucwin, const char *const msg, const char *const
|
||||
if (mucwin->is_omemo) {
|
||||
char *id = omemo_on_message_send((ProfWin *)mucwin, plugin_msg, FALSE, TRUE);
|
||||
groupchat_log_omemo_msg_out(mucwin->roomjid, plugin_msg);
|
||||
mucwin_outgoing_msg(mucwin, plugin_msg, PROF_MSG_OMEMO);
|
||||
mucwin_outgoing_msg(mucwin, plugin_msg, id, PROF_MSG_OMEMO);
|
||||
free(id);
|
||||
} else {
|
||||
message_send_groupchat(mucwin->roomjid, plugin_msg, oob_url);
|
||||
char *id = message_send_groupchat(mucwin->roomjid, plugin_msg, oob_url);
|
||||
groupchat_log_msg_out(mucwin->roomjid, plugin_msg);
|
||||
mucwin_outgoing_msg(mucwin, plugin_msg, PROF_MSG_PLAIN);
|
||||
mucwin_outgoing_msg(mucwin, plugin_msg, id, PROF_MSG_PLAIN);
|
||||
free(id);
|
||||
}
|
||||
|
||||
plugins_post_room_message_send(mucwin->roomjid, plugin_msg);
|
||||
@@ -367,9 +368,10 @@ cl_ev_send_muc_msg(ProfMucWin *mucwin, const char *const msg, const char *const
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_OMEMO
|
||||
message_send_groupchat(mucwin->roomjid, plugin_msg, oob_url);
|
||||
char *id = message_send_groupchat(mucwin->roomjid, plugin_msg, oob_url);
|
||||
groupchat_log_msg_out(mucwin->roomjid, plugin_msg);
|
||||
mucwin_outgoing_msg(mucwin, plugin_msg, id, PROF_MSG_PLAIN, request_receipt);
|
||||
mucwin_outgoing_msg(mucwin, plugin_msg, id, PROF_MSG_PLAIN);
|
||||
free(id);
|
||||
|
||||
plugins_post_room_message_send(mucwin->roomjid, plugin_msg);
|
||||
free(plugin_msg);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -48,7 +48,7 @@ void sv_ev_room_subject(const char *const room, const char *const nick, const ch
|
||||
void sv_ev_room_history(const char *const room_jid, const char *const nick,
|
||||
GDateTime *timestamp, const char *const message, gboolean omemo);
|
||||
void sv_ev_room_message(const char *const room_jid, const char *const nick,
|
||||
const char *const message, gboolean omemo);
|
||||
const char *const message, const char *const id, gboolean omemo);
|
||||
void sv_ev_incoming_message(char *barejid, char *resource, char *message, char *pgp_message, GDateTime *timestamp, gboolean omemo);
|
||||
void sv_ev_incoming_private_message(const char *const fulljid, char *message);
|
||||
void sv_ev_delayed_private_message(const char *const fulljid, char *message, GDateTime *timestamp);
|
||||
|
||||
Reference in New Issue
Block a user