Changeset

5172:3b93f92c613a

Merge 0.9 -> trunk
author Kim Alvefur <zash@zash.se>
date Sun, 14 Oct 2012 22:53:41 +0200
parents 5166:72cdc2d4e15e (current diff) 5171:b4b302fe415c (diff)
children 5174:42765c80244c
files
diffstat 4 files changed, 15 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/mod_admin_telnet.lua	Mon Oct 01 20:15:39 2012 +0100
+++ b/plugins/mod_admin_telnet.lua	Sun Oct 14 22:53:41 2012 +0200
@@ -228,7 +228,7 @@
 		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 @@
 	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 = {};
--- a/plugins/mod_motd.lua	Mon Oct 01 20:15:39 2012 +0100
+++ b/plugins/mod_motd.lua	Sun Oct 14 22:53:41 2012 +0200
@@ -20,7 +20,8 @@
 
 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);
--- a/plugins/mod_pep.lua	Mon Oct 01 20:15:39 2012 +0100
+++ b/plugins/mod_pep.lua	Sun Oct 14 22:53:41 2012 +0200
@@ -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;
--- a/plugins/mod_presence.lua	Mon Oct 01 20:15:39 2012 +0100
+++ b/plugins/mod_presence.lua	Sun Oct 14 22:53:41 2012 +0200
@@ -116,8 +116,8 @@
 		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