~amindfv/jmms

9145d1ea4bc712d70592003e5ee0a7c4968d74dc — amindfv 2 years ago 403ce28
Add ability to create new MMS conversations
1 files changed, 10 insertions(+), 2 deletions(-)

M ReadMessages.hs
M ReadMessages.hs => ReadMessages.hs +10 -2
@@ 12,6 12,7 @@ import qualified Data.ByteString as BS
import qualified Data.ByteString.Char8 as BS8
import Data.Char (toLower)
import qualified Data.List as L
import qualified Data.List.Split as L
import Data.Map (Map)
import qualified Data.Map as Map
import Data.Maybe


@@ 283,10 284,17 @@ readThreads canSend = do
                show n ++ ") " ++ show (map idContacts $ Set.toList $ Set.delete Settings.myNumber participants) ++ case any (`notElem` readFiles) files of
                   True -> " *" -- Meaning there are unread messages
                   False -> ""
      putStrLn menu
      putStrLn $ menu ++ "n) new conversation"
      l <- getLine
      case readMaybe l of
         Nothing -> error $ "Couldn't read index: "++show l
         Nothing -> case l of
            "n" -> do
               putStrLn "List recipients, separated by commas (no spaces):"
               recipients <- (map (BS8.pack) . L.splitOn ",") <$> getLine
               getYOrN ("This correct?: "++show recipients) >>= \case
                  False -> error "ok, try again"
                  True -> sendMessageTo recipients
            _ -> error $ "Couldn't read index: "++show l
         Just n ->
            case threads !!? n of
               Nothing -> error $ "Index out of range: "++show l