chat: subscribe to all connections on startup (#70)
This commit is contained in:
parent
4da27e0dfa
commit
97e80cfb07
6
Main.hs
6
Main.hs
@ -110,7 +110,6 @@ chatHelpInfo =
|
||||
\/accept <name> <invitation> - accept <invitation>\n\
|
||||
\ (a string that starts from \"smp::\")\n\
|
||||
\ from your contact <name>\n\
|
||||
\/chat <name> - resume chat with <name>\n\
|
||||
\/name <name> - set <name> to use in invitations\n\
|
||||
\@<name> <message> - send <message> (any string) to contact <name>\n\
|
||||
\ @<name> can be omitted to send to previous"
|
||||
@ -173,7 +172,8 @@ sendToChatTerm ChatClient {outQ, username} ChatTerminal {outputQ} = forever $ do
|
||||
atomically . writeTBQueue outputQ $ serializeChatResponse name resp
|
||||
|
||||
sendToAgent :: ChatClient -> ChatTerminal -> AgentClient -> IO ()
|
||||
sendToAgent ChatClient {inQ, smpServer} ct AgentClient {rcvQ} =
|
||||
sendToAgent ChatClient {inQ, smpServer} ct AgentClient {rcvQ} = do
|
||||
atomically $ writeTBQueue rcvQ ("1", "", SUBALL) -- hack for subscribing to all
|
||||
forever . atomically $ do
|
||||
cmd <- readTBQueue inQ
|
||||
writeTBQueue rcvQ `mapM_` agentTransmission cmd
|
||||
@ -209,7 +209,7 @@ receiveFromAgent t ct c = forever . atomically $ do
|
||||
END -> Disconnected $ Contact a
|
||||
MSG {m_body} -> ReceivedMessage (Contact a) m_body
|
||||
SENT _ -> NoChatResponse
|
||||
OK -> YesYes
|
||||
OK -> Connected $ Contact a -- hack for subscribing to all
|
||||
ERR e -> ChatError e
|
||||
setActiveContact :: ChatResponse -> STM ()
|
||||
setActiveContact = \case
|
||||
|
Loading…
Reference in New Issue
Block a user