| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Simplex.Chat.Types.MemberRelations
Synopsis
- data IntroductionDirection
- data MemberRelation
- toIntroDirInt :: IntroductionDirection -> Word8
- fromIntroDirInt :: Word8 -> IntroductionDirection
- toRelationInt :: MemberRelation -> Word8
- fromRelationInt :: Word8 -> MemberRelation
- getRelation :: Int64 -> ByteString -> MemberRelation
- getRelation' :: Int64 -> ByteString -> (IntroductionDirection, MemberRelation)
- getRelationsIndexes :: MemberRelation -> ByteString -> [Int64]
- setRelation :: Int64 -> MemberRelation -> ByteString -> ByteString
- setRelations :: [(Int64, MemberRelation)] -> ByteString -> ByteString
- setRelationConnected :: Int64 -> MemberRelation -> ByteString -> ByteString
- setNewRelation :: Int64 -> IntroductionDirection -> MemberRelation -> ByteString -> ByteString
- setNewRelations :: [(Int64, (IntroductionDirection, MemberRelation))] -> ByteString -> ByteString
Documentation
data IntroductionDirection Source #
Constructors
| IDSubjectIntroduced | |
| IDReferencedIntroduced |
Instances
| Show IntroductionDirection Source # | |
Defined in Simplex.Chat.Types.MemberRelations Methods showsPrec :: Int -> IntroductionDirection -> ShowS show :: IntroductionDirection -> String showList :: [IntroductionDirection] -> ShowS | |
| Eq IntroductionDirection Source # | |
Defined in Simplex.Chat.Types.MemberRelations Methods (==) :: IntroductionDirection -> IntroductionDirection -> Bool (/=) :: IntroductionDirection -> IntroductionDirection -> Bool | |
data MemberRelation Source #
Instances
| Show MemberRelation Source # | |
Defined in Simplex.Chat.Types.MemberRelations Methods showsPrec :: Int -> MemberRelation -> ShowS show :: MemberRelation -> String showList :: [MemberRelation] -> ShowS | |
| Eq MemberRelation Source # | |
Defined in Simplex.Chat.Types.MemberRelations Methods (==) :: MemberRelation -> MemberRelation -> Bool (/=) :: MemberRelation -> MemberRelation -> Bool | |
| Ord MemberRelation Source # | |
Defined in Simplex.Chat.Types.MemberRelations Methods compare :: MemberRelation -> MemberRelation -> Ordering (<) :: MemberRelation -> MemberRelation -> Bool (<=) :: MemberRelation -> MemberRelation -> Bool (>) :: MemberRelation -> MemberRelation -> Bool (>=) :: MemberRelation -> MemberRelation -> Bool max :: MemberRelation -> MemberRelation -> MemberRelation min :: MemberRelation -> MemberRelation -> MemberRelation | |
toIntroDirInt :: IntroductionDirection -> Word8 Source #
fromIntroDirInt :: Word8 -> IntroductionDirection Source #
toRelationInt :: MemberRelation -> Word8 Source #
fromRelationInt :: Word8 -> MemberRelation Source #
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.