Software /
code /
prosody
Comparison
core/rostermanager.lua @ 5429:25333de6e7c7
rostermanager: do not save rosters for unexistant users.
author | Marco Cirillo <maranda@lightwitch.org> |
---|---|
date | Fri, 05 Apr 2013 04:52:11 +0000 |
parent | 5348:ca0d820e9318 |
child | 5747:23076ee191d3 |
child | 7777:65836cf2d057 |
comparison
equal
deleted
inserted
replaced
5428:4cc7df30f521 | 5429:25333de6e7c7 |
---|---|
16 | 16 |
17 local hosts = hosts; | 17 local hosts = hosts; |
18 local bare_sessions = bare_sessions; | 18 local bare_sessions = bare_sessions; |
19 | 19 |
20 local datamanager = require "util.datamanager" | 20 local datamanager = require "util.datamanager" |
21 local um_user_exists = require "core.usermanager".user_exists; | |
21 local st = require "util.stanza"; | 22 local st = require "util.stanza"; |
22 | 23 |
23 module "rostermanager" | 24 module "rostermanager" |
24 | 25 |
25 function add_to_roster(session, jid, item) | 26 function add_to_roster(session, jid, item) |
103 end | 104 end |
104 return roster, err; | 105 return roster, err; |
105 end | 106 end |
106 | 107 |
107 function save_roster(username, host, roster) | 108 function save_roster(username, host, roster) |
109 if not um_user_exists(username, host) then | |
110 log("debug", "not saving roster for %s@%s: the user doesn't exist", username, host); | |
111 return nil; | |
112 end | |
113 | |
108 log("debug", "save_roster: saving roster for %s@%s", username, host); | 114 log("debug", "save_roster: saving roster for %s@%s", username, host); |
109 if not roster then | 115 if not roster then |
110 roster = hosts[host] and hosts[host].sessions[username] and hosts[host].sessions[username].roster; | 116 roster = hosts[host] and hosts[host].sessions[username] and hosts[host].sessions[username].roster; |
111 --if not roster then | 117 --if not roster then |
112 -- --roster = load_roster(username, host); | 118 -- --roster = load_roster(username, host); |