diff options
author | Roman Smrž <roman.smrz@seznam.cz> | 2024-07-14 22:24:33 +0200 |
---|---|---|
committer | Roman Smrž <roman.smrz@seznam.cz> | 2024-07-16 20:29:19 +0200 |
commit | cf0808dea948fcd3ba21de13be49aab3f03f3cc8 (patch) | |
tree | ccdbd46e72e271073650051a3a4f8e74e88f91aa | |
parent | ba99a1b1411009f8097887c241d8c46dfc9d2060 (diff) |
Subscribe on entering chatroom
-rw-r--r-- | main/Main.hs | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/main/Main.hs b/main/Main.hs index 394cd30..dfa3e1b 100644 --- a/main/Main.hs +++ b/main/Main.hs @@ -526,7 +526,13 @@ cmdSelectContext :: Command cmdSelectContext = do n <- read <$> asks ciLine join (asks ciContextOptions) >>= \ctxs -> if - | n > 0, (ctx : _) <- drop (n - 1) ctxs -> modify $ \s -> s { csContext = ctx } + | n > 0, (ctx : _) <- drop (n - 1) ctxs -> do + modify $ \s -> s { csContext = ctx } + case ctx of + SelectedChatroom rstate -> do + when (not (roomStateSubscribe rstate)) $ do + chatroomSetSubscribe (head $ roomStateData rstate) True + _ -> return () | otherwise -> throwError "invalid index" cmdSend :: Command |