aboutsummaryrefslogtreecommitdiff
path: root/xmpp-vala
diff options
context:
space:
mode:
authorfiaxh <git@lightrise.org>2019-09-10 22:03:24 +0200
committerfiaxh <git@lightrise.org>2019-09-10 22:03:24 +0200
commit307f16cc86dd2b95aa02ab8a85110e4a2d5e7363 (patch)
tree560db11c218b188d26a662ad8290455c2fa055e5 /xmpp-vala
parente84f2c49567e86d2a261ea264d65c4adc549c930 (diff)
downloaddino-307f16cc86dd2b95aa02ab8a85110e4a2d5e7363.tar.gz
dino-307f16cc86dd2b95aa02ab8a85110e4a2d5e7363.zip
Fix check of source of MAM message
Diffstat (limited to 'xmpp-vala')
-rw-r--r--xmpp-vala/src/module/xep/0313_message_archive_management.vala7
1 files changed, 6 insertions, 1 deletions
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<MessageStanza> {
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));