aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/muc/mod_muc.lua
diff options
context:
space:
mode:
authordaurnimator <quae@daurnimator.com>2014-04-28 16:30:53 -0400
committerdaurnimator <quae@daurnimator.com>2014-04-28 16:30:53 -0400
commita1421105a2eabc7b9c19a2ac7a4d4f372c6696cf (patch)
treeced1a21aa340730f5659d823ca89822c565b7f98 /plugins/muc/mod_muc.lua
parent36353e3edb63ffa2612b0101d6a6133c9994c263 (diff)
downloadprosody-a1421105a2eabc7b9c19a2ac7a4d4f372c6696cf.tar.gz
prosody-a1421105a2eabc7b9c19a2ac7a4d4f372c6696cf.zip
plugins/muc/mod_muc: Move affiliation monkey patch into own scope
Diffstat (limited to 'plugins/muc/mod_muc.lua')
-rw-r--r--plugins/muc/mod_muc.lua23
1 files changed, 13 insertions, 10 deletions
diff --git a/plugins/muc/mod_muc.lua b/plugins/muc/mod_muc.lua
index 865e07b9..2aa55a37 100644
--- a/plugins/muc/mod_muc.lua
+++ b/plugins/muc/mod_muc.lua
@@ -26,6 +26,7 @@ end
local muclib = module:require "muc";
local muc_new_room = muclib.new_room;
+room_mt = muclib.room_mt; -- Yes, global.
local persistent = module:require "muc/persistent";
local jid_split = require "util.jid".split;
local jid_bare = require "util.jid".bare;
@@ -52,16 +53,18 @@ local function is_admin(jid)
return um_is_admin(jid, module.host);
end
-room_mt = muclib.room_mt; -- Yes, global.
-local _set_affiliation = room_mt.set_affiliation;
-local _get_affiliation = room_mt.get_affiliation;
-function muclib.room_mt:get_affiliation(jid)
- if is_admin(jid) then return "owner"; end
- return _get_affiliation(self, jid);
-end
-function muclib.room_mt:set_affiliation(actor, jid, affiliation, callback, reason)
- if is_admin(jid) then return nil, "modify", "not-acceptable"; end
- return _set_affiliation(self, actor, jid, affiliation, callback, reason);
+do -- Monkey patch to make server admins room owners
+ local _get_affiliation = room_mt.get_affiliation;
+ function room_mt:get_affiliation(jid)
+ if is_admin(jid) then return "owner"; end
+ return _get_affiliation(self, jid);
+ end
+
+ local _set_affiliation = room_mt.set_affiliation;
+ function room_mt:set_affiliation(actor, jid, ...)
+ if is_admin(jid) then return nil, "modify", "not-acceptable"; end
+ return _set_affiliation(self, actor, jid, ...);
+ end
end
local function room_save(room, forced)