Selaa lähdekoodia

Do not deregister Strophe listener on missing room, fix removeCommandListener

dev1
Papp István Péter 6 vuotta sitten
vanhempi
commit
2d06c3e244
2 muutettua tiedostoa jossa 9 lisäystä ja 9 poistoa
  1. 3
    2
      JitsiConference.js
  2. 6
    7
      modules/xmpp/strophe.emuc.js

+ 3
- 2
JitsiConference.js Näytä tiedosto

685
 /**
685
 /**
686
   * Removes command  listener
686
   * Removes command  listener
687
   * @param command {String} the name of the command
687
   * @param command {String} the name of the command
688
+  * @param handler {Function} handler to remove for the command
688
   */
689
   */
689
-JitsiConference.prototype.removeCommandListener = function(command) {
690
+JitsiConference.prototype.removeCommandListener = function(command, handler) {
690
     if (this.room) {
691
     if (this.room) {
691
-        this.room.removePresenceListener(command);
692
+        this.room.removePresenceListener(command, handler);
692
     }
693
     }
693
 };
694
 };
694
 
695
 

+ 6
- 7
modules/xmpp/strophe.emuc.js Näytä tiedosto

91
         const room = this.rooms[Strophe.getBareJidFromJid(from)];
91
         const room = this.rooms[Strophe.getBareJidFromJid(from)];
92
 
92
 
93
         if (!room) {
93
         if (!room) {
94
-            return;
94
+            return true;
95
         }
95
         }
96
 
96
 
97
         // Parse status.
97
         // Parse status.
114
         const room = this.rooms[Strophe.getBareJidFromJid(from)];
114
         const room = this.rooms[Strophe.getBareJidFromJid(from)];
115
 
115
 
116
         if (!room) {
116
         if (!room) {
117
-            return;
117
+            return true;
118
         }
118
         }
119
 
119
 
120
         room.onPresenceUnavailable(pres, from);
120
         room.onPresenceUnavailable(pres, from);
131
         const room = this.rooms[Strophe.getBareJidFromJid(from)];
131
         const room = this.rooms[Strophe.getBareJidFromJid(from)];
132
 
132
 
133
         if (!room) {
133
         if (!room) {
134
-            return;
134
+            return true;
135
         }
135
         }
136
 
136
 
137
         room.onPresenceError(pres, from);
137
         room.onPresenceError(pres, from);
149
         const room = this.rooms[Strophe.getBareJidFromJid(from)];
149
         const room = this.rooms[Strophe.getBareJidFromJid(from)];
150
 
150
 
151
         if (!room) {
151
         if (!room) {
152
-            return;
152
+            return true;
153
         }
153
         }
154
 
154
 
155
         room.onMessage(msg, from);
155
         room.onMessage(msg, from);
165
         const from = iq.getAttribute('from');
165
         const from = iq.getAttribute('from');
166
         const room = this.rooms[Strophe.getBareJidFromJid(from)];
166
         const room = this.rooms[Strophe.getBareJidFromJid(from)];
167
 
167
 
168
-        // XXX What are the semantics of the return value? Why is it sometimes
169
-        // undefined and sometimes a boolean?
168
+        // Returning false would result in the listener being deregistered by Strophe
170
         if (!room) {
169
         if (!room) {
171
-            return;
170
+            return true;
172
         }
171
         }
173
 
172
 
174
         room.onMute(iq);
173
         room.onMute(iq);

Loading…
Peruuta
Tallenna