소스 검색

Added a prosody plugin for making all users into muc owners in prosody

Included a patch to prosody-trunk which allows owners to kick each other
j8
Aaron van Meerten 8 년 전
부모
커밋
a5b706a99e
2개의 변경된 파일34개의 추가작업 그리고 0개의 파일을 삭제
  1. 13
    0
      prosody-plugins/mod_muc_allowners.lua
  2. 21
    0
      prosody-plugins/muc_owner_allow_kick.patch

+ 13
- 0
prosody-plugins/mod_muc_allowners.lua 파일 보기

@@ -0,0 +1,13 @@
1
+-- Copyright (c) 2015 &yet <https://andyet.com>
2
+-- https://github.com/otalk/mod_muc_allowners/blob/9a86266a25ed32ade150742cc79f5a1669765a8f/mod_muc_allowners.lua
3
+--
4
+-- Used under the terms of the MIT License
5
+-- https://github.com/otalk/mod_muc_allowners/blob/9a86266a25ed32ade150742cc79f5a1669765a8f/LICENSE
6
+
7
+local muc_service = module:depends("muc");
8
+local room_mt = muc_service.room_mt;
9
+
10
+
11
+room_mt.get_affiliation = function (room, jid)
12
+    return "owner";
13
+end

+ 21
- 0
prosody-plugins/muc_owner_allow_kick.patch 파일 보기

@@ -0,0 +1,21 @@
1
+--- muc.lib.lua	2016-10-26 18:26:53.432377291 +0000
2
++++ muc.lib.lua	2016-10-26 18:41:40.754426072 +0000
3
+@@ -1256,15 +1256,16 @@
4
+ 	if actor == true then
5
+ 		actor = nil -- So we can pass it safely to 'publicise_occupant_status' below
6
+ 	else
7
++		local actor_affiliation = self:get_affiliation(actor);
8
++
9
+ 		-- Can't do anything to other owners or admins
10
+ 		local occupant_affiliation = self:get_affiliation(occupant.bare_jid);
11
+-		if occupant_affiliation == "owner" or occupant_affiliation == "admin" then
12
++		if (occupant_affiliation == "owner" and actor_affiliation ~= "owner") or (occupant_affiliation == "admin" and actor_affiliation ~= "admin" and actor_affiliation ~= "owner") then
13
+ 			return nil, "cancel", "not-allowed";
14
+ 		end
15
+ 
16
+ 		-- If you are trying to give or take moderator role you need to be an owner or admin
17
+ 		if occupant.role == "moderator" or role == "moderator" then
18
+-			local actor_affiliation = self:get_affiliation(actor);
19
+ 			if actor_affiliation ~= "owner" and actor_affiliation ~= "admin" then
20
+ 				return nil, "cancel", "not-allowed";
21
+ 			end

Loading…
취소
저장