From 620fdb0a2a6a80427895e4a40b9de3ec792c8d7c Mon Sep 17 00:00:00 2001 From: James Crayne Date: Tue, 29 May 2018 22:21:51 +0000 Subject: session command todo stubs --- examples/dhtd.hs | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) 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 switchNetwork dest = do hPutClient h ("Network: "++dest) clientSession s{netname=dest} sock cnum h switchKey key = clientSession s { selectedKey = key } sock cnum h + twoWords str = let (word1,a1) = break isSpace (dropWhile isSpace str) + (word2,a2) = break isSpace (dropWhile isSpace a1) + in (word1,word2,drop 1 a2) strp = B.unpack . fst . until snd dropEnd . (,False) . B.dropWhile isSpace . B.pack where dropEnd (x,_) = @@ -475,6 +478,7 @@ clientSession s@Session{..} sock cnum h = do , ["k"] , ["roster"] , ["sessions"] + , ["session"] , ["netcrypto"] , ["onion"] , ["g"] @@ -713,6 +717,33 @@ clientSession s@Session{..} sock cnum h = do else do rows <- sessionsReport hPutClient h (showColumns (headers:rows)) + ("session", s') | (idStr,"online",unstripped) <- twoWords s' + , stripped <- strp unstripped + -> cmd0 $ + hPutClient h "TODO: parse idStr to get sessionId, lookup session, call sendOnline" + ("session", s') | (idStr,"offline",unstripped) <- twoWords s' + , stripped <- strp unstripped + -> cmd0 $ + hPutClient h "TODO: parse idStr to get sessionId, lookup session, call sendOffline" + ("session", s') | (idStr,"kill",unstripped) <- twoWords s' + , stripped <- strp unstripped + -> cmd0 $ + hPutClient h "TODO: parse idStr to get sessionId, lookup session, call sendKill" + ("session", s') | (idStr,"nick",unstripped) <- twoWords s' + , nick <- strp unstripped + -> cmd0 $ + hPutClient h "TODO: parse idStr to get sessionId, lookup session, call setNick with crypto session and nick" + ("session", s') | (idStr,"status",unstripped) <- twoWords s' + , status <- strp unstripped + -> cmd0 $ + hPutClient h "TODO: parse idStr to get sessionId, parse status, call setStatus" + ("session", s') | (idStr,"typing",unstripped) <- twoWords s' + , typingstatus <- strp unstripped + -> cmd0 $ + hPutClient h "TODO: parse idStr to get sessionId, parse typing status, call setTyping" + ("session", s') | (idStr,"statusmsg",statusmsg) <- twoWords s' + -> cmd0 $ + hPutClient h "TODO: parse idStr to get sessionId, call setStatusMsg" ("onion", s) -> cmd0 $ join $ atomically $ do rm <- readTVar $ routeMap onionRouter -- cgit v1.2.3