Changeset

9532:9bb33edd7255

MUC: Add function to retrieve affiliation data for a given JID
author Matthew Wild <mwild1@gmail.com>
date Sun, 21 Oct 2018 16:18:10 +0100
parents 9531:f2d70dc13700
children 9533:00a8e627854e
files plugins/muc/muc.lib.lua
diffstat 1 files changed, 9 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/muc/muc.lib.lua	Sun Oct 21 16:17:55 2018 +0100
+++ b/plugins/muc/muc.lib.lua	Sun Oct 21 16:18:10 2018 +0100
@@ -1346,6 +1346,15 @@
 	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;