clix.roster: List now lets you search on nickname and jid.

Mon, 10 Oct 2011 06:47:52 +0200

author
Kim Alvefur <zash@zash.se>
date
Mon, 10 Oct 2011 06:47:52 +0200
changeset 66
13d6d39f5952
parent 65
65076d194b85
child 67
776d97484dc5

clix.roster: List now lets you search on nickname and jid.

clix/roster.lua file | annotate | diff | comparison | revisions
--- a/clix/roster.lua	Sun Aug 14 21:34:28 2011 +0200
+++ b/clix/roster.lua	Mon Oct 10 06:47:52 2011 +0200
@@ -63,10 +63,16 @@
 				end
 				conn.roster:add_contact(jid, item.name, groups, printor("saved"));
 			end;
-			list = function()
+			list = function(param)
+				if param == "" then
+					param = nil
+				end
 				for jid, item in pairs(conn.roster.items) do
 					local name, host = item.name or split_jid(jid);
-					print(name or host, jid, table.concat(item.groups or {}, ", "));
+					local groups = table.concat(item.groups or {}, ", ");
+					if not param or ( (name and name:match(param)) or jid:match(param) ) then
+						print(name or host, jid, groups);
+					end
 				end
 			end;
 			listgroups = function(param)

mercurial