Diff

plugins/mod_roster.lua @ 177:606c433955e7

Bug fixes and checks for presence subscriptions, etc
author Waqas Hussain <waqas20@gmail.com>
date Sun, 26 Oct 2008 00:22:18 +0500
parent 132:9a4aa57af367
child 193:13ac34255c37
line wrap: on
line diff
--- a/plugins/mod_roster.lua	Sat Oct 25 21:16:08 2008 +0500
+++ b/plugins/mod_roster.lua	Sun Oct 26 00:22:18 2008 +0500
@@ -16,14 +16,16 @@
 					local roster = st.reply(stanza)
 								:query("jabber:iq:roster");
 					for jid in pairs(session.roster) do
-						roster:tag("item", {
-							jid = jid,
-							subscription = session.roster[jid].subscription,
-							ask = session.roster[jid].ask,
-							name = session.roster[jid].name,
-						});
-						for group in pairs(session.roster[jid].groups) do
-							roster:tag("group"):text(group):up();
+						if jid ~= "pending" then
+							roster:tag("item", {
+								jid = jid,
+								subscription = session.roster[jid].subscription,
+								ask = session.roster[jid].ask,
+								name = session.roster[jid].name,
+							});
+							for group in pairs(session.roster[jid].groups) do
+								roster:tag("group"):text(group):up();
+							end
 						end
 					end
 					send(session, roster);
@@ -32,7 +34,8 @@
 				elseif stanza.attr.type == "set" then
 					local query = stanza.tags[1];
 					if #query.tags == 1 and query.tags[1].name == "item"
-							and query.tags[1].attr.xmlns == "jabber:iq:roster" and query.tags[1].attr.jid then
+							and query.tags[1].attr.xmlns == "jabber:iq:roster" and query.tags[1].attr.jid
+							and query.tags[1].attr.jid ~= "pending" then
 						local item = query.tags[1];
 						local from_node, from_host = jid_split(stanza.attr.from);
 						local node, host, resource = jid_split(item.attr.jid);