clix/roster.lua

changeset 122
1dfd28db10bd
parent 121
896a25ed6b1b
child 123
c61fadb9d4fa
--- a/clix/roster.lua	Sun Aug 24 20:34:04 2014 +0100
+++ b/clix/roster.lua	Mon Sep 08 12:20:24 2014 +0200
@@ -70,7 +70,7 @@
 				for jid, item in pairs(conn.roster.items) do
 					local name, host = item.name or split_jid(jid);
 					local groups = table.concat(item.groups or {}, ", ");
-					if not param or ( (name and name:match(param)) or jid:match(param) ) then
+					if not param or ( (name and name:find(param, 1, true)) or jid:find(param, 1, true) ) then
 						print(jid, name or host, groups);
 					end
 				end
@@ -97,6 +97,17 @@
 					print(k,type(v) == "table" and table.concat(v, ", ") or v)
 				end
 			end;
+			export = function()
+				local stored_roster = { [false] = { version = conn.roster.ver } }
+				for jid, item in pairs(conn.roster.items) do
+					stored_roster[jid] = {
+						name = item.name;
+						subscription = item.subscription;
+						groups = { unpack(item.groups) };
+					}
+				end
+				print("return "..require"util.serialization".serialize(stored_roster));
+			end
 		}
 		function commands.help ()
 			print("Roster commands");

mercurial