« get me outta code hell

actually set hasAnnouncedJoin on server lol - mtui - Music Text User Interface - user-friendly command line music player
about summary refs log tree commit diff
diff options
context:
space:
mode:
author(quasar) nebula <towerofnix@gmail.com>2021-04-25 10:36:16 -0300
committer(quasar) nebula <towerofnix@gmail.com>2021-04-25 10:36:29 -0300
commit2705e786bb7c62ac644e67132ddb5bc60215b4fe (patch)
tree395232eb18c2e23fa9d04735a636064a420e6f3d
parent81b76487ee443bb81e9dd15c942e52a8772d7f55 (diff)
actually set hasAnnouncedJoin on server lol
-rw-r--r--socket.js13
1 files changed, 10 insertions, 3 deletions
diff --git a/socket.js b/socket.js
index f20edae..d928b61 100644
--- a/socket.js
+++ b/socket.js
@@ -379,10 +379,17 @@ function makeSocketServer() {
         nickname = command.nickname
       }
 
-      // If the socket hasn't announced its joining yet - and this isn't the
-      // command where it does so - don't relay the command.
+      // If it's an 'announce-join' command, mark the variable for this!
 
-      if (!hasAnnouncedJoin && command.code !== 'announce-join') {
+      if (command.code === 'announce-join') {
+        hasAnnouncedJoin = true;
+      }
+
+      // If the socket hasn't announced its joining yet, don't relay the
+      // command. (Since hasAnnouncedJoin gets set above, 'announce-join'
+      // will meet this condition.)
+
+      if (!hasAnnouncedJoin) {
         return
       }