mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2026-06-04 03:51:48 +00:00
core: clear connection verification status (#1540)
This commit is contained in:
committed by
GitHub
parent
73e5fff8f5
commit
146d5f99bc
+11
-7
@@ -1166,12 +1166,16 @@ processChatCommand = \case
|
||||
getGroupAndMemberId user gName mName >>= processChatCommand . uncurry cmd
|
||||
getConnectionCode :: ConnId -> m Text
|
||||
getConnectionCode connId = verificationCode <$> withAgent (`getConnectionRatchetAdHash` connId)
|
||||
verifyConnectionCode :: User -> Connection -> Text -> m ChatResponse
|
||||
verifyConnectionCode user conn@Connection {connId} code = do
|
||||
verifyConnectionCode :: User -> Connection -> Maybe Text -> m ChatResponse
|
||||
verifyConnectionCode user conn@Connection {connId} (Just code) = do
|
||||
code' <- getConnectionCode $ aConnId conn
|
||||
let verified = sameVerificationCode code code'
|
||||
when verified . withStore' $ \db -> setConnectionVerified db user connId $ Just code'
|
||||
pure $ CRCodeVerification verified code'
|
||||
pure $ CRConnectionVerified verified code'
|
||||
verifyConnectionCode user conn@Connection {connId} _ = do
|
||||
code' <- getConnectionCode $ aConnId conn
|
||||
withStore' $ \db -> setConnectionVerified db user connId Nothing
|
||||
pure $ CRConnectionVerified False code'
|
||||
getSentChatItemIdByText :: User -> ChatRef -> ByteString -> m Int64
|
||||
getSentChatItemIdByText user@User {userId, localDisplayName} (ChatRef cType cId) msg = case cType of
|
||||
CTDirect -> withStore $ \db -> getDirectChatItemIdByText db userId cId SMDSnd (safeDecodeUtf8 msg)
|
||||
@@ -3441,12 +3445,12 @@ chatCommandP =
|
||||
"/switch " *> char_ '@' *> (SwitchContact <$> displayName),
|
||||
"/_get code @" *> (APIGetContactCode <$> A.decimal),
|
||||
"/_get code #" *> (APIGetGroupMemberCode <$> A.decimal <* A.space <*> A.decimal),
|
||||
"/_verify code @" *> (APIVerifyContact <$> A.decimal <* A.space <*> textP),
|
||||
"/_verify code #" *> (APIVerifyGroupMember <$> A.decimal <* A.space <*> A.decimal <* A.space <*> textP),
|
||||
"/_verify code @" *> (APIVerifyContact <$> A.decimal <*> optional (A.space *> textP)),
|
||||
"/_verify code #" *> (APIVerifyGroupMember <$> A.decimal <* A.space <*> A.decimal <*> optional (A.space *> textP)),
|
||||
"/code " *> char_ '@' *> (GetContactCode <$> displayName),
|
||||
"/code #" *> (GetGroupMemberCode <$> displayName <* A.space <* char_ '@' <*> displayName),
|
||||
"/verify " *> char_ '@' *> (VerifyContact <$> displayName <* A.space <*> textP),
|
||||
"/verify #" *> (VerifyGroupMember <$> displayName <* A.space <* char_ '@' <*> displayName <* A.space <*> textP),
|
||||
"/verify " *> char_ '@' *> (VerifyContact <$> displayName <*> optional (A.space *> textP)),
|
||||
"/verify #" *> (VerifyGroupMember <$> displayName <* A.space <* char_ '@' <*> displayName <*> optional (A.space *> textP)),
|
||||
("/help files" <|> "/help file" <|> "/hf") $> ChatHelp HSFiles,
|
||||
("/help groups" <|> "/help group" <|> "/hg") $> ChatHelp HSGroups,
|
||||
("/help address" <|> "/ha") $> ChatHelp HSMyAddress,
|
||||
|
||||
Reference in New Issue
Block a user