From 3b8c8d74db95fa8dc345a73101d2c1921655c70d Mon Sep 17 00:00:00 2001 From: joe Date: Wed, 18 Oct 2017 20:55:56 -0400 Subject: WIP: Command to publish a toxid on a given node. --- examples/dhtd.hs | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'examples') 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 , dhtParseId = readEither :: String -> Either String Tox.NodeId , dhtSearches = toxSearches , dhtFallbackNodes = return [] - , dhtAnnouncables = Map.empty -- TODO + , dhtAnnouncables = Map.fromList + [ ("toxid", DHTAnnouncable { announceSendData = \(pubkey,token) -> \case + Just ni -> + Tox.putRendezvous + (Tox.onionTimeout tox) + (Tox.toxCryptoKeys tox) + (Tox.toxOnion tox) + pubkey + token + ni + Nothing -> return Nothing + , announceParseData = \str tokstr -> + return $ do + pubkey <- Tox.id2key <$> readEither str + tok <- readEither tokstr + Right (pubkey,tok) + })] } dhts = Map.fromList $ ("tox4", toxDHT Tox.routing4) -- cgit v1.2.3