Don't accept corrections from MUC MAM

We don't know if they're from the same user as someone else could have joined with the same nickname after sender left
This commit is contained in:
Marvin W 2023-02-07 21:22:32 +01:00
parent 116682e311
commit 9c5e36020d
No known key found for this signature in database
GPG key ID: 072E9235DB996F2A

View file

@ -97,9 +97,10 @@ public class MessageCorrection : StreamInteractionModule, MessageListener {
public override async bool run(Entities.Message message, Xmpp.MessageStanza stanza, Conversation conversation) { public override async bool run(Entities.Message message, Xmpp.MessageStanza stanza, Conversation conversation) {
if (conversation.type_ != Conversation.Type.CHAT) { if (conversation.type_ != Conversation.Type.CHAT) {
// Don't process messages or corrections from MUC history // Don't process messages or corrections from MUC history or MUC MAM
DateTime? mam_delay = Xep.DelayedDelivery.get_time_for_message(stanza, message.from.bare_jid); DateTime? mam_delay = Xep.DelayedDelivery.get_time_for_message(stanza, message.from.bare_jid);
if (mam_delay != null) return false; if (mam_delay != null) return false;
if (Xmpp.MessageArchiveManagement.MessageFlag.get_flag(stanza) != null) return false;
} }
string? replace_id = Xep.LastMessageCorrection.get_replace_id(stanza); string? replace_id = Xep.LastMessageCorrection.get_replace_id(stanza);