simplex-chat-6.5.0.7
Safe HaskellNone
LanguageHaskell2010

Simplex.Chat.Types.MemberRelations

Synopsis

Documentation

getRelation :: Int64 -> ByteString -> MemberRelation Source #

Get the relation status of a member at a given index from the relations vector. Returns MRNew if the vector is not long enough (lazy initialization).

getRelation' :: Int64 -> ByteString -> (IntroductionDirection, MemberRelation) Source #

Get both direction and status of a member at a given index from the relations vector. Returns (IDSubjectIntroduced, MRNew) if the vector is not long enough (lazy initialization).

getRelationsIndexes :: MemberRelation -> ByteString -> [Int64] Source #

Get the indexes of members with the given relation status from the relations vector.

setRelation :: Int64 -> MemberRelation -> ByteString -> ByteString Source #

Set the relation status of a member at a given index in the relations vector. Preserves the introduction direction. Expands the vector lazily if needed.

setRelations :: [(Int64, MemberRelation)] -> ByteString -> ByteString Source #

Set multiple relation statuses at once. Preserves the introduction direction. Expands the vector lazily if needed.

setRelationConnected :: Int64 -> MemberRelation -> ByteString -> ByteString Source #

Set relation to connected state based on passed status and current status. newStatus should be MRSubjectConnected or MRReferencedConnected, otherwise returns vector unchanged. Logic: - if newStatus is complementary to oldStatus -> set MRConnected - if newStatus > oldStatus (by enum order) -> set newStatus - otherwise don't update

setNewRelation :: Int64 -> IntroductionDirection -> MemberRelation -> ByteString -> ByteString Source #

Set a new relation with both direction and status at a given index. Expands the vector lazily if needed.

setNewRelations :: [(Int64, (IntroductionDirection, MemberRelation))] -> ByteString -> ByteString Source #

Set multiple new relations with both direction and status at once. Expands the vector lazily if needed.