gameServer2/src/server/actions.rs
changeset 12145 a482c7a5f6e3
parent 12144 589a2d7d3dc5
child 12146 8d8fb85bc09c
--- a/gameServer2/src/server/actions.rs	Wed Jan 25 23:48:23 2017 +0300
+++ b/gameServer2/src/server/actions.rs	Thu Jan 26 14:45:44 2017 +0300
@@ -12,6 +12,8 @@
     RemoveClient,
     ByeClient(String),
     ReactProtocolMessage(HWProtocolMessage),
+    CheckRegistered,
+    JoinLobby,
 }
 
 use self::Action::*;
@@ -32,6 +34,18 @@
         },
         ReactProtocolMessage(msg) =>
             handlers::handle(server, token, poll, msg),
+        CheckRegistered =>
+            if server.clients[token].protocolNumber > 0 && server.clients[token].nick != "" {
+            server.react(token, poll, vec![
+                JoinLobby,
+                ]);
+        },
+        JoinLobby => {
+            let msg_string = LobbyJoined(&[&server.clients[token].nick]).to_raw_protocol();
+            server.react(token, poll, vec![
+                SendMe(msg_string),
+                ]);
+        },
         //_ => unimplemented!(),
     }
 }