Changeset

66:13d6d39f5952

clix.roster: List now lets you search on nickname and jid.
author Kim Alvefur <zash@zash.se>
date Mon, 10 Oct 2011 06:47:52 +0200
parents 65:65076d194b85
children 67:776d97484dc5
files clix/roster.lua
diffstat 1 files changed, 8 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- 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)