rostermanager, mod_groups: Change roster-load event to pass an event table for consistency

This commit is contained in:
Matthew Wild 2013-07-15 11:43:23 +01:00
parent 7a8fd288b5
commit 71ab938d53
2 changed files with 4 additions and 2 deletions

View file

@ -100,7 +100,7 @@ function load_roster(username, host)
log("warn", "roster for %s has a self-contact", jid); log("warn", "roster for %s has a self-contact", jid);
end end
if not err then if not err then
hosts[host].events.fire_event("roster-load", username, host, roster); hosts[host].events.fire_event("roster-load", { username = username, host = host, roster = roster });
end end
return roster, err; return roster, err;
end end

View file

@ -17,11 +17,13 @@ local jid_prep = jid.prep;
local module_host = module:get_host(); local module_host = module:get_host();
function inject_roster_contacts(username, host, roster) function inject_roster_contacts(event)
local username, host= event.username, event.host;
--module:log("debug", "Injecting group members to roster"); --module:log("debug", "Injecting group members to roster");
local bare_jid = username.."@"..host; local bare_jid = username.."@"..host;
if not members[bare_jid] and not members[false] then return; end -- Not a member of any groups if not members[bare_jid] and not members[false] then return; end -- Not a member of any groups
local roster = event.roster;
local function import_jids_to_roster(group_name) local function import_jids_to_roster(group_name)
for jid in pairs(groups[group_name]) do for jid in pairs(groups[group_name]) do
-- Add them to roster -- Add them to roster