Changeset

82:f306c2f8bb88

plugins.roster: Unfinished roster plugin
author Matthew Wild <mwild1@gmail.com>
date Fri, 02 Jul 2010 13:36:18 +0100
parents 81:0924a3d05e40
children 83:8221f3c25fd4
files plugins/roster.lua
diffstat 1 files changed, 19 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/plugins/roster.lua	Fri Jul 02 13:36:18 2010 +0100
@@ -0,0 +1,19 @@
+local xmlns_roster = "jabber:iq:roster";
+
+function verse.plugins.roster(stream)
+	function stream:roster_add(jid, callback)
+		self:send_iq(verse.iq({ type = "set" })
+			:tag("query", { xmlns = xmlns_roster })
+				:tag("item", { jid = jid }), function ()
+					callback();
+				end);
+	end
+	
+	function stream:roster_fetch(callback)
+		self:send_iq(verse.iq({type="get"}):tag("query", { xmlns = xmlns_roster }),
+			function (result)
+				--TODO: Pass parsed roster to callback
+				callback(result);
+			end);
+	end
+end