Changeset

9730:69ef22961b7d

Merge 0.11->trunk
author Kim Alvefur <zash@zash.se>
date Sun, 23 Dec 2018 15:34:19 +0100
parents 9727:9a35ae935390 (current diff) 9729:4f6413ec08a8 (diff)
children 9731:47121e8dc5b1
files spec/scansion/prosody.cfg.lua
diffstat 3 files changed, 48 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/mod_mam/mamprefsxml.lib.lua	Sun Dec 23 15:01:37 2018 +0100
+++ b/plugins/mod_mam/mamprefsxml.lib.lua	Sun Dec 23 15:34:19 2018 +0100
@@ -2,6 +2,7 @@
 -- Copyright (C) 2008-2017 Matthew Wild
 -- Copyright (C) 2008-2017 Waqas Hussain
 -- Copyright (C) 2011-2017 Kim Alvefur
+-- Copyright (C) 2018 Emmanuel Gil Peyrot
 --
 -- This project is MIT/X11 licensed. Please see the
 -- COPYING file in the source package for more information.
@@ -10,6 +11,7 @@
 --
 
 local st = require"util.stanza";
+local jid_prep = require"util.jid".prep;
 local xmlns_mam = "urn:xmpp:mam:2";
 
 local default_attrs = {
@@ -42,16 +44,20 @@
 	local always = prefstanza:get_child("always");
 	if always then
 		for rule in always:childtags("jid") do
-			local jid = rule:get_text();
-			prefs[jid] = true;
+			local jid = jid_prep(rule:get_text());
+			if jid then
+				prefs[jid] = true;
+			end
 		end
 	end
 
 	local never = prefstanza:get_child("never");
 	if never then
 		for rule in never:childtags("jid") do
-			local jid = rule:get_text();
-			prefs[jid] = false;
+			local jid = jid_prep(rule:get_text());
+			if jid then
+				prefs[jid] = false;
+			end
 		end
 	end
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/spec/scansion/mam_prefs_prep.scs	Sun Dec 23 15:34:19 2018 +0100
@@ -0,0 +1,36 @@
+# mod_mam shold apply JIDprep in prefs
+
+[Client] Romeo
+	jid: romeo@localhost
+	password: password
+
+-----
+
+Romeo connects
+
+Romeo sends:
+	<iq id="lx2" type="set">
+		<prefs xmlns="urn:xmpp:mam:2" default="roster">
+			<always>
+				<jid>JULIET@MONTAGUE.LIT</jid>
+			</always>
+			<never>
+				<jid>MONTAGUE@MONTAGUE.LIT</jid>
+			</never>
+		</prefs>
+	</iq>
+
+Romeo receives:
+	<iq id="lx2" type="result">
+		<prefs xmlns="urn:xmpp:mam:2" default="roster">
+			<always>
+				<jid>juliet@montague.lit</jid>
+			</always>
+			<never>
+				<jid>montague@montague.lit</jid>
+			</never>
+		</prefs>
+	</iq>
+
+Romeo disconnects
+
--- a/spec/scansion/prosody.cfg.lua	Sun Dec 23 15:01:37 2018 +0100
+++ b/spec/scansion/prosody.cfg.lua	Sun Dec 23 15:34:19 2018 +0100
@@ -26,7 +26,7 @@
 		"time"; -- Let others know the time here on this server
 		"ping"; -- Replies to XMPP pings with pongs
 		"register"; -- Allow users to register on this server using a client and change passwords
-		--"mam"; -- Store messages in an archive and allow users to access it
+		"mam"; -- Store messages in an archive and allow users to access it
 		--"csi_simple"; -- Simple Mobile optimizations
 
 	-- Admin interfaces
@@ -65,6 +65,7 @@
 
 storage = "memory"
 
+mam_smart_enable = true
 
 -- For the "sql" backend, you can uncomment *one* of the below to configure:
 --sql = { driver = "SQLite3", database = "prosody.sqlite" } -- Default. 'database' is the filename.