aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2018-10-21 16:17:55 +0100
committerMatthew Wild <mwild1@gmail.com>2018-10-21 16:17:55 +0100
commit2e417768dcfab554e5211269a4fd1d4cbea7e6ef (patch)
tree4ae81cd686f46f91cf7e3c2e343ae7f7208927a9 /plugins
parent7b7f153a80fc0a113a6fcce7aa0a14212ce85c9e (diff)
downloadprosody-2e417768dcfab554e5211269a4fd1d4cbea7e6ef.tar.gz
prosody-2e417768dcfab554e5211269a4fd1d4cbea7e6ef.zip
MUC: Include affiliation data when iterating over affiliations with a room
Diffstat (limited to 'plugins')
-rw-r--r--plugins/muc/muc.lib.lua19
1 files changed, 8 insertions, 11 deletions
diff --git a/plugins/muc/muc.lib.lua b/plugins/muc/muc.lib.lua
index d8fd7128..4e1d32f2 100644
--- a/plugins/muc/muc.lib.lua
+++ b/plugins/muc/muc.lib.lua
@@ -1222,17 +1222,14 @@ end
-- Iterates over jid, affiliation pairs
function room_mt:each_affiliation(with_affiliation)
- if not with_affiliation then
- return pairs(self._affiliations);
- else
- return function(_affiliations, jid)
- local affiliation;
- repeat -- Iterate until we get a match
- jid, affiliation = next(_affiliations, jid);
- until jid == nil or affiliation == with_affiliation
- return jid, affiliation;
- end, self._affiliations, nil
- end
+ local _affiliations, _affiliation_data = self._affiliations, self._affiliation_data;
+ return function(_, jid)
+ local affiliation;
+ repeat -- Iterate until we get a match
+ jid, affiliation = next(_affiliations, jid);
+ until with_affiliation == nil or jid == nil or affiliation == with_affiliation
+ return jid, affiliation, _affiliation_data[jid];
+ end, nil, nil;
end
function room_mt:set_affiliation(actor, jid, affiliation, reason, data)