Changeset

2262:83823ba8de40

Merge with 0.6.
author Waqas Hussain <waqas20@gmail.com>
date Sun, 29 Nov 2009 18:29:19 +0500
parents 2258:e4c5d0d21ac7 (current diff) 2261:13d55c66bf81 (diff)
children 2263:ff881b857c98
files
diffstat 3 files changed, 12 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/core/xmlhandlers.lua	Sat Nov 28 18:58:58 2009 +0100
+++ b/core/xmlhandlers.lua	Sun Nov 29 18:29:19 2009 +0500
@@ -50,7 +50,7 @@
 				chardata = {};
 			end
 			local curr_ns,name = tagname:match("^([^\1]*)\1?(.*)$");
-			if not name then
+			if name == "" then
 				curr_ns, name = "", curr_ns;
 			end
 
@@ -63,7 +63,7 @@
 				local k = attr[i];
 				attr[i] = nil;
 				local ns, nm = k:match("^([^\1]*)\1?(.*)$");
-				if ns and nm then
+				if nm ~= "" then
 					ns = ns_prefixes[ns]; 
 					if ns then 
 						attr[ns..":"..nm] = attr[k];
@@ -105,7 +105,7 @@
 		end
 		function xml_handlers:EndElement(tagname)
 			local curr_ns,name = tagname:match("^([^\1]*)\1?(.*)$");
-			if not name then
+			if name == "" then
 				curr_ns, name = "", curr_ns;
 			end
 			if (not stanza) or (#stanza.last_add > 0 and name ~= stanza.last_add[#stanza.last_add].name) then 
--- a/plugins/mod_presence.lua	Sat Nov 28 18:58:58 2009 +0100
+++ b/plugins/mod_presence.lua	Sun Nov 29 18:29:19 2009 +0500
@@ -220,11 +220,11 @@
 				-- 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="unsubscribed"}));
+			core_route_stanza(hosts[host], st.presence({from=to_bare, to=from_bare, type="unsubscribed"}));
 		end
 	elseif stanza.attr.type == "subscribe" then
 		if rostermanager.is_contact_subscribed(node, host, from_bare) then
-			core_route_stanza(origin, st.presence({from=to_bare, to=from_bare, type="subscribed"})); -- already subscribed
+			core_route_stanza(hosts[host], st.presence({from=to_bare, to=from_bare, type="subscribed"})); -- already subscribed
 			-- Sending presence is not clearly stated in the RFC, but it seems appropriate
 			if 0 == send_presence_of_available_resources(node, host, from_bare, origin, core_route_stanza) then
 				-- TODO send last recieved unavailable presence (or we MAY do nothing, which is fine too)
--- a/plugins/mod_register.lua	Sat Nov 28 18:58:58 2009 +0100
+++ b/plugins/mod_register.lua	Sun Nov 29 18:29:19 2009 +0500
@@ -43,21 +43,21 @@
 					session:close({condition = "not-authorized", text = "Account deleted"});
 				end
 				-- TODO datamanager should be able to delete all user data itself
-				datamanager.store(username, host, "roster", nil);
 				datamanager.store(username, host, "vcard", nil);
 				datamanager.store(username, host, "private", nil);
 				datamanager.store(username, host, "offline", nil);
-				--local bare = username.."@"..host;
+				local bare = username.."@"..host;
 				for jid, item in pairs(roster) do
-					if jid ~= "pending" then
-						if item.subscription == "both" or item.subscription == "to" then
-							-- TODO unsubscribe
+					if jid and jid ~= "pending" then
+						if item.subscription == "both" or item.subscription == "from" or (roster.pending and roster.pending[jid]) then
+							core_post_stanza(hosts[host], st.presence({type="unsubscribed", from=bare, to=jid}));
 						end
-						if item.subscription == "both" or item.subscription == "from" then
-							-- TODO unsubscribe
+						if item.subscription == "both" or item.subscription == "to" or item.ask then
+							core_post_stanza(hosts[host], st.presence({type="unsubscribe", from=bare, to=jid}));
 						end
 					end
 				end
+				datamanager.store(username, host, "roster", nil);
 				datamanager.store(username, host, "accounts", nil); -- delete accounts datastore at the end
 				module:log("info", "User removed their account: %s@%s", username, host);
 				module:fire_event("user-deregistered", { username = username, host = host, source = "mod_register", session = session });