Add the recipient in the answer messages (following latest changes in the protocol)

This commit is contained in:
Tissevert 2019-11-03 21:53:35 +01:00
parent c2b01445c8
commit 064606ae83

View file

@ -70,11 +70,11 @@ answer (Message.Relay {Message.from, Message.message = Message.LogIn {Message.na
| from == key = return $ LoggedIn {key, name}
answer (Message.Relay {Message.from, Message.message = Message.Invitation {}}) (LoggedIn {key, name}) = do
send $ Message.Answer {Message.accept = True}
send $ Message.Answer {Message.accept = True, Message.to = from}
return $ Playing {key, name, against = from}
answer (Message.Relay {Message.message = Message.Invitation {}}) state = do
send $ Message.Answer {Message.accept = False}
answer (Message.Relay {Message.from, Message.message = Message.Invitation {}}) state = do
send $ Message.Answer {Message.accept = False, Message.to = from}
return state
answer message@(Message.Game {Message.logs}) state@(Playing {key, name}) = do