aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/mod_register.lua
diff options
context:
space:
mode:
authorWaqas Hussain <waqas20@gmail.com>2009-11-29 18:29:19 +0500
committerWaqas Hussain <waqas20@gmail.com>2009-11-29 18:29:19 +0500
commitee490c5eabc83cb65e8fb2d83590fb62ba0c1140 (patch)
tree81fb5f90836938c9bff311d363840f11b62bb71f /plugins/mod_register.lua
parent513d6dfa4aaf3a68d89c4ecb150c3a89f25f8539 (diff)
parentbeb6fa2f210bbf8ea8d976f11728d20c5b41ad42 (diff)
downloadprosody-ee490c5eabc83cb65e8fb2d83590fb62ba0c1140.tar.gz
prosody-ee490c5eabc83cb65e8fb2d83590fb62ba0c1140.zip
Merge with 0.6.
Diffstat (limited to 'plugins/mod_register.lua')
-rw-r--r--plugins/mod_register.lua14
1 files changed, 7 insertions, 7 deletions
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 });