summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorjoe <joe@jerkface.net>2017-11-21 01:01:14 -0500
committerjoe <joe@jerkface.net>2017-11-21 01:01:14 -0500
commit1023a3c21003c404b5c3fac466819953588a6887 (patch)
treea0d2a64c27823c5136a4ad1813c9d2b7ffe1a55e /src
parent98cdeb49997d904cc9b7ce483ebce8ff9173f701 (diff)
Renamed Roster -> ContactInfo, reverted toxManager stubs.
Diffstat (limited to 'src')
-rw-r--r--src/Network/Tox.hs23
1 files changed, 6 insertions, 17 deletions
diff --git a/src/Network/Tox.hs b/src/Network/Tox.hs
index a08f66c6..dfa0ea9e 100644
--- a/src/Network/Tox.hs
+++ b/src/Network/Tox.hs
@@ -100,7 +100,7 @@ import qualified Network.Tox.Onion.Handlers as Onion
100import qualified Network.Tox.Onion.Transport as Onion 100import qualified Network.Tox.Onion.Transport as Onion
101import Network.Tox.Transport 101import Network.Tox.Transport
102import OnionRouter 102import OnionRouter
103import Roster 103import Network.Tox.ContactInfo
104import Text.XXD 104import Text.XXD
105 105
106newCrypto :: IO TransportCrypto 106newCrypto :: IO TransportCrypto
@@ -223,9 +223,6 @@ newClient drg net classify selfAddr handlers modifytbl modifynet = do
223 in client 223 in client
224 return $ either mkclient mkclient tblvar handlers 224 return $ either mkclient mkclient tblvar handlers
225 225
226data ConnectionKey -- TODO
227data ConnectionStatus -- TODO
228
229data Tox = Tox 226data Tox = Tox
230 { toxDHT :: DHT.Client 227 { toxDHT :: DHT.Client
231 , toxOnion :: Onion.Client RouteId 228 , toxOnion :: Onion.Client RouteId
@@ -237,14 +234,13 @@ data Tox = Tox
237 , toxTokens :: TVar SessionTokens 234 , toxTokens :: TVar SessionTokens
238 , toxAnnouncedKeys :: TVar Onion.AnnouncedKeys 235 , toxAnnouncedKeys :: TVar Onion.AnnouncedKeys
239 , toxOnionRoutes :: OnionRouter 236 , toxOnionRoutes :: OnionRouter
240 , toxRoster :: Roster 237 , toxContactInfo :: ContactInfo
241 , toxManager :: Connection.Manager ConnectionStatus ConnectionKey
242 } 238 }
243 239
244-- | initiate a netcrypto session, blocking 240-- | initiate a netcrypto session, blocking
245netCrypto :: Tox -> SecretKey -> PublicKey -> IO NetCryptoSession 241netCrypto :: Tox -> SecretKey -> PublicKey -> IO NetCryptoSession
246netCrypto tox myseckey theirpubkey = do 242netCrypto tox myseckey theirpubkey = do
247-- convert public key to NodeInfo check Roster 243-- convert public key to NodeInfo check ContactInfo
248-- if no session: 244-- if no session:
249-- 1) send dht key, actually maybe send dht-key regardless 245-- 1) send dht key, actually maybe send dht-key regardless
250-- 2) send handshakes to last seen ip's, if any 246-- 2) send handshakes to last seen ip's, if any
@@ -358,11 +354,11 @@ newTox keydb addr mbSessionsState suppliedDHTKey = do
358 (hookQueries orouter DHT.transactionKey) 354 (hookQueries orouter DHT.transactionKey)
359 (const id) 355 (const id)
360 356
361 roster <- newRoster 357 roster <- newContactInfo
362 return Tox 358 return Tox
363 { toxDHT = dhtclient 359 { toxDHT = dhtclient
364 , toxOnion = onionclient 360 , toxOnion = onionclient
365 , toxToRoute = onInbound (updateRoster roster) dtacrypt 361 , toxToRoute = onInbound (updateContactInfo roster) dtacrypt
366 , toxCrypto = addHandler (hPutStrLn stderr) (cryptoNetHandler sessionsState) cryptonet 362 , toxCrypto = addHandler (hPutStrLn stderr) (cryptoNetHandler sessionsState) cryptonet
367 , toxCryptoSessions = sessionsState 363 , toxCryptoSessions = sessionsState
368 , toxCryptoKeys = crypto 364 , toxCryptoKeys = crypto
@@ -370,14 +366,7 @@ newTox keydb addr mbSessionsState suppliedDHTKey = do
370 , toxTokens = toks 366 , toxTokens = toks
371 , toxAnnouncedKeys = keydb 367 , toxAnnouncedKeys = keydb
372 , toxOnionRoutes = orouter 368 , toxOnionRoutes = orouter
373 , toxRoster = roster 369 , toxContactInfo = roster
374 , toxManager = Connection.Manager
375 { setPolicy = _todo -- k -> Policy -> IO ()
376 , connections = _todo -- STM (Map k (Connection status))
377 , stringToKey = _todo -- String -> Maybe k
378 , showProgress = _todo -- status -> String
379 , showKey = _todo -- k -> String
380 }
381 } 370 }
382 371
383onionTimeout :: Tox -> DHT.TransactionId -> Onion.OnionDestination RouteId -> STM (Onion.OnionDestination RouteId, Int) 372onionTimeout :: Tox -> DHT.TransactionId -> Onion.OnionDestination RouteId -> STM (Onion.OnionDestination RouteId, Int)