simplex-chat-6.5.0.7
Safe HaskellNone
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 :: ProtocolType). 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 -> 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 #

ciContentTexts :: forall (d :: MsgDirection). CIContent d -> (Text, Maybe MarkdownList) 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 #

deleteGroupMemberCIs_ :: forall (d :: MsgDirection). MsgDirectionI d => Connection -> User -> GroupInfo -> GroupMember -> GroupMember -> SMsgDirection d -> UTCTime -> IO [CIFileInfo] 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 :: forall (p :: ProtocolType). (ProtocolTypeI p, UserProtocol p) => SProtocolType p -> User -> CM (NonEmpty (ServerCfg p)) Source #

protoServer' :: forall (p :: ProtocolType). 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 () Source #

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

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

decodeShortLinkData :: forall a (c :: ConnectionMode). FromJSON a => ConnLinkData c -> IO (Maybe a) Source #

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

shortenCreatedLink :: forall (m :: ConnectionMode). CreatedConnLink m -> CM (CreatedConnLink m) Source #

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

startUpdatedTimedItemThread :: forall (c :: ChatType) (d :: MsgDirection). User -> ChatRef -> ChatItem c d -> ChatItem c d -> CM () Source #

metaBrokerTs :: MsgMeta -> UTCTime Source #

parseFileDescription :: forall (p :: FileParty). 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 #

sendDirectMemberMessage :: forall (e :: MsgEncoding). MsgEncodingI e => Connection -> ChatMsgEvent e -> GroupId -> CM (SndMessage, Int64, PQEncryption) Source #

sendDirectMessage_ :: forall (e :: MsgEncoding). MsgEncodingI e => Connection -> ChatMsgEvent e -> ConnOrGroupId -> CM (SndMessage, Int64, PQEncryption) Source #

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

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

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

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

encodeConnInfo :: forall (e :: MsgEncoding). MsgEncodingI e => ChatMsgEvent e -> CM ByteString Source #

encodeConnInfoPQ :: forall (e :: MsgEncoding). MsgEncodingI e => PQSupport -> VersionChat -> ChatMsgEvent e -> CM ByteString Source #

deliverMessage :: forall (e :: MsgEncoding). 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 #

sendGroupMessages :: forall (e :: MsgEncoding). MsgEncodingI e => User -> GroupInfo -> Maybe GroupChatScope -> [GroupMember] -> NonEmpty (ChatMsgEvent e) -> CM (NonEmpty (Either ChatError SndMessage), GroupSndResult) Source #

data GroupSndResult Source #

Constructors

GroupSndResult 

Fields

sendGroupMessages_ :: forall (e :: MsgEncoding). MsgEncodingI e => User -> GroupInfo -> [GroupMember] -> NonEmpty (ChatMsgEvent e) -> CM (NonEmpty (Either ChatError SndMessage), GroupSndResult) Source #

saveDirectRcvMSG :: forall (e :: MsgEncoding). MsgEncodingI e => Connection -> MsgMeta -> MsgBody -> ChatMessage e -> CM (Connection, RcvMessage) Source #

saveGroupFwdRcvMsg :: forall (e :: MsgEncoding). MsgEncodingI e => User -> GroupInfo -> GroupMember -> GroupMember -> MsgBody -> ChatMessage e -> UTCTime -> CM (Maybe RcvMessage) Source #

saveSndChatItem' :: forall (c :: ChatType). 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 :: ChatType). ChatTypeI c => User -> ChatDirection c 'MDSnd -> [Either ChatError (NewSndChatItemData c)] -> Maybe CITimed -> Bool -> CM [Either ChatError (ChatItem c 'MDSnd)] Source #

saveRcvChatItem :: forall (c :: ChatType). (ChatTypeI c, ChatTypeQuotable c) => User -> ChatDirection c 'MDRcv -> RcvMessage -> UTCTime -> (CIContent 'MDRcv, (Text, Maybe MarkdownList)) -> CM (ChatItem c 'MDRcv, ChatInfo c) Source #

saveRcvChatItem' :: forall (c :: ChatType). (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 :: forall (c :: ChatType) (d :: MsgDirection). (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_ :: forall (c :: ChatType) (d :: MsgDirection). (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 -> ChatItemTs -> Maybe GroupMemberId -> UTCTime -> ChatItem c d Source #

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

joinAgentConnectionAsync :: forall (c :: ConnectionMode). User -> Bool -> ConnectionRequestUri c -> ConnInfo -> SubscriptionMode -> CM (CommandId, ConnId) Source #

allowAgentConnectionAsync :: forall (e :: MsgEncoding). MsgEncodingI e => User -> Connection -> ConfirmationId -> ChatMsgEvent e -> CM () Source #

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

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

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

connRequestPQEncryption :: forall (c :: ConnectionMode). ConnectionRequestUri c -> Maybe PQEncryption Source #

type FeatureContent a (d :: MsgDirection) = ChatFeature -> a -> Maybe Int -> CIContent d Source #

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

createChatItem :: forall (c :: ChatType) (d :: MsgDirection). (ChatTypeI c, MsgDirectionI d) => User -> ChatDirection c d -> ShowGroupAsSender -> CIContent d -> Maybe SharedMsgId -> Maybe UTCTime -> CM AChatItem Source #

createChatItems :: forall (c :: ChatType) (d :: MsgDirection). (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 #