Merge 0.10->trunk
authorKim Alvefur <zash@zash.se>
Wed, 17 May 2017 01:06:20 +0200
changeset 8149 5c91fb62338e
parent 8136 102e1ec8bee1 (current diff)
parent 8148 4d0f5ea19851 (diff)
child 8151 472219f85df6
Merge 0.10->trunk
plugins/mod_component.lua
plugins/mod_storage_sql.lua
prosodyctl
--- a/plugins/mod_component.lua	Wed Apr 26 11:55:27 2017 +0200
+++ b/plugins/mod_component.lua	Wed May 17 01:06:20 2017 +0200
@@ -66,7 +66,7 @@
 			return true;
 		end
 
-		local secret = module:get_option("component_secret");
+		local secret = module:get_option_string("component_secret");
 		if not secret then
 			(session.log or log)("warn", "Component attempted to identify as %s, but component_secret is not set", session.host);
 			session:close("not-authorized");
--- a/plugins/mod_mam/mod_mam.lua	Wed Apr 26 11:55:27 2017 +0200
+++ b/plugins/mod_mam/mod_mam.lua	Wed May 17 01:06:20 2017 +0200
@@ -123,7 +123,9 @@
 	end
 
 	module:log("debug", "Archive query, id %s with %s from %s until %s)",
-		tostring(qid), qwith or "anyone", qstart or "the dawn of time", qend or "now");
+		tostring(qid), qwith or "anyone",
+		qstart and timestamp(qstart) or "the dawn of time",
+		qend and timestamp(qend) or "now");
 
 	-- RSM stuff
 	local qset = rsm.get(query);
@@ -139,7 +141,7 @@
 		limit = qmax + 1;
 		before = before; after = after;
 		reverse = reverse;
-		total = get_total;
+		total = use_total;
 	});
 
 	if not data then
--- a/plugins/mod_message.lua	Wed Apr 26 11:55:27 2017 +0200
+++ b/plugins/mod_message.lua	Wed May 17 01:06:20 2017 +0200
@@ -48,11 +48,10 @@
 		local node, host = jid_split(bare);
 		local ok
 		if user_exists(node, host) then
-			-- TODO apply the default privacy list
-
 			ok = module:fire_event('message/offline/handle', {
-			    origin = origin,
-			    stanza = stanza,
+				username = node;
+				origin = origin,
+				stanza = stanza,
 			});
 		end
 
--- a/plugins/mod_motd.lua	Wed Apr 26 11:55:27 2017 +0200
+++ b/plugins/mod_motd.lua	Wed May 17 01:06:20 2017 +0200
@@ -17,10 +17,9 @@
 
 motd_text = motd_text:gsub("^%s*(.-)%s*$", "%1"):gsub("\n[ \t]+", "\n"); -- Strip indentation from the config
 
-module:hook("presence/bare", function (event)
+module:hook("presence/initial", function (event)
 		local session, stanza = event.origin, event.stanza;
-		if session.username and not session.presence
-		and not stanza.attr.type and not stanza.attr.to then
+		if not stanza.attr.type and not stanza.attr.to then
 			local motd_stanza =
 				st.message({ to = session.full_jid, from = motd_jid })
 					:tag("body"):text(motd_text);
--- a/plugins/mod_storage_internal.lua	Wed Apr 26 11:55:27 2017 +0200
+++ b/plugins/mod_storage_internal.lua	Wed May 17 01:06:20 2017 +0200
@@ -139,12 +139,19 @@
 		if k ~= "end" then return nil, "unsupported-query-field"; end
 	end
 	local items, err = datamanager.list_load(username, host, self.store);
-	if not items then return items, err; end
+	if not items then
+		if err then
+			return items, err;
+		end
+		-- Store is empty
+		return 0;
+	end
 	items = array(items);
+	local count_before = #items;
 	items:filter(function (item)
 		return item.when > query["end"];
 	end);
-	local count = #items;
+	local count = count_before - #items;
 	local ok, err = datamanager.list_store(username, host, self.store, items);
 	if not ok then return ok, err; end
 	return count;
--- a/plugins/mod_storage_sql.lua	Wed Apr 26 11:55:27 2017 +0200
+++ b/plugins/mod_storage_sql.lua	Wed May 17 01:06:20 2017 +0200
@@ -33,7 +33,7 @@
 		return "xml", tostring(value);
 	elseif t == "table" then
 		local encoded,err = json.encode(value);
-		if value then return "json", encoded; end
+		if encoded then return "json", encoded; end
 		return nil, err;
 	end
 	return nil, "Unhandled value type: "..t;
--- a/plugins/mod_websocket.lua	Wed Apr 26 11:55:27 2017 +0200
+++ b/plugins/mod_websocket.lua	Wed May 17 01:06:20 2017 +0200
@@ -334,7 +334,7 @@
 		-- This might be weird with random load order
 		local_cross_domain:exclude(cross_domain);
 		cross_domain:include(local_cross_domain);
-		module:log("debug", "cross_domain = %s", cross_domain);
+		module:log("debug", "cross_domain = %s", tostring(cross_domain));
 		function module.unload()
 			cross_domain:exclude(local_cross_domain);
 		end
--- a/prosodyctl	Wed Apr 26 11:55:27 2017 +0200
+++ b/prosodyctl	Wed May 17 01:06:20 2017 +0200
@@ -937,6 +937,10 @@
 		end
 	end
 	show_usage("cert config|request|generate|key|import", "Helpers for generating X.509 certificates and keys.")
+	for _, cmd in pairs(cert_commands) do
+		print()
+		cmd{ "--help" }
+	end
 end
 
 function commands.check(arg)