Comparison

plugins/mod_roster.lua @ 79:2766e23c4d7d

Removed: Unnecessary check in mod_roster. session.roster is guaranteed to be available for "c2s" session type.
author Waqas Hussain <waqas20@gmail.com>
date Wed, 08 Oct 2008 20:38:05 +0500
parent 30:bcf539295f2d
child 102:a5b914370db5
comparison
equal deleted inserted replaced
78:972e31cc91e8 79:2766e23c4d7d
3 local send = require "core.sessionmanager".send_to_session 3 local send = require "core.sessionmanager".send_to_session
4 4
5 add_iq_handler("c2s", "jabber:iq:roster", 5 add_iq_handler("c2s", "jabber:iq:roster",
6 function (session, stanza) 6 function (session, stanza)
7 if stanza.attr.type == "get" then 7 if stanza.attr.type == "get" then
8 session.roster = session.roster or rostermanager.getroster(session.username, session.host);
9 if session.roster == false then
10 send(session, st.reply(stanza)
11 :tag("error", { type = "wait" })
12 :tag("internal-server-error", { xmlns = "urn:ietf:params:xml:ns:xmpp-stanzas"}));
13 return true;
14 else session.roster = session.roster or {};
15 end
16 local roster = st.reply(stanza) 8 local roster = st.reply(stanza)
17 :query("jabber:iq:roster"); 9 :query("jabber:iq:roster");
18 for jid in pairs(session.roster) do 10 for jid in pairs(session.roster) do
19 roster:tag("item", { jid = jid, subscription = "none" }):up(); 11 roster:tag("item", { jid = jid, subscription = "none" }):up();
20 end 12 end