Software /
code /
prosody-modules
Changeset
1509:01e37ce7532e
mod_roster_command: Make sure hosts are only initialized once
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sat, 20 Sep 2014 11:33:49 +0200 (2014-09-20) |
parents | 1508:f7cb287dd3c7 |
children | 1510:094e9d5a4d94 |
files | mod_roster_command/mod_roster_command.lua |
diffstat | 1 files changed, 14 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/mod_roster_command/mod_roster_command.lua Sat Sep 20 11:31:41 2014 +0200 +++ b/mod_roster_command/mod_roster_command.lua Sat Sep 20 11:33:49 2014 +0200 @@ -33,12 +33,14 @@ warn("The host '%s' is not configured for this server.", user_host); return; end - storagemanager.initialize_host(user_host); - usermanager.initialize_host(user_host); + if hosts[user_host].users.name == "null" then + storagemanager.initialize_host(user_host); + usermanager.initialize_host(user_host); + end -- Update user's roster to say subscription request is pending... rostermanager.set_contact_pending_out(user_username, user_host, contact_jid); if hosts[contact_host] then - if contact_host ~= user_host then + if contact_host ~= user_host and hosts[contact_host].users.name == "null" then storagemanager.initialize_host(contact_host); usermanager.initialize_host(contact_host); end @@ -66,12 +68,14 @@ warn("The host '%s' is not configured for this server.", user_host); return; end - storagemanager.initialize_host(user_host); - usermanager.initialize_host(user_host); + if hosts[user_host].users.name == "null" then + storagemanager.initialize_host(user_host); + usermanager.initialize_host(user_host); + end -- Update user's roster to say subscription is cancelled... rostermanager.unsubscribe(user_username, user_host, contact_jid); if hosts[contact_host] then - if contact_host ~= user_host then + if contact_host ~= user_host and hosts[contact_host].users.name == "null" then storagemanager.initialize_host(contact_host); usermanager.initialize_host(contact_host); end @@ -93,8 +97,10 @@ warn("The host '%s' is not configured for this server.", user_host); return; end - storagemanager.initialize_host(user_host); - usermanager.initialize_host(user_host); + if hosts[user_host].users.name == "null" then + storagemanager.initialize_host(user_host); + usermanager.initialize_host(user_host); + end -- Load user's roster and find the contact local roster = rostermanager.load_roster(user_username, user_host);