Use new LogIn server message, make sure the user is logged in after sending them the welcome message (so that they don't see themselves in the room) and broadcast the new LogIn message (to everyone including the newcomer)
This commit is contained in:
parent
9e228c7e94
commit
019909ba61
1 changed files with 4 additions and 2 deletions
|
@ -20,8 +20,9 @@ receive (Message.Hello {Message.name}) Nothing = do
|
|||
sessionID <- asks App.sessionID
|
||||
playerID <- App.exec (Server.register sessionID)
|
||||
room <- App.get Server.room
|
||||
App.update (Server.update sessionID $ Session.setPlayer playerID name)
|
||||
Messaging.send $ Message.Welcome room playerID
|
||||
App.update (Server.update sessionID $ Session.setPlayer playerID name)
|
||||
Messaging.broadcast $ Message.LogIn playerID name
|
||||
|
||||
receive (Message.Hello {Message.name}) (Just player) = do
|
||||
sessionID <- asks App.sessionID
|
||||
|
@ -31,8 +32,9 @@ receive (Message.Hello {Message.name}) (Just player) = do
|
|||
|
||||
receive (Message.Tadaima {Message.myID, Message.name}) Nothing = do
|
||||
sessionID <- asks App.sessionID
|
||||
App.update $ Server.logIn name myID sessionID
|
||||
Message.Okaeri <$> App.get Server.room >>= Messaging.send
|
||||
App.update $ Server.logIn name myID sessionID
|
||||
Messaging.broadcast $ Message.LogIn myID name
|
||||
|
||||
receive (Message.Tadaima {}) (Just _) = sendError "You're already logged in"
|
||||
|
||||
|
|
Loading…
Reference in a new issue