2023-08-01 20:54:51 +01:00
|
|
|
{-# LANGUAGE NamedFieldPuns #-}
|
|
|
|
|
|
|
|
module Main where
|
|
|
|
|
|
|
|
import Directory.Options
|
|
|
|
import Directory.Service
|
|
|
|
import Directory.Store
|
2025-03-03 18:57:29 +00:00
|
|
|
import Simplex.Chat.Controller (ChatConfig (..), ChatHooks (..), defaultChatHooks)
|
2023-08-01 20:54:51 +01:00
|
|
|
import Simplex.Chat.Core
|
2025-03-03 18:57:29 +00:00
|
|
|
import Simplex.Chat.Terminal (terminalChatConfig)
|
2023-08-01 20:54:51 +01:00
|
|
|
|
|
|
|
main :: IO ()
|
|
|
|
main = do
|
2025-01-09 15:58:47 +00:00
|
|
|
opts@DirectoryOpts {directoryLog, runCLI} <- welcomeGetOpts
|
2023-08-07 08:25:15 +01:00
|
|
|
st <- restoreDirectoryStore directoryLog
|
2025-01-09 15:58:47 +00:00
|
|
|
if runCLI
|
|
|
|
then directoryServiceCLI st opts
|
2025-02-25 09:24:30 +00:00
|
|
|
else do
|
2025-03-03 18:57:29 +00:00
|
|
|
env <- newServiceState opts
|
|
|
|
let cfg = terminalChatConfig {chatHooks = defaultChatHooks {acceptMember = Just $ acceptMemberHook opts env}}
|
|
|
|
simplexChatCore cfg (mkChatOpts opts) $ directoryService st opts env
|