plugins/roster.lua

Thu, 28 Oct 2010 19:37:22 +0100

author
Kim Alvefur <zash@zash.se>
date
Thu, 28 Oct 2010 19:37:22 +0100
changeset 149
f5c524412939
parent 82
f306c2f8bb88
child 192
d20feb8034f5
permissions
-rw-r--r--

plugins.private: Private XML storage support

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

mercurial