chat item status, CRChatItemUpdated api response (#269)

This commit is contained in:
Efim Poberezkin
2022-02-07 15:19:34 +04:00
committed by GitHub
parent eeea33c7cb
commit f5507436f3
14 changed files with 309 additions and 107 deletions
+9 -2
View File
@@ -53,6 +53,13 @@ mobileChatOpts =
logging = False
}
defaultMobileConfig :: ChatConfig
defaultMobileConfig =
defaultChatConfig
{ yesToMigrations = True,
agentConfig = agentConfig defaultChatConfig {yesToMigrations = True}
}
type CJSONString = CString
getActiveUser_ :: SQLiteStore -> IO (Maybe User)
@@ -61,9 +68,9 @@ getActiveUser_ st = find activeUser <$> getUsers st
chatInit :: String -> IO ChatController
chatInit dbFilePrefix = do
let f = chatStoreFile dbFilePrefix
chatStore <- createStore f $ dbPoolSize defaultChatConfig
chatStore <- createStore f (dbPoolSize defaultMobileConfig) (yesToMigrations defaultMobileConfig)
user_ <- getActiveUser_ chatStore
newChatController chatStore user_ defaultChatConfig mobileChatOpts {dbFilePrefix} . const $ pure ()
newChatController chatStore user_ defaultMobileConfig mobileChatOpts {dbFilePrefix} . const $ pure ()
chatSendCmd :: ChatController -> String -> IO JSONString
chatSendCmd cc s = LB.unpack . J.encode . APIResponse Nothing <$> runReaderT (execChatCommand $ B.pack s) cc