simplex-chat-6.5.0.19
Safe HaskellSafe-Inferred
LanguageHaskell2010

Simplex.Chat.Library.Internal

Documentation

withChatLock :: Text -> CM a -> CM a Source #

withEntityLock :: Text -> ChatLockEntity -> CM a -> CM a Source #

withInvitationLock :: Text -> ByteString -> CM a -> CM a Source #

withConnectionLock :: Text -> Int64 -> CM a -> CM a Source #

withContactLock :: Text -> ContactId -> CM a -> CM a Source #

withGroupLock :: Text -> GroupId -> CM a -> CM a Source #

withUserContactLock :: Text -> Int64 -> CM a -> CM a Source #

withContactRequestLock :: Text -> Int64 -> CM a -> CM a Source #

withFileLock :: Text -> Int64 -> CM a -> CM a Source #

useServerCfgs :: forall p. UserProtocol p => SProtocolType p -> RandomAgentServers -> [(Text, ServerOperator)] -> [UserServer p] -> NonEmpty (ServerCfg p) Source #

sndContactCITimed :: Bool -> Contact -> Maybe Int -> CM (Maybe CITimed) Source #

sndGroupCITimed :: Bool -> GroupInfo -> Maybe Int -> CM (Maybe CITimed) Source #

sndCITimed_ :: Bool -> Maybe (Maybe Int) -> Maybe Int -> CM (Maybe CITimed) Source #

toggleNtf :: GroupMember -> Bool -> CM () Source #

prepareGroupMsg :: Connection -> User -> GroupInfo -> Maybe MsgScope -> ShowGroupAsSender -> MsgContent -> Map MemberName MsgMention -> Maybe ChatItemId -> Maybe CIForwardedFrom -> Maybe FileInvitation -> Maybe CITimed -> Bool -> ExceptT StoreError IO (ChatMsgEvent 'Json, Maybe (CIQuote 'CTGroup)) Source #

getCIMentions :: Connection -> User -> GroupInfo -> Maybe MarkdownList -> Map MemberName GroupMemberId -> ExceptT StoreError IO (Map MemberName CIMention) Source #

getMessageMentions :: Connection -> User -> GroupId -> Text -> IO (Map MemberName GroupMemberId) Source #

quoteContent :: forall d. MsgContent -> MsgContent -> Maybe (CIFile d) -> MsgContent Source #

roundedFDCount :: Int -> Int Source #

xftpSndFileTransfer_ :: User -> CryptoFile -> Integer -> Int -> Maybe ContactOrGroup -> CM (FileInvitation, CIFile 'MDSnd, FileTransferMeta) Source #

xftpSndFileRedirect :: User -> FileTransferId -> ValidFileDescription 'FRecipient -> CM FileTransferMeta Source #

markGroupMemberCIsDeleted_ :: Connection -> User -> GroupInfo -> GroupMember -> GroupMember -> UTCTime -> IO [CIFileInfo] Source #

updateDirectChatItemView :: User -> Contact -> ChatItemId -> ACIContent -> Bool -> Bool -> Maybe CITimed -> Maybe MessageId -> CM () Source #

toFSFilePath :: FilePath -> CM' FilePath Source #

receiveFile' :: User -> RcvFileTransfer -> Bool -> Maybe Bool -> Maybe FilePath -> CM ChatResponse Source #

receiveFileEvt' :: User -> RcvFileTransfer -> Bool -> Maybe Bool -> Maybe FilePath -> CM ChatEvent Source #

acceptFileReceive :: User -> RcvFileTransfer -> Bool -> Maybe Bool -> Maybe FilePath -> CM AChatItem Source #

receiveViaCompleteFD :: User -> FileTransferId -> RcvFileDescr -> Bool -> Maybe CryptoFileArgs -> CM () Source #

getKnownAgentServers :: (ProtocolTypeI p, UserProtocol p) => SProtocolType p -> User -> CM (NonEmpty (ServerCfg p)) Source #

protoServer' :: ServerCfg p -> ProtocolServer p Source #

getNetworkConfig :: CM' NetworkConfig Source #

receiveViaURI :: User -> FileDescriptionURI -> CryptoFile -> CM RcvFileTransfer Source #

getRcvFilePath :: FileTransferId -> Maybe FilePath -> String -> Bool -> CM FilePath Source #

acceptContactRequest :: NetworkRequestMode -> User -> UserContactRequest -> IncognitoEnabled -> CM (Contact, Connection, SndQueueSecured) Source #

shouldIntroduce :: GroupMember -> ByteString -> GroupMember -> Bool Source #

setGroupLinkData' :: NetworkRequestMode -> User -> GroupInfo -> CM (Maybe GroupLink) Source #

setGroupLinkData :: NetworkRequestMode -> User -> GroupInfo -> GroupLink -> CM GroupLink Source #

groupLinkData :: GroupInfo -> GroupLink -> [GroupRelay] -> (UserConnLinkData 'CMContact, CRClientData) Source #

restoreShortLink' :: ConnShortLink m -> CM (ConnShortLink m) Source #

getShortLinkConnReq' :: NetworkRequestMode -> User -> ConnShortLink m -> CM (FixedLinkData m, ConnLinkData m) Source #

getShortLinkConnReq :: NetworkRequestMode -> User -> ConnShortLink m -> CM (FixedLinkData m, ConnLinkData m) Source #

encodeShortLinkData :: ToJSON a => a -> UserLinkData Source #

decodeLinkUserData :: FromJSON a => ConnLinkData c -> IO (Maybe a) Source #

shortenShortLink' :: ConnShortLink m -> CM (ConnShortLink m) Source #

shortenCreatedLink :: CreatedConnLink m -> CM (CreatedConnLink m) Source #

deleteTimedItem :: User -> (ChatRef, ChatItemId) -> UTCTime -> CM () Source #

metaBrokerTs :: MsgMeta -> UTCTime Source #

parseFileDescription :: FilePartyI p => Text -> CM (ValidFileDescription p) Source #

appendFileChunk :: RcvFileTransfer -> Integer -> ByteString -> Bool -> CM () Source #

getFileHandle :: Int64 -> FilePath -> (ChatController -> TVar (Map Int64 Handle)) -> IOMode -> CM Handle Source #

isFileActive :: Int64 -> (ChatController -> TVar (Map Int64 Handle)) -> CM Bool Source #

closeFileHandle :: Int64 -> (ChatController -> TVar (Map Int64 Handle)) -> CM' () Source #

createSndMessages :: forall e t. (MsgEncodingI e, Traversable t) => t (ConnOrGroupId, Maybe MsgSigning, ChatMsgEvent e) -> CM' (t (Either ChatError SndMessage)) Source #

sendGroupMemberMessages :: forall e. MsgEncodingI e => User -> GroupInfo -> Connection -> NonEmpty (ChatMsgEvent e) -> CM () Source #

batchSendConnMessages :: BatchMode -> User -> Connection -> MsgFlags -> NonEmpty SndMessage -> CM ([Either ChatError SndMessage], Maybe PQEncryption) Source #

batchSendConnMessagesB :: BatchMode -> User -> Connection -> MsgFlags -> NonEmpty (Either ChatError SndMessage) -> CM ([Either ChatError SndMessage], Maybe PQEncryption) Source #

encodeConnInfoPQ :: MsgEncodingI e => PQSupport -> VersionChat -> ChatMsgEvent e -> CM ByteString Source #

deliverMessage :: Connection -> CMEventTag e -> MsgBody -> MessageId -> CM (Int64, PQEncryption) Source #

deliverMessage' :: Connection -> MsgFlags -> MsgBody -> MessageId -> CM (Int64, PQEncryption) Source #

type ChatMsgReq = (Connection, MsgFlags, (ValueOrRef MsgBody, [MessageId])) Source #

deliverMessages :: NonEmpty ChatMsgReq -> CM (NonEmpty (Either ChatError ([Int64], PQEncryption))) Source #

deliverMessagesB :: NonEmpty (Either ChatError ChatMsgReq) -> CM (NonEmpty (Either ChatError ([Int64], PQEncryption))) Source #

data GroupSndResult Source #

Constructors

GroupSndResult 

Fields

saveSndChatItem' :: ChatTypeI c => User -> ChatDirection c 'MDSnd -> SndMessage -> CIContent 'MDSnd -> Maybe (CIFile 'MDSnd) -> Maybe (CIQuote c) -> Maybe CIForwardedFrom -> Maybe CITimed -> Bool -> CM (ChatItem c 'MDSnd) Source #

saveSndChatItems :: forall c. ChatTypeI c => User -> ChatDirection c 'MDSnd -> ShowGroupAsSender -> [Either ChatError (NewSndChatItemData c)] -> Maybe CITimed -> Bool -> CM [Either ChatError (ChatItem c 'MDSnd)] Source #

saveRcvChatItem' :: (ChatTypeI c, ChatTypeQuotable c) => User -> ChatDirection c 'MDRcv -> RcvMessage -> Maybe SharedMsgId -> UTCTime -> (CIContent 'MDRcv, (Text, Maybe MarkdownList)) -> Maybe (CIFile 'MDRcv) -> Maybe CITimed -> Bool -> Map MemberName MsgMention -> CM (ChatItem c 'MDRcv, ChatInfo c) Source #

mkChatItem :: (ChatTypeI c, MsgDirectionI d) => ChatDirection c d -> ShowGroupAsSender -> ChatItemId -> CIContent d -> Maybe (CIFile d) -> Maybe (CIQuote c) -> Maybe SharedMsgId -> Maybe CIForwardedFrom -> Maybe CITimed -> Bool -> Bool -> ChatItemTs -> Maybe GroupMemberId -> UTCTime -> ChatItem c d Source #

mkChatItem_ :: (ChatTypeI c, MsgDirectionI d) => ChatDirection c d -> ShowGroupAsSender -> ChatItemId -> CIContent d -> (Text, Maybe MarkdownList) -> Maybe (CIFile d) -> Maybe (CIQuote c) -> Maybe SharedMsgId -> Maybe CIForwardedFrom -> Maybe CITimed -> Bool -> Bool -> Bool -> ChatItemTs -> Maybe GroupMemberId -> Maybe MsgSigStatus -> UTCTime -> ChatItem c d Source #

createAgentConnectionAsync :: ConnectionModeI c => User -> CommandFunction -> Bool -> SConnectionMode c -> SubscriptionMode -> CM (CommandId, ConnId) Source #

joinAgentConnectionAsync :: User -> Maybe Connection -> Bool -> ConnectionRequestUri c -> ConnInfo -> SubscriptionMode -> CM (CommandId, ConnId) Source #

agentAcceptContactAsync :: MsgEncodingI e => User -> Bool -> InvitationId -> ChatMsgEvent e -> SubscriptionMode -> PQSupport -> VersionChat -> CM (CommandId, ConnId) Source #

deleteAgentConnectionAsync' :: ConnId -> Bool -> CM () Source #

deleteAgentConnectionsAsync' :: [ConnId] -> Bool -> CM () Source #

setAgentConnShortLinkAsync :: User -> Connection -> UserConnLinkData 'CMContact -> Maybe CRClientData -> CM () Source #

connRequestPQEncryption :: ConnectionRequestUri c -> Maybe PQEncryption Source #

type FeatureContent a d = ChatFeature -> a -> Maybe Int -> CIContent d Source #

createInternalChatItem :: (ChatTypeI c, MsgDirectionI d) => User -> ChatDirection c d -> CIContent d -> Maybe UTCTime -> CM () Source #

createChatItems :: forall c d. (ChatTypeI c, MsgDirectionI d) => User -> Maybe UTCTime -> [(ChatDirection c d, ShowGroupAsSender, [(CIContent d, Maybe SharedMsgId)])] -> CM' [Either ChatError AChatItem] Source #

createLocalChatItems :: User -> ChatDirection 'CTLocal 'MDSnd -> NonEmpty (CIContent 'MDSnd, Maybe (CIFile 'MDSnd), Maybe CIForwardedFrom, (Text, Maybe MarkdownList)) -> UTCTime -> CM [ChatItem 'CTLocal 'MDSnd] Source #

checkSameUser :: UserId -> User -> CM () Source #

timeItToView :: String -> CM' a -> CM' a Source #

epochStart :: UTCTime Source #

drgRandomBytes :: Int -> CM ByteString Source #