IMPORTANT: due to a drive failure, as of 13-Mar-2021, the Mercurial repository had to be re-mirrored, which changed every commit SHA. The old SHAs and trees are backed up in the vault branches. Please migrate to the new branches as soon as you can.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
prosody/plugins/mod_roster.lua

24 lines
817 B

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
session.roster = session.roster or rostermanager.getroster(session.username, session.host);
if session.roster == false then
send(session, st.reply(stanza)
:tag("error", { type = "wait" })
:tag("internal-server-error", { xmlns = "urn:ietf:params:xml:ns:xmpp-stanzas"}));
return true;
else session.roster = session.roster or {};
end
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);