diff mod_pubsub_text_interface/mod_pubsub_text_interface.lua @ 3248:ecec46f7d020

mod_pubsub_text_interface: Fix chain that accidentally produced nested <body>
author Kim Alvefur <zash@zash.se>
date Mon, 20 Aug 2018 22:58:30 +0200
parents ada7a0c7221c
children 8f4a7084c466
line wrap: on
line diff
--- a/mod_pubsub_text_interface/mod_pubsub_text_interface.lua	Mon Aug 20 22:52:20 2018 +0200
+++ b/mod_pubsub_text_interface/mod_pubsub_text_interface.lua	Mon Aug 20 22:58:30 2018 +0200
@@ -26,6 +26,8 @@
 	local reply = st.reply(stanza);
 	reply.attr.id = id.medium();
 
+	local command, node = body:match("^(%a+)%s+(.*)");
+
 	if body == "help" then
 		reply:body(help);
 	elseif body == "list" then
@@ -39,9 +41,7 @@
 		else
 			reply:body(nodes);
 		end
-	end
-	local command, node = body:match("^(%a+)%s+(.*)");
-	if command == "subscribe" then
+	elseif command == "subscribe" then
 		local ok, err = pubsub:add_subscription(node, from, jid.bare(from), { ["pubsub#include_body"] = true });
 		reply:body(ok and "OK" or err);
 	elseif command == "unsubscribe" then