From 2313073b3e85ed2479ac4246de29e8867f51603b Mon Sep 17 00:00:00 2001 From: joe Date: Sun, 10 Jun 2018 02:20:55 -0400 Subject: Improved nid command JID parsing. --- examples/dhtd.hs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'examples') 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 Left ej -> if elem '@' s then "Error: " ++ ej else "Error: " ++ e - Right jid -> show jid - Right nid -> show nid ++ " nospam:" ++ drop 64 s + Right jid -> unlines [ show jid + , Tox.noSpamIdToHex jid ] + Right nid -> let nspam = drop 64 s + jid :: Maybe Tox.NoSpamId + jid = readMaybe $ '0':'x':nspam ++ "@" ++ show nid ++ ".tox" + in unlines [ maybe "" show jid + , show nid ++ " nospam:" ++ nspam ] Right nid -> show nid ("lan", _) -> cmd0 $ do -- cgit v1.2.3