Comparison

plugins/mod_register.lua @ 3297:aa3725bbcde5

mod_register: Delete the offline store as a list, and delete the privacy store.
author Waqas Hussain <waqas20@gmail.com>
date Thu, 24 Jun 2010 03:47:35 +0500
parent 3296:5f57f2f81c02
child 3301:772fb30b28fb
comparison
equal deleted inserted replaced
3296:5f57f2f81c02 3297:aa3725bbcde5
44 session:close({condition = "not-authorized", text = "Account deleted"}); 44 session:close({condition = "not-authorized", text = "Account deleted"});
45 end 45 end
46 -- TODO datamanager should be able to delete all user data itself 46 -- TODO datamanager should be able to delete all user data itself
47 datamanager.store(username, host, "vcard", nil); 47 datamanager.store(username, host, "vcard", nil);
48 datamanager.store(username, host, "private", nil); 48 datamanager.store(username, host, "private", nil);
49 datamanager.store(username, host, "offline", nil); 49 datamanager.list_store(username, host, "offline", nil);
50 local bare = username.."@"..host; 50 local bare = username.."@"..host;
51 for jid, item in pairs(roster) do 51 for jid, item in pairs(roster) do
52 if jid and jid ~= "pending" then 52 if jid and jid ~= "pending" then
53 if item.subscription == "both" or item.subscription == "from" or (roster.pending and roster.pending[jid]) then 53 if item.subscription == "both" or item.subscription == "from" or (roster.pending and roster.pending[jid]) then
54 core_post_stanza(hosts[host], st.presence({type="unsubscribed", from=bare, to=jid})); 54 core_post_stanza(hosts[host], st.presence({type="unsubscribed", from=bare, to=jid}));
57 core_post_stanza(hosts[host], st.presence({type="unsubscribe", from=bare, to=jid})); 57 core_post_stanza(hosts[host], st.presence({type="unsubscribe", from=bare, to=jid}));
58 end 58 end
59 end 59 end
60 end 60 end
61 datamanager.store(username, host, "roster", nil); 61 datamanager.store(username, host, "roster", nil);
62 datamanager.store(username, host, "privacy", nil);
62 datamanager.store(username, host, "accounts", nil); -- delete accounts datastore at the end 63 datamanager.store(username, host, "accounts", nil); -- delete accounts datastore at the end
63 module:log("info", "User removed their account: %s@%s", username, host); 64 module:log("info", "User removed their account: %s@%s", username, host);
64 module:fire_event("user-deregistered", { username = username, host = host, source = "mod_register", session = session }); 65 module:fire_event("user-deregistered", { username = username, host = host, source = "mod_register", session = session });
65 else 66 else
66 local username = query:child_with_name("username"); 67 local username = query:child_with_name("username");