From 7a16f326fbe7429792b155c4a963bad1f50dcbda Mon Sep 17 00:00:00 2001 From: joe Date: Wed, 20 Jun 2018 21:30:47 -0400 Subject: Parameterized Account to hold arbitrary information. --- Connection/Tox.hs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'Connection') diff --git a/Connection/Tox.hs b/Connection/Tox.hs index 0c2f281f..03ffbc25 100644 --- a/Connection/Tox.hs +++ b/Connection/Tox.hs @@ -35,10 +35,10 @@ import System.IO -data Parameters = Parameters +data Parameters extra = Parameters { -- | Various Tox transports and clients. dhtRouting :: Routing - , roster :: ContactInfo + , roster :: ContactInfo extra , sessions :: NetCryptoSessions , dhtClient :: DHT.Client -- | Thread to be forked when a connection is established. @@ -127,7 +127,7 @@ lookupForPolicyChange conmap k policy = do callbackId :: Int callbackId = 1 -lookupContact :: Key -> ContactInfo -> STM (Maybe (SecretKey,Contact)) +lookupContact :: Key -> ContactInfo extra -> STM (Maybe (SecretKey,Contact)) lookupContact (Key me them) ContactInfo{accounts} = do acnts <- readTVar accounts fmap join $ forM (HashMap.lookup me acnts) $ \Account{userSecret,contacts} -> do @@ -136,7 +136,7 @@ lookupContact (Key me them) ContactInfo{accounts} = do return (userSecret,c) -- | This function will fork threads as necessary. -setToxPolicy :: Parameters +setToxPolicy :: Parameters extra -> TVar (Map.Map Key SessionState) -> Key -> Policy @@ -249,7 +249,7 @@ stringToKey_ s = let (xs,ys) = break (==':') s them <- readMaybe (drop 1 ys) return $ Key me them -toxManager :: Parameters -> IO (Manager ToxProgress Key) +toxManager :: Parameters extra -> IO (Manager ToxProgress Key) toxManager params = do conmap <- newTVarIO Map.empty return Manager -- cgit v1.2.3