Browse Source

Clean up ComponentVersions.

master
Boris Grozev 5 years ago
parent
commit
f4fc0ddc9a
1 changed files with 11 additions and 46 deletions
  1. 11
    46
      modules/version/ComponentsVersions.js

+ 11
- 46
modules/version/ComponentsVersions.js View File

2
 
2
 
3
 const logger = require('jitsi-meet-logger').getLogger(__filename);
3
 const logger = require('jitsi-meet-logger').getLogger(__filename);
4
 
4
 
5
-/**
6
- * The constant for the name of the focus component.
7
- * @type {string}
8
- */
9
-ComponentsVersions.FOCUS_COMPONENT = 'focus';
10
-
11
-/**
12
- * The constant for the name of the videobridge component.
13
- * @type {string}
14
- */
15
-ComponentsVersions.VIDEOBRIDGE_COMPONENT = 'videobridge';
16
-
17
-/**
18
- * The constant for the name of the XMPP server component.
19
- * @type {string}
20
- */
21
-ComponentsVersions.XMPP_SERVER_COMPONENT = 'xmpp';
22
-
23
 /**
5
 /**
24
  * Creates new instance of <tt>ComponentsVersions</tt> which will be discovering
6
  * Creates new instance of <tt>ComponentsVersions</tt> which will be discovering
25
  * the versions of conferencing system components in given
7
  * the versions of conferencing system components in given
34
 
16
 
35
     this.conference = conference;
17
     this.conference = conference;
36
     this.conference.addCommandListener(
18
     this.conference.addCommandListener(
37
-        'versions', this.processPresence.bind(this));
19
+        'versions', this.processVersions.bind(this));
38
 }
20
 }
39
 
21
 
40
-ComponentsVersions.prototype.processPresence
41
-    = function(node, mucResource, mucJid) {
42
-        if (node.attributes.xmlns !== 'http://jitsi.org/jitmeet') {
43
-            logger.warn('Ignored presence versions node - invalid xmlns', node);
44
-
45
-            return;
46
-        }
47
-
22
+ComponentsVersions.prototype.processVersions
23
+    = function(versions, mucResource, mucJid) {
48
         if (!this.conference._isFocus(mucJid)) {
24
         if (!this.conference._isFocus(mucJid)) {
49
             logger.warn(
25
             logger.warn(
50
-                `Received versions not from the focus user: ${node}`,
26
+                `Received versions not from the focus user: ${versions}`,
51
                 mucJid);
27
                 mucJid);
52
 
28
 
53
             return;
29
             return;
55
 
31
 
56
         const log = [];
32
         const log = [];
57
 
33
 
58
-        node.children.forEach(item => {
59
-
60
-            const componentName = item.attributes.name;
61
-
62
-            if (componentName !== ComponentsVersions.FOCUS_COMPONENT
63
-            && componentName !== ComponentsVersions.XMPP_SERVER_COMPONENT
64
-            && componentName !== ComponentsVersions.VIDEOBRIDGE_COMPONENT) {
65
-                logger.warn(
66
-                    `Received version for not supported component name: ${
67
-                        componentName}`);
68
-
69
-                return;
70
-            }
34
+        versions.children.forEach(component => {
71
 
35
 
72
-            const version = item.value;
36
+            const name = component.attributes.name;
37
+            const version = component.value;
73
 
38
 
74
-            if (this.versions[componentName] !== version) {
75
-                this.versions[componentName] = version;
76
-                logger.info(`Got ${componentName} version: ${version}`);
39
+            if (this.versions[name] !== version) {
40
+                this.versions[name] = version;
41
+                logger.info(`Got ${name} version: ${version}`);
77
 
42
 
78
                 log.push({
43
                 log.push({
79
                     id: 'component_version',
44
                     id: 'component_version',
80
-                    component: componentName,
45
+                    component: name,
81
                     version
46
                     version
82
                 });
47
                 });
83
             }
48
             }

Loading…
Cancel
Save