comparison mod_roster_command/mod_roster_command.lua @ 1508:f7cb287dd3c7

mod_roster_command: Also initialize usermanager
author Kim Alvefur <zash@zash.se>
date Sat, 20 Sep 2014 11:31:41 +0200
parents f806c8a7f985
children 01e37ce7532e
comparison
equal deleted inserted replaced
1507:6ea13869753f 1508:f7cb287dd3c7
32 if not hosts[user_host] then 32 if not hosts[user_host] then
33 warn("The host '%s' is not configured for this server.", user_host); 33 warn("The host '%s' is not configured for this server.", user_host);
34 return; 34 return;
35 end 35 end
36 storagemanager.initialize_host(user_host); 36 storagemanager.initialize_host(user_host);
37 usermanager.initialize_host(user_host);
37 -- Update user's roster to say subscription request is pending... 38 -- Update user's roster to say subscription request is pending...
38 rostermanager.set_contact_pending_out(user_username, user_host, contact_jid); 39 rostermanager.set_contact_pending_out(user_username, user_host, contact_jid);
39 if hosts[contact_host] then 40 if hosts[contact_host] then
40 if contact_host ~= user_host then 41 if contact_host ~= user_host then
41 storagemanager.initialize_host(contact_host); 42 storagemanager.initialize_host(contact_host);
43 usermanager.initialize_host(contact_host);
42 end 44 end
43 -- Update contact's roster to say subscription request is pending... 45 -- Update contact's roster to say subscription request is pending...
44 rostermanager.set_contact_pending_in(contact_username, contact_host, user_jid); 46 rostermanager.set_contact_pending_in(contact_username, contact_host, user_jid);
45 -- Update contact's roster to say subscription request approved... 47 -- Update contact's roster to say subscription request approved...
46 rostermanager.subscribed(contact_username, contact_host, user_jid); 48 rostermanager.subscribed(contact_username, contact_host, user_jid);
63 if not hosts[user_host] then 65 if not hosts[user_host] then
64 warn("The host '%s' is not configured for this server.", user_host); 66 warn("The host '%s' is not configured for this server.", user_host);
65 return; 67 return;
66 end 68 end
67 storagemanager.initialize_host(user_host); 69 storagemanager.initialize_host(user_host);
70 usermanager.initialize_host(user_host);
68 -- Update user's roster to say subscription is cancelled... 71 -- Update user's roster to say subscription is cancelled...
69 rostermanager.unsubscribe(user_username, user_host, contact_jid); 72 rostermanager.unsubscribe(user_username, user_host, contact_jid);
70 if hosts[contact_host] then 73 if hosts[contact_host] then
71 if contact_host ~= user_host then 74 if contact_host ~= user_host then
72 storagemanager.initialize_host(contact_host); 75 storagemanager.initialize_host(contact_host);
76 usermanager.initialize_host(contact_host);
73 end 77 end
74 -- Update contact's roster to say subscription is cancelled... 78 -- Update contact's roster to say subscription is cancelled...
75 rostermanager.unsubscribed(contact_username, contact_host, user_jid); 79 rostermanager.unsubscribed(contact_username, contact_host, user_jid);
76 end 80 end
77 end 81 end
88 if not hosts[user_host] then 92 if not hosts[user_host] then
89 warn("The host '%s' is not configured for this server.", user_host); 93 warn("The host '%s' is not configured for this server.", user_host);
90 return; 94 return;
91 end 95 end
92 storagemanager.initialize_host(user_host); 96 storagemanager.initialize_host(user_host);
97 usermanager.initialize_host(user_host);
93 98
94 -- Load user's roster and find the contact 99 -- Load user's roster and find the contact
95 local roster = rostermanager.load_roster(user_username, user_host); 100 local roster = rostermanager.load_roster(user_username, user_host);
96 local item = roster[contact_jid]; 101 local item = roster[contact_jid];
97 if item then 102 if item then