summaryrefslogtreecommitdiff
path: root/examples/dhtd.hs
diff options
context:
space:
mode:
authorjoe <joe@jerkface.net>2018-06-20 22:34:42 -0400
committerjoe <joe@jerkface.net>2018-06-20 22:34:42 -0400
commit09aa079fbab069f177e08b5239bf684d312eb00a (patch)
tree06fb9886877c977e3a3a7d5716365638234d9366 /examples/dhtd.hs
parent41adc928f46a70c88f2f64ee1dfe36e3501883bb (diff)
More information in "roster" output.
Diffstat (limited to 'examples/dhtd.hs')
-rw-r--r--examples/dhtd.hs30
1 files changed, 21 insertions, 9 deletions
diff --git a/examples/dhtd.hs b/examples/dhtd.hs
index d0d8678d..355450a2 100644
--- a/examples/dhtd.hs
+++ b/examples/dhtd.hs
@@ -606,16 +606,28 @@ clientSession s@Session{..} sock cnum h = do
606 Just k 606 Just k
607 607
608 ("roster", s) -> cmd0 $ join $ atomically $ do 608 ("roster", s) -> cmd0 $ join $ atomically $ do
609 dns <- dnsPresentation roster 609 let ContactInfo{accounts} = roster
610 fs <- HashMap.toList <$> friendRequests roster 610 as <- readTVar accounts
611 let showFriend (remotekey,fr) = 611 css <- forM as $ \acnt -> do
612 (" " ++ show remotekey, T.unpack $ T.decodeUtf8 $ Tox.friendRequestText fr) 612 cs <- readTVar (contacts acnt)
613 showAccount (me,cs) = 613 forM cs $ \c -> do
614 [(show me,"")] ++ map showFriend cs 614 ck <- readTVar $ contactKeyPacket c
615 frs = fs >>= showAccount 615 ca <- readTVar $ contactLastSeenAddr c
616 cf <- readTVar $ contactFriendRequest c
617 cp <- readTVar $ contactPolicy c
618 return $ [ maybe "none" show cp
619 , maybe "" (show . Tox.key2id . Tox.dhtpk . snd) ck
620 , maybe "" (show . snd) ca
621 , maybe "" (T.unpack . T.decodeUtf8 . Tox.friendRequestText . snd) cf
622 ]
616 return $ do 623 return $ do
617 hPutClientChunk h $ unlines [ dns, "", "Friend Requests" ] 624 forM_ (HashMap.toList css) $ \(me,xss) -> do
618 hPutClient h $ showReport frs 625 let cs = map (\(toxid,xs) -> show toxid : xs)
626 $ HashMap.toList xss
627 hPutClientChunk h $ unlines [ show me, map (const '-') (show me) ]
628 hPutClientChunk h $ showColumns $ ["ToxID","Policy","NodeID","Address","FR text"]
629 : cs
630 hPutClient h ""
619 631
620 ("quiet",s) | s' <- strp s 632 ("quiet",s) | s' <- strp s
621 , Just (tag::DebugTag) <- readMaybe ('X':map toUpper (take 1 s') ++ drop 1 s') 633 , Just (tag::DebugTag) <- readMaybe ('X':map toUpper (take 1 s') ++ drop 1 s')