Software /
code /
prosody
Comparison
plugins/muc/mod_muc.lua @ 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 |
parent | 5062:88e198d65905 |
child | 5074:a87afeea8b48 |
comparison
equal
deleted
inserted
replaced
5063:4bc202a7b351 | 5064:7a1eb302c562 |
---|---|
20 restrict_room_creation = "admin"; | 20 restrict_room_creation = "admin"; |
21 elseif restrict_room_creation ~= "admin" and restrict_room_creation ~= "local" then | 21 elseif restrict_room_creation ~= "admin" and restrict_room_creation ~= "local" then |
22 restrict_room_creation = nil; | 22 restrict_room_creation = nil; |
23 end | 23 end |
24 end | 24 end |
25 local muc_new_room = module:require "muc".new_room; | 25 local muclib = module:require "muc"; |
26 local muc_new_room = muclib.new_room; | |
26 local jid_split = require "util.jid".split; | 27 local jid_split = require "util.jid".split; |
27 local jid_bare = require "util.jid".bare; | 28 local jid_bare = require "util.jid".bare; |
28 local st = require "util.stanza"; | 29 local st = require "util.stanza"; |
29 local uuid_gen = require "util.uuid".generate; | 30 local uuid_gen = require "util.uuid".generate; |
30 local datamanager = require "util.datamanager"; | 31 local datamanager = require "util.datamanager"; |
38 -- Configurable options | 39 -- Configurable options |
39 local max_history_messages = module:get_option_number("max_history_messages"); | 40 local max_history_messages = module:get_option_number("max_history_messages"); |
40 | 41 |
41 local function is_admin(jid) | 42 local function is_admin(jid) |
42 return um_is_admin(jid, module.host); | 43 return um_is_admin(jid, module.host); |
44 end | |
45 | |
46 local _set_affiliation = muc_new_room.room_mt.set_affiliation; | |
47 local _get_affiliation = muc_new_room.room_mt.get_affiliation; | |
48 function muclib.room_mt:get_affiliation(jid) | |
49 if is_admin(jid) then return "owner"; end | |
50 return _get_affiliation(self, jid); | |
51 end | |
52 function muclib.room_mt:set_affiliation(actor, jid, affiliation, callback, reason) | |
53 if is_admin(jid) then return nil, "modify", "not-acceptable";; end | |
54 return _set_affiliation(self, actor, jid, affiliation, callback, reason); | |
43 end | 55 end |
44 | 56 |
45 local function room_route_stanza(room, stanza) module:send(stanza); end | 57 local function room_route_stanza(room, stanza) module:send(stanza); end |
46 local function room_save(room, forced) | 58 local function room_save(room, forced) |
47 local node = jid_split(room.jid); | 59 local node = jid_split(room.jid); |