Software /
code /
prosody
Changeset
8644:3b28c7728e3f
mod_roster: Iterate over roster group items in more modern manner
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Wed, 21 Mar 2018 23:15:30 +0100 |
parents | 8643:11b6aa30b3e0 |
children | 8645:06c73b010488 |
files | plugins/mod_roster.lua |
diffstat | 1 files changed, 5 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/plugins/mod_roster.lua Wed Mar 21 22:13:11 2018 +0000 +++ b/plugins/mod_roster.lua Wed Mar 21 23:15:30 2018 +0100 @@ -11,9 +11,8 @@ 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 @@ 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);