summaryrefslogtreecommitdiff
path: root/dht/examples
diff options
context:
space:
mode:
authorJoe Crayne <joe@jerkface.net>2019-11-29 02:42:53 -0500
committerJoe Crayne <joe@jerkface.net>2020-01-01 22:57:44 -0500
commitae914e1189a4f601388ad4b83be35e45bbc68d83 (patch)
treeaeb73e5582c8c42819f78b91ed6d49de87f81662 /dht/examples
parent521829739b8c1655ef5c56fd4bcf2097c22ad62f (diff)
Tox-XMPP: Switched to z-base32 domain names.
Diffstat (limited to 'dht/examples')
-rw-r--r--dht/examples/dhtd.hs14
1 files changed, 10 insertions, 4 deletions
diff --git a/dht/examples/dhtd.hs b/dht/examples/dhtd.hs
index 5f0eead8..3e9f8ff5 100644
--- a/dht/examples/dhtd.hs
+++ b/dht/examples/dhtd.hs
@@ -1302,21 +1302,27 @@ onNewToxSession sv ssvar invc ContactInfo{accounts} addrTox netcrypto = do
1302 return () 1302 return ()
1303 1303
1304selectManager :: Maybe (t -> ToxManager clientAddress) -> Manager Tcp.TCPStatus T.Text -> T.Text -> Manager Pending T.Text 1304selectManager :: Maybe (t -> ToxManager clientAddress) -> Manager Tcp.TCPStatus T.Text -> T.Text -> Manager Pending T.Text
1305selectManager mtman tcp profile = case T.splitAt 43 profile of 1305selectManager mtman tcp profile = case T.splitAt (T.length profile - 4) profile of
1306 (k,".tox") | Just tman <- mtman 1306 (k,".tox") | Just tman <- mtman
1307 -> let -- The following error call is safe because the toxConnections field 1307 -> let -- The following error call is safe because the toxConnections field
1308 -- does not make use of the PresenceState passed to tman. 1308 -- does not make use of the PresenceState passed to tman.
1309 tox = toxConnections $ tman $ error "PresenseState" 1309 tox = toxConnections $ tman $ error "PresenseState"
1310 tkey them = do 1310 tkey them = do
1311 me <- readMaybe (T.unpack k) 1311 me <- readMaybe (T.unpack k)
1312 them <- case T.splitAt 43 them of 1312 them <- case T.splitAt 52 them of
1313 (them0,".tox") -> readMaybe (T.unpack them0) 1313 (them0,".tox") -> readMaybe (T.unpack them0)
1314 _ -> Nothing 1314 _ -> case T.splitAt 43 them of
1315 (them0,".tox") -> readMaybe (T.unpack them0)
1316 _ -> Nothing
1315 return (Tox.ToxContact me them) 1317 return (Tox.ToxContact me them)
1316 in Manager 1318 in Manager
1317 { resolvePeer = \themhost -> do 1319 { resolvePeer = \themhost -> do
1318 r <- fromMaybe (return []) $ do 1320 r <- fromMaybe (return []) $ do
1319 (themT,".tox") <- Just $ T.splitAt 43 themhost 1321 themT <- case T.splitAt 52 themhost of
1322 (ts,".tox") -> Just ts
1323 _ -> case T.splitAt 43 themhost of
1324 (ts,".tox") -> Just ts
1325 _ -> Nothing
1320 them <- readMaybe $ T.unpack themT 1326 them <- readMaybe $ T.unpack themT
1321 me <- readMaybe $ T.unpack k 1327 me <- readMaybe $ T.unpack k
1322 let contact = Tox.ToxContact me them 1328 let contact = Tox.ToxContact me them