mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2026-08-28 21:28:21 +00:00
core: process ERRS event (#4896)
* core: process ERRS event * refactor * update --------- Co-authored-by: Evgeny Poberezkin <evgeny@poberezkin.com>
This commit is contained in:
co-authored by
Evgeny Poberezkin
parent
efb7fc6c3b
commit
8a70bad9af
@@ -4093,6 +4093,7 @@ processAgentMessageNoConn = \case
|
||||
UP srv conns -> serverEvent srv conns NSConnected CRContactsSubscribed
|
||||
SUSPENDED -> toView CRChatSuspended
|
||||
DEL_USER agentUserId -> toView $ CRAgentUserDeleted agentUserId
|
||||
ERRS cErrs -> errsEvent cErrs
|
||||
where
|
||||
hostEvent :: ChatResponse -> CM ()
|
||||
hostEvent = whenM (asks $ hostEvents . config) . toView
|
||||
@@ -4105,6 +4106,16 @@ processAgentMessageNoConn = \case
|
||||
notifyCLI = do
|
||||
cs <- withStore' (`getConnectionsContacts` conns)
|
||||
toView $ event srv cs
|
||||
errsEvent :: [(ConnId, AgentErrorType)] -> CM ()
|
||||
errsEvent cErrs = do
|
||||
vr <- chatVersionRange
|
||||
errs <- lift $ rights <$> withStoreBatch' (\db -> map (getChatErr vr db) cErrs)
|
||||
toView $ CRChatErrors Nothing errs
|
||||
where
|
||||
getChatErr :: VersionRangeChat -> DB.Connection -> (ConnId, AgentErrorType) -> IO ChatError
|
||||
getChatErr vr db (connId, err) =
|
||||
let acId = AgentConnId connId
|
||||
in ChatErrorAgent err <$> (getUserByAConnId db acId $>>= \user -> eitherToMaybe <$> runExceptT (getConnectionEntity db vr user acId))
|
||||
|
||||
processAgentMsgSndFile :: ACorrId -> SndFileId -> AEvent 'AESndFile -> CM ()
|
||||
processAgentMsgSndFile _corrId aFileId msg = do
|
||||
|
||||
Reference in New Issue
Block a user