From 307f16cc86dd2b95aa02ab8a85110e4a2d5e7363 Mon Sep 17 00:00:00 2001 From: fiaxh Date: Tue, 10 Sep 2019 22:03:24 +0200 Subject: Fix check of source of MAM message --- xmpp-vala/src/module/xep/0313_message_archive_management.vala | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'xmpp-vala/src') diff --git a/xmpp-vala/src/module/xep/0313_message_archive_management.vala b/xmpp-vala/src/module/xep/0313_message_archive_management.vala index 674224c9..e99193a7 100644 --- a/xmpp-vala/src/module/xep/0313_message_archive_management.vala +++ b/xmpp-vala/src/module/xep/0313_message_archive_management.vala @@ -94,11 +94,16 @@ public class ReceivedPipelineListener : StanzaListener { public override string[] after_actions { get { return after_actions_const; } } public override async bool run(XmppStream stream, MessageStanza message) { - // if (message.from != stream.remote_name) return; if (stream.get_flag(Flag.IDENTITY) == null) return false; StanzaNode? message_node = message.stanza.get_deep_subnode(NS_VER(stream) + ":result", "urn:xmpp:forward:0:forwarded", Xmpp.NS_URI + ":message"); if (message_node != null) { + // MAM messages must come from our server // TODO or a MUC server + if (!message.from.equals(stream.get_flag(Bind.Flag.IDENTITY).my_jid.bare_jid)) { + warning("Received alledged MAM message from %s, ignoring", message.from.to_string()); + return true; + } + StanzaNode? forward_node = message.stanza.get_deep_subnode(NS_VER(stream) + ":result", "urn:xmpp:forward:0:forwarded", DelayedDelivery.NS_URI + ":delay"); DateTime? datetime = DelayedDelivery.Module.get_time_for_node(forward_node); message.add_flag(new MessageFlag(datetime)); -- cgit v1.2.3-70-g09d2