summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorJames Crayne <jim.crayne@gmail.com>2018-05-29 22:47:29 +0000
committerJames Crayne <jim.crayne@gmail.com>2018-05-29 22:47:29 +0000
commit5902c68ed88b5bae956753cf5fd88f236545e019 (patch)
tree957df295f305736100d52fea8982e75b8ed63845 /examples
parent71f7ca88339f1793f21fecbd36e84f6e18e915bd (diff)
Comments & variable names only
Diffstat (limited to 'examples')
-rw-r--r--examples/dhtd.hs33
1 files changed, 25 insertions, 8 deletions
diff --git a/examples/dhtd.hs b/examples/dhtd.hs
index 78090794..8fd707cd 100644
--- a/examples/dhtd.hs
+++ b/examples/dhtd.hs
@@ -684,7 +684,8 @@ clientSession s@Session{..} sock cnum h = do
684 hPutClientChunk h $ unlines [ dns, "", "Friend Requests" ] 684 hPutClientChunk h $ unlines [ dns, "", "Friend Requests" ]
685 hPutClient h $ showReport frs 685 hPutClient h $ showReport frs
686 686
687 ("sessions", s') | "" <- strp s' 687 -- list information about current netcrypto sesssions
688 ("sessions", s) | "" <- strp s
688 -> cmd0 $ do 689 -> cmd0 $ do
689 sessions <- concat . Map.elems <$> (atomically $ readTVar (Tox.netCryptoSessionsByKey cryptosessions)) 690 sessions <- concat . Map.elems <$> (atomically $ readTVar (Tox.netCryptoSessionsByKey cryptosessions))
690 let sessionsReport = mapM showPerSession sessions 691 let sessionsReport = mapM showPerSession sessions
@@ -717,31 +718,45 @@ clientSession s@Session{..} sock cnum h = do
717 else do 718 else do
718 rows <- sessionsReport 719 rows <- sessionsReport
719 hPutClient h (showColumns (headers:rows)) 720 hPutClient h (showColumns (headers:rows))
720 ("session", s') | (idStr,"online",unstripped) <- twoWords s' 721 -- session <N> online
722 -- send ONLINE packet to session N
723 ("session", s) | (idStr,"online",unstripped) <- twoWords s
721 , stripped <- strp unstripped 724 , stripped <- strp unstripped
722 -> cmd0 $ 725 -> cmd0 $
723 hPutClient h "TODO: parse idStr to get sessionId, lookup session, call sendOnline" 726 hPutClient h "TODO: parse idStr to get sessionId, lookup session, call sendOnline"
724 ("session", s') | (idStr,"offline",unstripped) <- twoWords s' 727 -- session <N> online
728 -- send OFFLINE packet to session N
729 ("session", s) | (idStr,"offline",unstripped) <- twoWords s
725 , stripped <- strp unstripped 730 , stripped <- strp unstripped
726 -> cmd0 $ 731 -> cmd0 $
727 hPutClient h "TODO: parse idStr to get sessionId, lookup session, call sendOffline" 732 hPutClient h "TODO: parse idStr to get sessionId, lookup session, call sendOffline"
728 ("session", s') | (idStr,"kill",unstripped) <- twoWords s' 733 -- session <N> kill
734 -- send KILL packet to session N
735 ("session", s) | (idStr,"kill",unstripped) <- twoWords s
729 , stripped <- strp unstripped 736 , stripped <- strp unstripped
730 -> cmd0 $ 737 -> cmd0 $
731 hPutClient h "TODO: parse idStr to get sessionId, lookup session, call sendKill" 738 hPutClient h "TODO: parse idStr to get sessionId, lookup session, call sendKill"
732 ("session", s') | (idStr,"nick",unstripped) <- twoWords s' 739 -- session <N> nick <NICKNAME>
740 -- send NICK packet to session N, setting nick to NICKNAME
741 ("session", s) | (idStr,"nick",unstripped) <- twoWords s
733 , nick <- strp unstripped 742 , nick <- strp unstripped
734 -> cmd0 $ 743 -> cmd0 $
735 hPutClient h "TODO: parse idStr to get sessionId, lookup session, call setNick with crypto session and nick" 744 hPutClient h "TODO: parse idStr to get sessionId, lookup session, call setNick with crypto session and nick"
736 ("session", s') | (idStr,"status",unstripped) <- twoWords s' 745 -- session <N> status <STATUS>
746 -- send USERSTATUS packet to session N, set status to STATUS
747 ("session", s) | (idStr,"status",unstripped) <- twoWords s
737 , status <- strp unstripped 748 , status <- strp unstripped
738 -> cmd0 $ 749 -> cmd0 $
739 hPutClient h "TODO: parse idStr to get sessionId, parse status, call setStatus" 750 hPutClient h "TODO: parse idStr to get sessionId, parse status, call setStatus"
740 ("session", s') | (idStr,"typing",unstripped) <- twoWords s' 751 -- session <N> typing <TYPINGSTATUS>
752 -- send TYPING packet to session N, set typing to TYPINGSTATUS
753 ("session", s) | (idStr,"typing",unstripped) <- twoWords s
741 , typingstatus <- strp unstripped 754 , typingstatus <- strp unstripped
742 -> cmd0 $ 755 -> cmd0 $
743 hPutClient h "TODO: parse idStr to get sessionId, parse typing status, call setTyping" 756 hPutClient h "TODO: parse idStr to get sessionId, parse typing status, call setTyping"
744 ("session", s') | (idStr,"statusmsg",statusmsg) <- twoWords s' 757 -- session <N> statusmsg <MSG>
758 -- send STATUSMESSAGE packet to session N, setting status message to MSG
759 ("session", s) | (idStr,"statusmsg",statusmsg) <- twoWords s
745 -> cmd0 $ 760 -> cmd0 $
746 hPutClient h "TODO: parse idStr to get sessionId, call setStatusMsg" 761 hPutClient h "TODO: parse idStr to get sessionId, call setStatusMsg"
747 762
@@ -760,6 +775,8 @@ clientSession s@Session{..} sock cnum h = do
760 hPutClientChunk h $ "trampolines: " ++ show (IntMap.size ts) ++ "\n" 775 hPutClientChunk h $ "trampolines: " ++ show (IntMap.size ts) ++ "\n"
761 hPutClient h $ showColumns $ ["","responses","timeouts"]:r 776 hPutClient h $ showColumns $ ["","responses","timeouts"]:r
762 777
778 -- necrypto <FRIEND-TOXID>
779 -- establish a netcrypto session with specified person
763 ("netcrypto", s) 780 ("netcrypto", s)
764 | Just DHT{..} <- Map.lookup netname dhts 781 | Just DHT{..} <- Map.lookup netname dhts
765 -> cmd0 $ do 782 -> cmd0 $ do