From 5622c6cdce0b8572434e8ab24fbae7f57ffadf3e Mon Sep 17 00:00:00 2001 From: Andrew Cady Date: Thu, 21 Jun 2018 22:29:04 -0400 Subject: start to implement plan in conn-notes.txt --- src/Network/Tox/ContactInfo.hs | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src') diff --git a/src/Network/Tox/ContactInfo.hs b/src/Network/Tox/ContactInfo.hs index 5135813a..e76e2f1b 100644 --- a/src/Network/Tox/ContactInfo.hs +++ b/src/Network/Tox/ContactInfo.hs @@ -70,6 +70,12 @@ initContact = Contact <$> newTVar Nothing <*> newTVar Nothing <*> newTVar Nothing +getContact :: PublicKey -> Account extra -> STM (Maybe Contact) +getContact remoteUserKey acc = do + let rkey = key2id remoteUserKey + cmap <- readTVar (contacts acc) + return $ HashMap.lookup rkey cmap + updateAccount' :: PublicKey -> Account extra -> (Contact -> STM ()) -> STM () updateAccount' remoteUserKey acc updater = do let rkey = key2id remoteUserKey -- cgit v1.2.3