# HG changeset patch # User Kim Alvefur # Date 1534800001 -7200 # Node ID 5801b5cf8f540cef19ea453cf787f065fbbdeeff # Parent 8f4a7084c4662cac132ccb0b62de1f51fc443c68 mod_pubsub_text_interface: Ignore whitespace after all commands Case insensitivity only on command name, not the node diff -r 8f4a7084c466 -r 5801b5cf8f54 mod_pubsub_text_interface/mod_pubsub_text_interface.lua --- 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 = {};