changeset 4044:f4999d75d305

Merge
author Matthew Wild <mwild1@gmail.com>
date Wed, 10 Jun 2020 22:20:00 +0100
parents 78ac5500a844 (diff) a533abe6ffd0 (current diff)
children 4fc6cf528a9a
files
diffstat 2 files changed, 15 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mod_measure_memory/mod_measure_memory.lua	Mon Jun 08 18:39:16 2020 +0200
+++ b/mod_measure_memory/mod_measure_memory.lua	Wed Jun 10 22:20:00 2020 +0100
@@ -5,7 +5,7 @@
 local measures = {};
 setmetatable(measures, {
 	__index = function (t, k)
-		local m = measure("amount", "memory."..k); t[k] = m; return m;
+		local m = measure("amount", "memory."..k, { units = "bytes" }); t[k] = m; return m;
 	end
 });
 
--- a/mod_pubsub_text_interface/mod_pubsub_text_interface.lua	Mon Jun 08 18:39:16 2020 +0200
+++ b/mod_pubsub_text_interface/mod_pubsub_text_interface.lua	Wed Jun 10 22:20:00 2020 +0100
@@ -4,6 +4,7 @@
 
 local pubsub = module:depends "pubsub".service;
 
+local xmlns_quick_resp = "urn:xmpp:tmp:quick-response";
 local name = module:get_option_string("name", "PubSub Service on "..module.host);
 local help = name..[[
 
@@ -33,6 +34,8 @@
 
 	if command == "help" then
 		reply:body(help);
+		reply:tag("response", { xmlns = xmlns_quick_resp, value = "list", }):up();
+		reply:tag("response", { xmlns = xmlns_quick_resp, value = "subscriptions", }):up();
 	elseif command == "list" then
 		local ok, nodes = pubsub:get_nodes(from);
 		if ok then
@@ -54,6 +57,8 @@
 			local response = {};
 			for i = 1, #subs do
 				response[i] = string.format("- `%s`", subs[i].node);
+				reply:tag("response", { xmlns = xmlns_quick_resp, value = "unsubscribe "..subs[i].node, }):up();
+				reply:tag("response", { xmlns = xmlns_quick_resp, value = "last "..subs[i].node, }):up();
 			end
 			reply:body(table.concat(response, "\n"));
 		end
@@ -77,6 +82,7 @@
 		end
 	else
 		reply:body("Unknown command. `help` to list commands.");
+		reply:tag("response", { xmlns = xmlns_quick_resp, value = "help", }):up();
 	end
 	reply:reset();
 
@@ -84,6 +90,14 @@
 		reply:tag("received", { xmlns = "urn:xmpp:receipts", id = stanza.attr.id }):up();
 	end
 
+	if stanza:get_child("no-copy", "urn:xmpp:hints") then
+		reply:tag("no-copy", { xmlns = "urn:xmpp:hints" }):up();
+	end
+
+	if stanza:get_child("no-store", "urn:xmpp:hints") then
+		reply:tag("no-store", { xmlns = "urn:xmpp:hints" }):up();
+	end
+
 	module:send(reply);
 	return true;
 end);