diff options
Diffstat (limited to 'main')
-rw-r--r-- | main/Main.hs | 20 | ||||
-rw-r--r-- | main/Test.hs | 2 |
2 files changed, 11 insertions, 11 deletions
diff --git a/main/Main.hs b/main/Main.hs index 091f076..3c1494d 100644 --- a/main/Main.hs +++ b/main/Main.hs @@ -506,9 +506,11 @@ cmdSend :: Command cmdSend = void $ do text <- asks ciLine conv <- getSelectedConversation - msg <- sendMessage conv $ T.pack text - tzone <- liftIO $ getCurrentTimeZone - liftIO $ putStrLn $ formatMessage tzone msg + sendMessage conv (T.pack text) >>= \case + Just msg -> do + tzone <- liftIO $ getCurrentTimeZone + liftIO $ putStrLn $ formatMessage tzone msg + Nothing -> return () cmdHistory :: Command cmdHistory = void $ do @@ -535,13 +537,11 @@ cmdAttachReject = attachReject =<< getSelectedPeer cmdChatrooms :: Command cmdChatrooms = do - chatrooms <- listChatrooms - forM_ chatrooms $ \case - rstate | Just room <- roomStateRoom rstate -> do - liftIO $ T.putStrLn $ T.concat - [ fromMaybe (T.pack "<unnamed>") $ roomName room - ] - _ -> return () + conversations <- return . catMaybes =<< mapM chatroomConversation =<< listChatrooms + set <- asks ciSetContextOptions + set $ map SelectedConversation conversations + forM_ (zip [1..] conversations) $ \(i :: Int, conv) -> do + liftIO $ putStrLn $ "[" ++ show i ++ "] " ++ T.unpack (conversationName conv) cmdChatroomCreatePublic :: Command cmdChatroomCreatePublic = do diff --git a/main/Test.hs b/main/Test.hs index 711f9fa..6b6d1d4 100644 --- a/main/Test.hs +++ b/main/Test.hs @@ -758,4 +758,4 @@ cmdChatroomMessageSend :: Command cmdChatroomMessageSend = do [cid, msg] <- asks tiParams to <- getChatroomStateData cid - void $ chatroomMessageByStateData to msg + void $ sendChatroomMessageByStateData to msg |