summaryrefslogtreecommitdiff
path: root/Connection
diff options
context:
space:
mode:
authorjoe <joe@jerkface.net>2018-06-20 21:30:47 -0400
committerjoe <joe@jerkface.net>2018-06-20 21:30:47 -0400
commit7a16f326fbe7429792b155c4a963bad1f50dcbda (patch)
treebc134b0d5989a66205b30df5dc78879dfe2011e6 /Connection
parent06229147ebfa72349baec5a2b55081341ff61908 (diff)
Parameterized Account to hold arbitrary information.
Diffstat (limited to 'Connection')
-rw-r--r--Connection/Tox.hs10
1 files changed, 5 insertions, 5 deletions
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
35 35
36 36
37 37
38data Parameters = Parameters 38data Parameters extra = Parameters
39 { -- | Various Tox transports and clients. 39 { -- | Various Tox transports and clients.
40 dhtRouting :: Routing 40 dhtRouting :: Routing
41 , roster :: ContactInfo 41 , roster :: ContactInfo extra
42 , sessions :: NetCryptoSessions 42 , sessions :: NetCryptoSessions
43 , dhtClient :: DHT.Client 43 , dhtClient :: DHT.Client
44 -- | Thread to be forked when a connection is established. 44 -- | Thread to be forked when a connection is established.
@@ -127,7 +127,7 @@ lookupForPolicyChange conmap k policy = do
127callbackId :: Int 127callbackId :: Int
128callbackId = 1 128callbackId = 1
129 129
130lookupContact :: Key -> ContactInfo -> STM (Maybe (SecretKey,Contact)) 130lookupContact :: Key -> ContactInfo extra -> STM (Maybe (SecretKey,Contact))
131lookupContact (Key me them) ContactInfo{accounts} = do 131lookupContact (Key me them) ContactInfo{accounts} = do
132 acnts <- readTVar accounts 132 acnts <- readTVar accounts
133 fmap join $ forM (HashMap.lookup me acnts) $ \Account{userSecret,contacts} -> do 133 fmap join $ forM (HashMap.lookup me acnts) $ \Account{userSecret,contacts} -> do
@@ -136,7 +136,7 @@ lookupContact (Key me them) ContactInfo{accounts} = do
136 return (userSecret,c) 136 return (userSecret,c)
137 137
138-- | This function will fork threads as necessary. 138-- | This function will fork threads as necessary.
139setToxPolicy :: Parameters 139setToxPolicy :: Parameters extra
140 -> TVar (Map.Map Key SessionState) 140 -> TVar (Map.Map Key SessionState)
141 -> Key 141 -> Key
142 -> Policy 142 -> Policy
@@ -249,7 +249,7 @@ stringToKey_ s = let (xs,ys) = break (==':') s
249 them <- readMaybe (drop 1 ys) 249 them <- readMaybe (drop 1 ys)
250 return $ Key me them 250 return $ Key me them
251 251
252toxManager :: Parameters -> IO (Manager ToxProgress Key) 252toxManager :: Parameters extra -> IO (Manager ToxProgress Key)
253toxManager params = do 253toxManager params = do
254 conmap <- newTVarIO Map.empty 254 conmap <- newTVarIO Map.empty
255 return Manager 255 return Manager