Bladeren bron

fix(breakout-rooms) cleanup code

master
Saúl Ibarra Corretgé 3 jaren geleden
bovenliggende
commit
1a93da8c35
1 gewijzigde bestanden met toevoegingen van 4 en 7 verwijderingen
  1. 4
    7
      resources/prosody-plugins/mod_muc_breakout_rooms.lua

+ 4
- 7
resources/prosody-plugins/mod_muc_breakout_rooms.lua Bestand weergeven

28
     return;
28
     return;
29
 end
29
 end
30
 
30
 
31
-local jid_bare = require 'util.jid'.bare;
32
 local jid_node = require 'util.jid'.node;
31
 local jid_node = require 'util.jid'.node;
33
 local jid_host = require 'util.jid'.host;
32
 local jid_host = require 'util.jid'.host;
34
-local jid_resource = require 'util.jid'.resource;
35
 local jid_split = require 'util.jid'.split;
33
 local jid_split = require 'util.jid'.split;
36
 local json = require 'util.json';
34
 local json = require 'util.json';
37
 local st = require 'util.stanza';
35
 local st = require 'util.stanza';
38
 local uuid_gen = require 'util.uuid'.generate;
36
 local uuid_gen = require 'util.uuid'.generate;
39
 
37
 
40
 local util = module:require 'util';
38
 local util = module:require 'util';
41
-local get_room_from_jid = util.get_room_from_jid;
42
 local is_healthcheck_room = util.is_healthcheck_room;
39
 local is_healthcheck_room = util.is_healthcheck_room;
43
 
40
 
44
 local BREAKOUT_ROOMS_IDENTITY_TYPE = 'breakout_rooms';
41
 local BREAKOUT_ROOMS_IDENTITY_TYPE = 'breakout_rooms';
69
 -- Utility functions
66
 -- Utility functions
70
 
67
 
71
 function get_main_room_jid(room_jid)
68
 function get_main_room_jid(room_jid)
72
-    local node, host = jid_split(room_jid);
69
+    local _, host = jid_split(room_jid);
73
 
70
 
74
 	return
71
 	return
75
         host == main_muc_component_config
72
         host == main_muc_component_config
338
     if not room then
335
     if not room then
339
         return false;
336
         return false;
340
     end
337
     end
341
-    for occupant_jid, occupant in room:each_occupant() do
338
+    for _, occupant in room:each_occupant() do
342
         if jid_node(occupant.jid) ~= 'focus' then
339
         if jid_node(occupant.jid) ~= 'focus' then
343
             return true;
340
             return true;
344
         end
341
         end
468
 
465
 
469
     host_module:hook("muc-config-form", function(event)
466
     host_module:hook("muc-config-form", function(event)
470
         local room = event.room;
467
         local room = event.room;
471
-        local main_room, main_room_jid = get_main_room(room.jid);
468
+        local _, main_room_jid = get_main_room(room.jid);
472
 
469
 
473
         -- Breakout room matadata.
470
         -- Breakout room matadata.
474
         table.insert(event.form, {
471
         table.insert(event.form, {
500
 
497
 
501
     -- we base affiliations (roles) in breakout rooms muc component to be based on the roles in the main muc
498
     -- we base affiliations (roles) in breakout rooms muc component to be based on the roles in the main muc
502
     room_mt.get_affiliation = function(room, jid)
499
     room_mt.get_affiliation = function(room, jid)
503
-        local main_room, main_room_jid = get_main_room(room.jid);
500
+        local main_room, _ = get_main_room(room.jid);
504
 
501
 
505
         if not main_room then
502
         if not main_room then
506
             module:log('error', 'No main room(%s) for %s!', room.jid, jid);
503
             module:log('error', 'No main room(%s) for %s!', room.jid, jid);

Laden…
Annuleren
Opslaan