summaryrefslogtreecommitdiff
path: root/examples/dhtd.hs
diff options
context:
space:
mode:
authorjoe <joe@jerkface.net>2018-06-10 02:20:55 -0400
committerjoe <joe@jerkface.net>2018-06-10 02:20:55 -0400
commit2313073b3e85ed2479ac4246de29e8867f51603b (patch)
tree1a602dd6411d23364832a3e8fe019f1ecfd0ce2e /examples/dhtd.hs
parentb1a8e947df45ce363da7d2787ec487dedac3c397 (diff)
Improved nid command JID parsing.
Diffstat (limited to 'examples/dhtd.hs')
-rw-r--r--examples/dhtd.hs9
1 files changed, 7 insertions, 2 deletions
diff --git a/examples/dhtd.hs b/examples/dhtd.hs
index ea94b7ce..58a69c6a 100644
--- a/examples/dhtd.hs
+++ b/examples/dhtd.hs
@@ -505,8 +505,13 @@ clientSession s@Session{..} sock cnum h = do
505 Left ej -> if elem '@' s 505 Left ej -> if elem '@' s
506 then "Error: " ++ ej 506 then "Error: " ++ ej
507 else "Error: " ++ e 507 else "Error: " ++ e
508 Right jid -> show jid 508 Right jid -> unlines [ show jid
509 Right nid -> show nid ++ " nospam:" ++ drop 64 s 509 , Tox.noSpamIdToHex jid ]
510 Right nid -> let nspam = drop 64 s
511 jid :: Maybe Tox.NoSpamId
512 jid = readMaybe $ '0':'x':nspam ++ "@" ++ show nid ++ ".tox"
513 in unlines [ maybe "" show jid
514 , show nid ++ " nospam:" ++ nspam ]
510 Right nid -> show nid 515 Right nid -> show nid
511 516
512 ("lan", _) -> cmd0 $ do 517 ("lan", _) -> cmd0 $ do