Changeset

5064:7a1eb302c562

MUC: Give host and server admins "owner" affiliation in all rooms.
author Waqas Hussain <waqas20@gmail.com>
date Wed, 01 Aug 2012 01:36:30 +0500
parents 5063:4bc202a7b351
children 5065:acfaf771f10e
files plugins/muc/mod_muc.lua
diffstat 1 files changed, 13 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/muc/mod_muc.lua	Wed Aug 01 01:36:25 2012 +0500
+++ b/plugins/muc/mod_muc.lua	Wed Aug 01 01:36:30 2012 +0500
@@ -22,7 +22,8 @@
 		restrict_room_creation = nil;
 	end
 end
-local muc_new_room = module:require "muc".new_room;
+local muclib = module:require "muc";
+local muc_new_room = muclib.new_room;
 local jid_split = require "util.jid".split;
 local jid_bare = require "util.jid".bare;
 local st = require "util.stanza";
@@ -42,6 +43,17 @@
 	return um_is_admin(jid, module.host);
 end
 
+local _set_affiliation = muc_new_room.room_mt.set_affiliation;
+local _get_affiliation = muc_new_room.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);
+end
+
 local function room_route_stanza(room, stanza) module:send(stanza); end
 local function room_save(room, forced)
 	local node = jid_split(room.jid);