From de4aa7b47a2c991271943b5c12edfd567cf4de60 Mon Sep 17 00:00:00 2001 From: Waqas Hussain Date: Thu, 26 Nov 2009 15:19:59 +0500 Subject: mod_presence: Use the local host object as the origin for auto-generated subscription approvals and cancellations. --- plugins/mod_presence.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'plugins') diff --git a/plugins/mod_presence.lua b/plugins/mod_presence.lua index d3818a5d..abbc3a3d 100644 --- a/plugins/mod_presence.lua +++ b/plugins/mod_presence.lua @@ -220,11 +220,11 @@ function handle_inbound_presence_subscriptions_and_probes(origin, stanza, from_b -- 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) -- cgit v1.2.3 From 20937974626ff19fb5951f016ada12760c13ea15 Mon Sep 17 00:00:00 2001 From: Waqas Hussain Date: Sat, 28 Nov 2009 11:59:06 +0500 Subject: mod_register: Properly notify contacts of subscription removal on account deletion. --- plugins/mod_register.lua | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'plugins') diff --git a/plugins/mod_register.lua b/plugins/mod_register.lua index 2ae01fed..bda40124 100644 --- a/plugins/mod_register.lua +++ b/plugins/mod_register.lua @@ -43,21 +43,21 @@ module:add_iq_handler("c2s", "jabber:iq:register", function (session, stanza) 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 }); -- cgit v1.2.3