changeset 3250:5801b5cf8f54

mod_pubsub_text_interface: Ignore whitespace after all commands Case insensitivity only on command name, not the node
author Kim Alvefur <zash@zash.se>
date Mon, 20 Aug 2018 23:20:01 +0200
parents 8f4a7084c466
children 60821653c5a9
files mod_pubsub_text_interface/mod_pubsub_text_interface.lua
diffstat 1 files changed, 3 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/mod_pubsub_text_interface/mod_pubsub_text_interface.lua	Mon Aug 20 23:18:43 2018 +0200
+++ b/mod_pubsub_text_interface/mod_pubsub_text_interface.lua	Mon Aug 20 23:20:01 2018 +0200
@@ -19,7 +19,6 @@
 	local origin, stanza = event.origin, event.stanza;
 	local body = stanza:get_child_text("body");
 	if not body then return end -- bail out
-	body = body:lower();
 
 	local from = stanza.attr.from;
 
@@ -27,10 +26,11 @@
 	reply.attr.id = id.medium();
 
 	local command, node_arg = body:match("^(%a+)%s+(.*)");
+	command = (command or body):lower();
 
-	if body == "help" then
+	if command == "help" then
 		reply:body(help);
-	elseif body == "list" then
+	elseif command == "list" then
 		local ok, nodes = pubsub:get_nodes(from);
 		if ok then
 			local list = {};