浏览代码

fix: Fixes lobby when allowners is enabled.

master
damencho 4 年前
父节点
当前提交
0067f6b077
共有 1 个文件被更改,包括 14 次插入1 次删除
  1. 14
    1
      resources/prosody-plugins/mod_muc_allowners.lua

+ 14
- 1
resources/prosody-plugins/mod_muc_allowners.lua 查看文件

1
 local filters = require 'util.filters';
1
 local filters = require 'util.filters';
2
 local jid = require "util.jid";
2
 local jid = require "util.jid";
3
 local jid_bare = require "util.jid".bare;
3
 local jid_bare = require "util.jid".bare;
4
+local jid_host = require "util.jid".host;
4
 local um_is_admin = require "core.usermanager".is_admin;
5
 local um_is_admin = require "core.usermanager".is_admin;
5
 local util = module:require "util";
6
 local util = module:require "util";
6
 local is_healthcheck_room = util.is_healthcheck_room;
7
 local is_healthcheck_room = util.is_healthcheck_room;
116
         return stanza;
117
         return stanza;
117
     end
118
     end
118
 
119
 
120
+    -- we want to filter presences only on this host for allowners and skip anything like lobby etc.
121
+    local host_from = jid_host(stanza.attr.from);
122
+    if host_from ~= module.host then
123
+        return stanza;
124
+    end
125
+
126
+    local bare_to = jid_bare(stanza.attr.to);
127
+    if stanza:get_error() and joining_moderator_participants[bare_to] then
128
+        -- pre-join succeeded but joined did not so we need to clear cache
129
+        joining_moderator_participants[bare_to] = nil;
130
+        return stanza;
131
+    end
132
+
119
     local muc_x = stanza:get_child('x', MUC_NS..'#user');
133
     local muc_x = stanza:get_child('x', MUC_NS..'#user');
120
     if not muc_x then
134
     if not muc_x then
121
         return stanza;
135
         return stanza;
122
     end
136
     end
123
 
137
 
124
-    local bare_to = jid_bare(stanza.attr.to);
125
     if joining_moderator_participants[bare_to] and presence_check_status(muc_x, '110') then
138
     if joining_moderator_participants[bare_to] and presence_check_status(muc_x, '110') then
126
         -- skip the local presence for participant
139
         -- skip the local presence for participant
127
         return nil;
140
         return nil;

正在加载...
取消
保存