From 2410d3246c6caf796866e875240b4c2b6278312a Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Fri, 12 Oct 2012 18:33:24 +0200 Subject: mod_admin_telnet: user:list() check that the given host exists --- plugins/mod_admin_telnet.lua | 2 ++ 1 file changed, 2 insertions(+) (limited to 'plugins') diff --git a/plugins/mod_admin_telnet.lua b/plugins/mod_admin_telnet.lua index 9d3186d6..9e8d00ec 100644 --- a/plugins/mod_admin_telnet.lua +++ b/plugins/mod_admin_telnet.lua @@ -956,6 +956,8 @@ end function def_env.user:list(host) if not host then return nil, "No host given"; + elseif not hosts[host] then + return nil, "No such host"; end local print = self.session.print; for user in um.users(host) do -- cgit v1.2.3 From f875ce793f8c0a8ad7f671420df1d9746f61d12d Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Fri, 12 Oct 2012 18:49:22 +0200 Subject: mod_admin_telnet: user:list(): Allow filtering the set of users --- plugins/mod_admin_telnet.lua | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'plugins') diff --git a/plugins/mod_admin_telnet.lua b/plugins/mod_admin_telnet.lua index 9e8d00ec..e9d595ba 100644 --- a/plugins/mod_admin_telnet.lua +++ b/plugins/mod_admin_telnet.lua @@ -228,7 +228,7 @@ function commands.help(session, data) print [[user:create(jid, password) - Create the specified user account]] print [[user:password(jid, password) - Set the password for the specified user account]] print [[user:delete(jid) - Permanently remove the specified user account]] - print [[user:list(hostname) - List users on the specified host]] + print [[user:list(hostname, pattern) - List users on the specified host, optionally filtering with a pattern]] elseif section == "server" then print [[server:version() - Show the server's version number]] print [[server:uptime() - Show how long the server has been running]] @@ -953,17 +953,21 @@ function def_env.user:password(jid, password) end end -function def_env.user:list(host) +function def_env.user:list(host, pat) if not host then return nil, "No host given"; elseif not hosts[host] then return nil, "No such host"; end local print = self.session.print; + local count = 0; for user in um.users(host) do - print(user.."@"..host); + if not pat or user:match(pat) then + print(user.."@"..host); + end + count = count + 1; end - return true; + return true, count .. " users total"; end def_env.xmpp = {}; -- cgit v1.2.3 From da0876f26f4ee0a706e5c5fcc45d469f23aeabc8 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Sat, 13 Oct 2012 15:21:59 +0200 Subject: mod_motd: Don't trigger on directed presence or stanzas from s2s. --- plugins/mod_motd.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'plugins') diff --git a/plugins/mod_motd.lua b/plugins/mod_motd.lua index ddde9c78..fea2cb85 100644 --- a/plugins/mod_motd.lua +++ b/plugins/mod_motd.lua @@ -20,7 +20,8 @@ motd_text = motd_text:gsub("^%s*(.-)%s*$", "%1"):gsub("\n%s+", "\n"); -- Strip i module:hook("presence/bare", function (event) local session, stanza = event.origin, event.stanza; - if not session.presence and not stanza.attr.type then + if session.username and not session.presence + and 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); -- cgit v1.2.3 From 4eb35217eeaf518875fa0c4f42f492970931cb3c Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Sun, 14 Oct 2012 21:03:52 +0200 Subject: mod_pep: Remove unused imports --- plugins/mod_pep.lua | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'plugins') diff --git a/plugins/mod_pep.lua b/plugins/mod_pep.lua index c2261e5f..a65ee903 100644 --- a/plugins/mod_pep.lua +++ b/plugins/mod_pep.lua @@ -10,10 +10,8 @@ local jid_bare = require "util.jid".bare; local jid_split = require "util.jid".split; local st = require "util.stanza"; -local hosts = hosts; -local user_exists = require "core.usermanager".user_exists; local is_contact_subscribed = require "core.rostermanager".is_contact_subscribed; -local pairs, ipairs = pairs, ipairs; +local pairs = pairs; local next = next; local type = type; local calculate_hash = require "util.caps".calculate_hash; -- cgit v1.2.3 From 6da5020684d3f7b8ea69afb0c65ea3d8b46f137a Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Sun, 14 Oct 2012 21:04:46 +0200 Subject: mod_presence: Fix indentation --- plugins/mod_presence.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'plugins') diff --git a/plugins/mod_presence.lua b/plugins/mod_presence.lua index 077bc31f..20d0adf0 100644 --- a/plugins/mod_presence.lua +++ b/plugins/mod_presence.lua @@ -116,8 +116,8 @@ function handle_normal_presence(origin, stanza) end if priority >= 0 then - local event = { origin = origin } - module:fire_event('message/offline/broadcast', event); + local event = { origin = origin } + module:fire_event('message/offline/broadcast', event); end end if stanza.attr.type == "unavailable" then -- cgit v1.2.3