diff options
author | joe <joe@jerkface.net> | 2017-10-18 20:55:56 -0400 |
---|---|---|
committer | joe <joe@jerkface.net> | 2017-10-18 20:55:56 -0400 |
commit | 3b8c8d74db95fa8dc345a73101d2c1921655c70d (patch) | |
tree | 3227ac1e43e7222ea2bf5e53c6b502e9a7838b9b /examples/dhtd.hs | |
parent | 35aed24bdd67cecbd77e0c64c6c054e736aac787 (diff) |
WIP: Command to publish a toxid on a given node.
Diffstat (limited to 'examples/dhtd.hs')
-rw-r--r-- | examples/dhtd.hs | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/examples/dhtd.hs b/examples/dhtd.hs index 6529e746..bd2df9db 100644 --- a/examples/dhtd.hs +++ b/examples/dhtd.hs | |||
@@ -706,7 +706,23 @@ main = do | |||
706 | , dhtParseId = readEither :: String -> Either String Tox.NodeId | 706 | , dhtParseId = readEither :: String -> Either String Tox.NodeId |
707 | , dhtSearches = toxSearches | 707 | , dhtSearches = toxSearches |
708 | , dhtFallbackNodes = return [] | 708 | , dhtFallbackNodes = return [] |
709 | , dhtAnnouncables = Map.empty -- TODO | 709 | , dhtAnnouncables = Map.fromList |
710 | [ ("toxid", DHTAnnouncable { announceSendData = \(pubkey,token) -> \case | ||
711 | Just ni -> | ||
712 | Tox.putRendezvous | ||
713 | (Tox.onionTimeout tox) | ||
714 | (Tox.toxCryptoKeys tox) | ||
715 | (Tox.toxOnion tox) | ||
716 | pubkey | ||
717 | token | ||
718 | ni | ||
719 | Nothing -> return Nothing | ||
720 | , announceParseData = \str tokstr -> | ||
721 | return $ do | ||
722 | pubkey <- Tox.id2key <$> readEither str | ||
723 | tok <- readEither tokstr | ||
724 | Right (pubkey,tok) | ||
725 | })] | ||
710 | } | 726 | } |
711 | dhts = Map.fromList $ | 727 | dhts = Map.fromList $ |
712 | ("tox4", toxDHT Tox.routing4) | 728 | ("tox4", toxDHT Tox.routing4) |