diff options
Diffstat (limited to 'dht/examples/dhtd.hs')
-rw-r--r-- | dht/examples/dhtd.hs | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/dht/examples/dhtd.hs b/dht/examples/dhtd.hs index d7c817ca..f9dc777d 100644 --- a/dht/examples/dhtd.hs +++ b/dht/examples/dhtd.hs | |||
@@ -1366,17 +1366,24 @@ onNewToxSession runio sv ssvar invc ContactInfo{accounts} addrTox netcrypto = do | |||
1366 | 1366 | ||
1367 | uniqkey <- xor24 <$> hash24 (them netcrypto) <*> hash24 (me netcrypto) | 1367 | uniqkey <- xor24 <$> hash24 (them netcrypto) <*> hash24 (me netcrypto) |
1368 | 1368 | ||
1369 | let me_dot_tox = xmppHostname $ me netcrypto | ||
1370 | them_dot_tox = xmppHostname $ them netcrypto | ||
1371 | |||
1369 | c <- atomically $ do | 1372 | c <- atomically $ do |
1370 | mc <- Map.lookup uniqkey <$> readTVar ssvar | 1373 | mc <- Map.lookup uniqkey <$> readTVar ssvar |
1371 | case mc of | 1374 | case mc of |
1372 | Nothing -> do | 1375 | Nothing -> do |
1373 | announce <- do | 1376 | announce <- do |
1374 | v <- newTVar Nothing | 1377 | v <- newTVar $ Just them_dot_tox |
1375 | let ck = uniqueAsKey uniqkey | 1378 | let ck = uniqueAsKey uniqkey |
1376 | condta s = ConnectionData (Left (Local addrTox)) | 1379 | condta s = ConnectionData |
1377 | XMPPServer.Tox | 1380 | { cdAddr = Left (Local addrTox) |
1378 | (xmppHostname $ me s) | 1381 | , cdType = XMPPServer.Tox |
1379 | v | 1382 | , cdProfile = me_dot_tox |
1383 | , cdRemoteName = v | ||
1384 | , cdTheirNameForMe = Just me_dot_tox | ||
1385 | , cdTheirName = Just them_dot_tox | ||
1386 | } | ||
1380 | return $ \s e -> writeTChan (xmppEventChannel sv) ( (ck, condta s), e) | 1387 | return $ \s e -> writeTChan (xmppEventChannel sv) ( (ck, condta s), e) |
1381 | c <- newAggregateSession $ onStatusChange announce | 1388 | c <- newAggregateSession $ onStatusChange announce |
1382 | modifyTVar' ssvar $ Map.insert uniqkey c | 1389 | modifyTVar' ssvar $ Map.insert uniqkey c |