aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2018-03-21 23:15:30 +0100
committerKim Alvefur <zash@zash.se>2018-03-21 23:15:30 +0100
commit5535272ff7a5fb0846dbb0d9347b639d223e2f49 (patch)
treef77f1b8b0500147af77591b52728b6c5bb941538
parent1b20db5bd00c6a337c6b50987c6e47e5eb4649c8 (diff)
downloadprosody-5535272ff7a5fb0846dbb0d9347b639d223e2f49.tar.gz
prosody-5535272ff7a5fb0846dbb0d9347b639d223e2f49.zip
mod_roster: Iterate over roster group items in more modern manner
-rw-r--r--plugins/mod_roster.lua13
1 files changed, 5 insertions, 8 deletions
diff --git a/plugins/mod_roster.lua b/plugins/mod_roster.lua
index 24c50678..c6aa8b12 100644
--- a/plugins/mod_roster.lua
+++ b/plugins/mod_roster.lua
@@ -11,9 +11,8 @@ local st = require "util.stanza"
local jid_split = require "util.jid".split;
local jid_prep = require "util.jid".prep;
-local t_concat = table.concat;
local tonumber = tonumber;
-local pairs, ipairs = pairs, ipairs;
+local pairs = pairs;
local rm_load_roster = require "core.rostermanager".load_roster;
local rm_remove_from_roster = require "core.rostermanager".remove_from_roster;
@@ -96,12 +95,10 @@ module:hook("iq/self/jabber:iq:roster:query", function(event)
else
r_item.subscription = "none";
end
- for _, child in ipairs(item) do
- if child.name == "group" then
- local text = t_concat(child);
- if text and text ~= "" then
- r_item.groups[text] = true;
- end
+ for group in item:childtags("group") do
+ local text = group:get_text();
+ if text then
+ r_item.groups[text] = true;
end
end
local success, err_type, err_cond, err_msg = rm_add_to_roster(session, jid, r_item);