Merge with 0.6.

Thu, 26 Nov 2009 13:06:52 +0500

author
Waqas Hussain <waqas20@gmail.com>
date
Thu, 26 Nov 2009 13:06:52 +0500
changeset 2230
aa830ab55bbc
parent 2224
f2f0f9103c26 (current diff)
parent 2229
3b38ec879076 (diff)
child 2231
288832cdec52

Merge with 0.6.

--- a/.hgtags	Thu Nov 26 01:09:10 2009 +0000
+++ b/.hgtags	Thu Nov 26 13:06:52 2009 +0500
@@ -34,3 +34,5 @@
 e32593074602a785d152f9e153825f29db4d0973 0.5.2
 e32593074602a785d152f9e153825f29db4d0973 0.5.2
 5ae3209fefa2c8dc1c53d08c2c1caa340b8ec542 0.5.2
+1a99a3bf3ce6dbdfb362b7fd101d761fb3cc10af 0.6.0
+81b4e738e4d321b78274132f63a9aec7007e64eb 0.6.1
--- a/plugins/mod_presence.lua	Thu Nov 26 01:09:10 2009 +0000
+++ b/plugins/mod_presence.lua	Thu Nov 26 13:06:52 2009 +0500
@@ -200,9 +200,6 @@
 			rostermanager.roster_push(node, host, to_bare);
 		end
 		core_route_stanza(origin, stanza);
-		-- COMPAT: Some legacy clients keep displaying unsubscribed contacts as online unless an unavailable presence is sent:
-		send_presence_of_available_resources(node, host, to_bare, origin, core_route_stanza,
-			st.presence({ type="unavailable", from=from_bare, to=to_bare, id=stanza.attr.id }));
 	end
 	stanza.attr.from, stanza.attr.to = st_from, st_to;
 end
@@ -233,7 +230,7 @@
 				-- TODO send last recieved unavailable presence (or we MAY do nothing, which is fine too)
 			end
 		else
-			core_route_stanza(origin, st.presence({from=to_bare, to=from_bare, type="unavailable"})); -- acknowledging receipt
+			core_route_stanza(hosts[host], st.presence({from=to_bare, to=from_bare, type="unavailable"})); -- acknowledging receipt
 			if not rostermanager.is_contact_pending_in(node, host, from_bare) then
 				if rostermanager.set_contact_pending_in(node, host, from_bare) then
 					sessionmanager.send_to_available_resources(node, host, stanza);
--- a/plugins/mod_roster.lua	Thu Nov 26 01:09:10 2009 +0000
+++ b/plugins/mod_roster.lua	Thu Nov 26 13:06:52 2009 +0500
@@ -74,18 +74,20 @@
 						if not resource and host then
 							if jid ~= from_node.."@"..from_host then
 								if item.attr.subscription == "remove" then
-									local r_item = session.roster[jid];
+									local roster = session.roster;
+									local r_item = roster[jid];
 									if r_item then
+										local to_bare = node and (node.."@"..host) or host; -- bare JID
+										if r_item.subscription == "both" or r_item.subscription == "from" or (roster.pending and roster.pending[jid]) then
+											core_post_stanza(session, st.presence({type="unsubscribed", from=session.full_jid, to=to_bare}));
+										end
+										if r_item.subscription == "both" or r_item.subscription == "to" or r_item.ask then
+											core_post_stanza(session, st.presence({type="unsubscribe", from=session.full_jid, to=to_bare}));
+										end
 										local success, err_type, err_cond, err_msg = rm_remove_from_roster(session, jid);
 										if success then
 											session.send(st.reply(stanza));
 											rm_roster_push(from_node, from_host, jid);
-											local to_bare = node and (node.."@"..host) or host; -- bare JID
-											if r_item.subscription == "both" or r_item.subscription == "from" then
-												core_post_stanza(session, st.presence({type="unsubscribed", from=session.full_jid, to=to_bare}));
-											elseif r_item.subscription == "both" or r_item.subscription == "to" then
-												core_post_stanza(session, st.presence({type="unsubscribe", from=session.full_jid, to=to_bare}));
-											end
 										else
 											session.send(st.error_reply(stanza, err_type, err_cond, err_msg));
 										end

mercurial