From 26c03fae3e49057ac18462c5d1f48b9b221e1dcc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roman=20Smr=C5=BE?= Date: Sun, 8 Jan 2023 23:05:43 +0100 Subject: Contact custom name setting support and test --- src/Contact.hs | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/Contact.hs') 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 -- cgit v1.2.3