summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Network/Tox.hs12
-rw-r--r--src/Network/Tox/Crypto/Handlers.hs12
2 files changed, 12 insertions, 12 deletions
diff --git a/src/Network/Tox.hs b/src/Network/Tox.hs
index 1567ef1a..4ce7c398 100644
--- a/src/Network/Tox.hs
+++ b/src/Network/Tox.hs
@@ -241,6 +241,18 @@ data Tox = Tox
241 , toxManager :: Connection.Manager ConnectionStatus ConnectionKey 241 , toxManager :: Connection.Manager ConnectionStatus ConnectionKey
242 } 242 }
243 243
244-- | initiate a netcrypto session, blocking
245netCrypto :: Tox -> SecretKey -> PublicKey -> IO NetCryptoSession
246netCrypto tox myseckey theirpubkey = do
247-- convert public key to NodeInfo check Roster
248-- if no session:
249-- 1) send dht key, actually maybe send dht-key regardless
250-- 2) send handshakes to last seen ip's, if any
251--
252-- if sessions found, is it using this private key?
253-- if not, send handshake, this is separate session
254 error "todo"
255
244getContactInfo :: Tox -> IO DHT.DHTPublicKey 256getContactInfo :: Tox -> IO DHT.DHTPublicKey
245getContactInfo Tox{toxCryptoKeys,toxRouting} = join $ atomically $ do 257getContactInfo Tox{toxCryptoKeys,toxRouting} = join $ atomically $ do
246 r4 <- readTVar $ DHT.routing4 toxRouting 258 r4 <- readTVar $ DHT.routing4 toxRouting
diff --git a/src/Network/Tox/Crypto/Handlers.hs b/src/Network/Tox/Crypto/Handlers.hs
index cbd820de..d43535ad 100644
--- a/src/Network/Tox/Crypto/Handlers.hs
+++ b/src/Network/Tox/Crypto/Handlers.hs
@@ -140,18 +140,6 @@ forgetCrypto crypto (NCSessions {netCryptoSessions,netCryptoSessionsByKey}) sess
140 [] -> Nothing 140 [] -> Nothing
141 ys -> Just ys) sPubKey) 141 ys -> Just ys) sPubKey)
142 142
143-- | initiate a netcrypto session, blocking
144netCrypto :: TransportCrypto -> NetCryptoSessions -> SecretKey -> PublicKey -> IO NetCryptoSession
145netCrypto crypto allsessions myseckey theirpubkey = do
146-- convert public key to NodeInfo check Roster
147-- if no session:
148-- 1) send dht key, actually maybe send dht-key regardless
149-- 2) send handshakes to last seen ip's, if any
150--
151-- if sessions found, is it using this private key?
152-- if not, send handshake, this is separate session
153 error "todo"
154
155newSessionsState :: TransportCrypto 143newSessionsState :: TransportCrypto
156 -> (MessageType -> NetCryptoHook) -- ^ default hook 144 -> (MessageType -> NetCryptoHook) -- ^ default hook
157 -> Map.Map MessageType [NetCryptoHook] -- ^ all hooks, can be empty to start 145 -> Map.Map MessageType [NetCryptoHook] -- ^ all hooks, can be empty to start