diff options
Diffstat (limited to 'src/Network/Tox.hs')
-rw-r--r-- | src/Network/Tox.hs | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/src/Network/Tox.hs b/src/Network/Tox.hs index c0e1dee0..93e3c663 100644 --- a/src/Network/Tox.hs +++ b/src/Network/Tox.hs | |||
@@ -86,16 +86,17 @@ import Network.BitTorrent.DHT.Token as Token | |||
86 | import GHC.TypeLits | 86 | import GHC.TypeLits |
87 | 87 | ||
88 | import Crypto.Tox | 88 | import Crypto.Tox |
89 | import Network.Tox.Transport | 89 | import Data.Word64Map (fitsInInt) |
90 | import Network.Tox.Crypto.Transport (NetCrypto) | ||
91 | import qualified Network.Tox.DHT.Handlers as DHT | ||
92 | import qualified Network.Tox.DHT.Transport as DHT | ||
90 | import Network.Tox.NodeId | 93 | import Network.Tox.NodeId |
91 | import qualified Network.Tox.DHT.Transport as DHT | 94 | import qualified Network.Tox.Onion.Handlers as Onion |
92 | import qualified Network.Tox.DHT.Handlers as DHT | ||
93 | import qualified Network.Tox.Onion.Transport as Onion | 95 | import qualified Network.Tox.Onion.Transport as Onion |
94 | import qualified Network.Tox.Onion.Handlers as Onion | 96 | import Network.Tox.Transport |
95 | import Network.Tox.Crypto.Transport (NetCrypto) | ||
96 | import Text.XXD | ||
97 | import OnionRouter | 97 | import OnionRouter |
98 | import Data.Word64Map (fitsInInt) | 98 | import Roster |
99 | import Text.XXD | ||
99 | 100 | ||
100 | newCrypto :: IO TransportCrypto | 101 | newCrypto :: IO TransportCrypto |
101 | newCrypto = do | 102 | newCrypto = do |
@@ -215,6 +216,7 @@ data Tox = Tox | |||
215 | , toxTokens :: TVar SessionTokens | 216 | , toxTokens :: TVar SessionTokens |
216 | , toxAnnouncedKeys :: TVar Onion.AnnouncedKeys | 217 | , toxAnnouncedKeys :: TVar Onion.AnnouncedKeys |
217 | , toxOnionRoutes :: OnionRouter | 218 | , toxOnionRoutes :: OnionRouter |
219 | , toxRoster :: Roster | ||
218 | } | 220 | } |
219 | 221 | ||
220 | getContactInfo :: Tox -> IO DHT.DHTPublicKey | 222 | getContactInfo :: Tox -> IO DHT.DHTPublicKey |
@@ -298,16 +300,18 @@ newTox keydb addr = do | |||
298 | (hookQueries orouter DHT.transactionKey) | 300 | (hookQueries orouter DHT.transactionKey) |
299 | (const id) | 301 | (const id) |
300 | 302 | ||
303 | roster <- newRoster | ||
301 | return Tox | 304 | return Tox |
302 | { toxDHT = dhtclient | 305 | { toxDHT = dhtclient |
303 | , toxOnion = onionclient | 306 | , toxOnion = onionclient |
304 | , toxToRoute = dtacrypt | 307 | , toxToRoute = onInbound (updateRoster roster) dtacrypt |
305 | , toxCrypto = cryptonet | 308 | , toxCrypto = cryptonet |
306 | , toxCryptoKeys = crypto | 309 | , toxCryptoKeys = crypto |
307 | , toxRouting = routing | 310 | , toxRouting = routing |
308 | , toxTokens = toks | 311 | , toxTokens = toks |
309 | , toxAnnouncedKeys = keydb | 312 | , toxAnnouncedKeys = keydb |
310 | , toxOnionRoutes = orouter | 313 | , toxOnionRoutes = orouter |
314 | , toxRoster = roster | ||
311 | } | 315 | } |
312 | 316 | ||
313 | onionTimeout :: Tox -> DHT.TransactionId -> Onion.OnionDestination RouteId -> STM (Onion.OnionDestination RouteId, Int) | 317 | onionTimeout :: Tox -> DHT.TransactionId -> Onion.OnionDestination RouteId -> STM (Onion.OnionDestination RouteId, Int) |