aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/mod_roster.lua
blob: 962c6c707a7acf266dd2ba651143ad719b92484a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16

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);