Bläddra i källkod

feat: Clean up immediately when room is not joined.

When receiving error like max occupants reached we have not joined the room, and there is no point of sending presence unavailable and check and clean after 5 secs.
master
damencho 2 år sedan
förälder
incheckning
6b71d39b21
1 ändrade filer med 12 tillägg och 4 borttagningar
  1. 12
    4
      modules/xmpp/ChatRoom.js

+ 12
- 4
modules/xmpp/ChatRoom.js Visa fil

@@ -1853,11 +1853,19 @@ export default class ChatRoom extends Listenable {
1853 1853
                 }
1854 1854
             };
1855 1855
 
1856
-            timeout = setTimeout(() => onMucLeft(true), 5000);
1856
+            if (this.joined) {
1857
+                timeout = setTimeout(() => onMucLeft(true), 5000);
1857 1858
 
1858
-            this.clean();
1859
-            this.eventEmitter.on(XMPPEvents.MUC_LEFT, onMucLeft);
1860
-            this.doLeave(reason);
1859
+                this.clean();
1860
+                this.eventEmitter.on(XMPPEvents.MUC_LEFT, onMucLeft);
1861
+                this.doLeave(reason);
1862
+            } else {
1863
+                // we are clearing up, and we haven't joined the room
1864
+                // there is no point of sending presence unavailable and check for timeout
1865
+                // let's just clean
1866
+                this.connection.emuc.doLeave(this.roomjid);
1867
+                this.clean();
1868
+            }
1861 1869
         }));
1862 1870
 
1863 1871
         return Promise.allSettled(promises);

Laddar…
Avbryt
Spara