plugins/mod_roster.lua

Thu, 09 Oct 2008 00:50:45 +0100

author
Matthew Wild <mwild1@gmail.com>
date
Thu, 09 Oct 2008 00:50:45 +0100
changeset 90
da468ed49a7b
parent 79
2766e23c4d7d
child 102
a5b914370db5
permissions
-rw-r--r--

Stanza preserialize/deserialize helpers, to strip and restore stanzas respectively. Fixed mod_vcard to use these.


local st = require "util.stanza"
local send = require "core.sessionmanager".send_to_session

add_iq_handler("c2s", "jabber:iq:roster", 
		function (session, stanza)
			if stanza.attr.type == "get" then
				local roster = st.reply(stanza)
							:query("jabber:iq:roster");
				for jid in pairs(session.roster) do
					roster:tag("item", { jid = jid, subscription = "none" }):up();
				end
				send(session, roster);
				return true;
			end
		end);

mercurial