« get me outta code hell

mtui - Music Text User Interface - user-friendly command line music player
about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--socket.js13
1 files changed, 10 insertions, 3 deletions
diff --git a/socket.js b/socket.js
index 1e25e6c..e6ebc57 100644
--- a/socket.js
+++ b/socket.js
@@ -372,10 +372,17 @@ export 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
       }