diff options
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/mod_admin_telnet.lua | 14 | ||||
-rw-r--r-- | plugins/mod_motd.lua | 3 | ||||
-rw-r--r-- | plugins/mod_pep.lua | 4 | ||||
-rw-r--r-- | plugins/mod_presence.lua | 4 |
4 files changed, 15 insertions, 10 deletions
diff --git a/plugins/mod_admin_telnet.lua b/plugins/mod_admin_telnet.lua index 9d3186d6..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,15 +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 = {}; 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); 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; 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 |