Comparison

plugins/mod_groups.lua @ 10111:0f335815244f

plugins: Remove tostring call from logging Taken care of by loggingmanager now Mass-rewrite using lua pattern like `tostring%b()`
author Kim Alvefur <zash@zash.se>
date Tue, 30 Jul 2019 02:29:36 +0200
parent 8992:972b6f793ff9
child 12977:74b9e05af71e
comparison
equal deleted inserted replaced
10110:3fa3872588a8 10111:0f335815244f
23 23
24 local roster = event.roster; 24 local roster = event.roster;
25 local function import_jids_to_roster(group_name) 25 local function import_jids_to_roster(group_name)
26 for jid in pairs(groups[group_name]) do 26 for jid in pairs(groups[group_name]) do
27 -- Add them to roster 27 -- Add them to roster
28 --module:log("debug", "processing jid %s in group %s", tostring(jid), tostring(group_name)); 28 --module:log("debug", "processing jid %s in group %s", jid, group_name);
29 if jid ~= bare_jid then 29 if jid ~= bare_jid then
30 if not roster[jid] then roster[jid] = {}; end 30 if not roster[jid] then roster[jid] = {}; end
31 roster[jid].subscription = "both"; 31 roster[jid].subscription = "both";
32 if groups[group_name][jid] then 32 if groups[group_name][jid] then
33 roster[jid].name = groups[group_name][jid]; 33 roster[jid].name = groups[group_name][jid];
97 if not members[false] then 97 if not members[false] then
98 members[false] = {}; 98 members[false] = {};
99 end 99 end
100 members[false][#members[false]+1] = curr_group; -- Is a public group 100 members[false][#members[false]+1] = curr_group; -- Is a public group
101 end 101 end
102 module:log("debug", "New group: %s", tostring(curr_group)); 102 module:log("debug", "New group: %s", curr_group);
103 groups[curr_group] = groups[curr_group] or {}; 103 groups[curr_group] = groups[curr_group] or {};
104 else 104 else
105 -- Add JID 105 -- Add JID
106 local entryjid, name = line:match("([^=]*)=?(.*)"); 106 local entryjid, name = line:match("([^=]*)=?(.*)");
107 module:log("debug", "entryjid = '%s', name = '%s'", entryjid, name); 107 module:log("debug", "entryjid = '%s', name = '%s'", entryjid, name);
108 local jid; 108 local jid;
109 jid = jid_prep(entryjid:match("%S+")); 109 jid = jid_prep(entryjid:match("%S+"));
110 if jid then 110 if jid then
111 module:log("debug", "New member of %s: %s", tostring(curr_group), tostring(jid)); 111 module:log("debug", "New member of %s: %s", curr_group, jid);
112 groups[curr_group][jid] = name or false; 112 groups[curr_group][jid] = name or false;
113 members[jid] = members[jid] or {}; 113 members[jid] = members[jid] or {};
114 members[jid][#members[jid]+1] = curr_group; 114 members[jid][#members[jid]+1] = curr_group;
115 elseif entryjid:match("%S") then 115 elseif entryjid:match("%S") then
116 module:log("warn", "Invalid JID: %q", entryjid); 116 module:log("warn", "Invalid JID: %q", entryjid);