ソースを参照

fix: Fixes lobby when allowners is enabled.

j8
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,6 +1,7 @@
1 1
 local filters = require 'util.filters';
2 2
 local jid = require "util.jid";
3 3
 local jid_bare = require "util.jid".bare;
4
+local jid_host = require "util.jid".host;
4 5
 local um_is_admin = require "core.usermanager".is_admin;
5 6
 local util = module:require "util";
6 7
 local is_healthcheck_room = util.is_healthcheck_room;
@@ -116,12 +117,24 @@ function filter_stanza(stanza)
116 117
         return stanza;
117 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 133
     local muc_x = stanza:get_child('x', MUC_NS..'#user');
120 134
     if not muc_x then
121 135
         return stanza;
122 136
     end
123 137
 
124
-    local bare_to = jid_bare(stanza.attr.to);
125 138
     if joining_moderator_participants[bare_to] and presence_check_status(muc_x, '110') then
126 139
         -- skip the local presence for participant
127 140
         return nil;

読み込み中…
キャンセル
保存