summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorJames Crayne <jim.crayne@gmail.com>2018-05-29 22:21:51 +0000
committerJames Crayne <jim.crayne@gmail.com>2018-05-29 22:21:51 +0000
commit620fdb0a2a6a80427895e4a40b9de3ec792c8d7c (patch)
treeebc11d6e5212f963caf2e7e86257d7c9f3f13a6d /examples
parentee0f50943efd65eb1c906338b00c204591826a16 (diff)
session command todo stubs
Diffstat (limited to 'examples')
-rw-r--r--examples/dhtd.hs31
1 files changed, 31 insertions, 0 deletions
diff --git a/examples/dhtd.hs b/examples/dhtd.hs
index df8cf1c4..60d60258 100644
--- a/examples/dhtd.hs
+++ b/examples/dhtd.hs
@@ -449,6 +449,9 @@ clientSession s@Session{..} sock cnum h = do
449 switchNetwork dest = do hPutClient h ("Network: "++dest) 449 switchNetwork dest = do hPutClient h ("Network: "++dest)
450 clientSession s{netname=dest} sock cnum h 450 clientSession s{netname=dest} sock cnum h
451 switchKey key = clientSession s { selectedKey = key } sock cnum h 451 switchKey key = clientSession s { selectedKey = key } sock cnum h
452 twoWords str = let (word1,a1) = break isSpace (dropWhile isSpace str)
453 (word2,a2) = break isSpace (dropWhile isSpace a1)
454 in (word1,word2,drop 1 a2)
452 strp = B.unpack . fst . until snd dropEnd . (,False) . B.dropWhile isSpace . B.pack 455 strp = B.unpack . fst . until snd dropEnd . (,False) . B.dropWhile isSpace . B.pack
453 where 456 where
454 dropEnd (x,_) = 457 dropEnd (x,_) =
@@ -475,6 +478,7 @@ clientSession s@Session{..} sock cnum h = do
475 , ["k"] 478 , ["k"]
476 , ["roster"] 479 , ["roster"]
477 , ["sessions"] 480 , ["sessions"]
481 , ["session"]
478 , ["netcrypto"] 482 , ["netcrypto"]
479 , ["onion"] 483 , ["onion"]
480 , ["g"] 484 , ["g"]
@@ -713,6 +717,33 @@ clientSession s@Session{..} sock cnum h = do
713 else do 717 else do
714 rows <- sessionsReport 718 rows <- sessionsReport
715 hPutClient h (showColumns (headers:rows)) 719 hPutClient h (showColumns (headers:rows))
720 ("session", s') | (idStr,"online",unstripped) <- twoWords s'
721 , stripped <- strp unstripped
722 -> cmd0 $
723 hPutClient h "TODO: parse idStr to get sessionId, lookup session, call sendOnline"
724 ("session", s') | (idStr,"offline",unstripped) <- twoWords s'
725 , stripped <- strp unstripped
726 -> cmd0 $
727 hPutClient h "TODO: parse idStr to get sessionId, lookup session, call sendOffline"
728 ("session", s') | (idStr,"kill",unstripped) <- twoWords s'
729 , stripped <- strp unstripped
730 -> cmd0 $
731 hPutClient h "TODO: parse idStr to get sessionId, lookup session, call sendKill"
732 ("session", s') | (idStr,"nick",unstripped) <- twoWords s'
733 , nick <- strp unstripped
734 -> cmd0 $
735 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'
737 , status <- strp unstripped
738 -> cmd0 $
739 hPutClient h "TODO: parse idStr to get sessionId, parse status, call setStatus"
740 ("session", s') | (idStr,"typing",unstripped) <- twoWords s'
741 , typingstatus <- strp unstripped
742 -> cmd0 $
743 hPutClient h "TODO: parse idStr to get sessionId, parse typing status, call setTyping"
744 ("session", s') | (idStr,"statusmsg",statusmsg) <- twoWords s'
745 -> cmd0 $
746 hPutClient h "TODO: parse idStr to get sessionId, call setStatusMsg"
716 747
717 ("onion", s) -> cmd0 $ join $ atomically $ do 748 ("onion", s) -> cmd0 $ join $ atomically $ do
718 rm <- readTVar $ routeMap onionRouter 749 rm <- readTVar $ routeMap onionRouter