aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2018-10-21 16:18:10 +0100
committerMatthew Wild <mwild1@gmail.com>2018-10-21 16:18:10 +0100
commitc952045eb67a4a4da78525c83c533258180c9e9d (patch)
treec2f8a63dfbc790f6522db8cae081107aae358a15
parent2e417768dcfab554e5211269a4fd1d4cbea7e6ef (diff)
downloadprosody-c952045eb67a4a4da78525c83c533258180c9e9d.tar.gz
prosody-c952045eb67a4a4da78525c83c533258180c9e9d.zip
MUC: Add function to retrieve affiliation data for a given JID
-rw-r--r--plugins/muc/muc.lib.lua9
1 files changed, 9 insertions, 0 deletions
diff --git a/plugins/muc/muc.lib.lua b/plugins/muc/muc.lib.lua
index 4e1d32f2..c6ebed8f 100644
--- a/plugins/muc/muc.lib.lua
+++ b/plugins/muc/muc.lib.lua
@@ -1346,6 +1346,15 @@ function room_mt:set_affiliation(actor, jid, affiliation, reason, data)
return true;
end
+function room_mt:get_affiliation_data(jid, key)
+ local data = self._affiliation_data[jid];
+ if not data then return nil; end
+ if key then
+ return data[key];
+ end
+ return data;
+end
+
function room_mt:get_role(nick)
local occupant = self:get_occupant_by_nick(nick);
return occupant and occupant.role or nil;