Comparison

plugins/mod_groups.lua @ 5747:23076ee191d3

rostermanager, mod_groups: Change roster-load event to pass an event table for consistency
author Matthew Wild <mwild1@gmail.com>
date Mon, 15 Jul 2013 11:43:23 +0100
parent 5418:7f270fbf3361
child 5776:bd0ff8ae98a8
comparison
equal deleted inserted replaced
5746:3137751751b4 5747:23076ee191d3
15 local jid, datamanager = require "util.jid", require "util.datamanager"; 15 local jid, datamanager = require "util.jid", require "util.datamanager";
16 local jid_prep = jid.prep; 16 local jid_prep = jid.prep;
17 17
18 local module_host = module:get_host(); 18 local module_host = module:get_host();
19 19
20 function inject_roster_contacts(username, host, roster) 20 function inject_roster_contacts(event)
21 local username, host= event.username, event.host;
21 --module:log("debug", "Injecting group members to roster"); 22 --module:log("debug", "Injecting group members to roster");
22 local bare_jid = username.."@"..host; 23 local bare_jid = username.."@"..host;
23 if not members[bare_jid] and not members[false] then return; end -- Not a member of any groups 24 if not members[bare_jid] and not members[false] then return; end -- Not a member of any groups
24 25
26 local roster = event.roster;
25 local function import_jids_to_roster(group_name) 27 local function import_jids_to_roster(group_name)
26 for jid in pairs(groups[group_name]) do 28 for jid in pairs(groups[group_name]) do
27 -- Add them to roster 29 -- Add them to roster
28 --module:log("debug", "processing jid %s in group %s", tostring(jid), tostring(group_name)); 30 --module:log("debug", "processing jid %s in group %s", tostring(jid), tostring(group_name));
29 if jid ~= bare_jid then 31 if jid ~= bare_jid then