diff options
author | Roman Smrž <roman.smrz@seznam.cz> | 2023-01-08 23:05:43 +0100 |
---|---|---|
committer | Roman Smrž <roman.smrz@seznam.cz> | 2023-01-08 23:05:43 +0100 |
commit | 26c03fae3e49057ac18462c5d1f48b9b221e1dcc (patch) | |
tree | 3a6b2c8964d132427f9adaabb727f447a5c9411c /src/Contact.hs | |
parent | a03ddf116287609057f8372a019ca3d254e14207 (diff) |
Contact custom name setting support and test
Diffstat (limited to 'src/Contact.hs')
-rw-r--r-- | src/Contact.hs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/Contact.hs b/src/Contact.hs index 4e2cb17..6585985 100644 --- a/src/Contact.hs +++ b/src/Contact.hs @@ -4,6 +4,8 @@ module Contact ( contactCustomName, contactName, + contactSetName, + ContactService, contactRequest, contactAccept, @@ -79,6 +81,16 @@ contactName c = fromJust $ msum , Just T.empty ] +contactSetName :: MonadHead LocalState m => Contact -> Text -> Set Contact -> m (Set Contact) +contactSetName contact name set = do + st <- getStorage + cdata <- wrappedStore st ContactData + { cdPrev = toComponents contact + , cdIdentity = [] + , cdName = Just name + } + storeSetAdd st (mergeSorted @Contact [cdata]) set + type ContactService = PairingService ContactAccepted |