summaryrefslogtreecommitdiffhomepage
path: root/Role/User.hs
diff options
context:
space:
mode:
authorJoey Hess <joeyh@joeyh.name>2017-04-27 10:29:33 -0400
committerJoey Hess <joeyh@joeyh.name>2017-04-27 10:29:33 -0400
commit952cc2941091518e61345f005b6e218bc34f75ec (patch)
treec5130b0dc4733f96b0855321919fe508b6d15fdc /Role/User.hs
parent937b55549b4ba72b0392d7e139e592a40eec2101 (diff)
downloaddebug-me-952cc2941091518e61345f005b6e218bc34f75ec.tar.gz
don't need Maybe ElapsedTime
Make it a monoid and use mempty = 0
Diffstat (limited to 'Role/User.hs')
-rw-r--r--Role/User.hs5
1 files changed, 2 insertions, 3 deletions
diff --git a/Role/User.hs b/Role/User.hs
index be546cf..e0599a8 100644
--- a/Role/User.hs
+++ b/Role/User.hs
@@ -84,7 +84,7 @@ startProtocol starttxt ochan logger = do
let c = mkSigned sk $ Control (SessionKey pk)
initialmessage $ ControlMessage c
let starttxt' = rawLine starttxt
- let act = mkSigned sk $ Activity (Seen (Val starttxt')) Nothing Nothing
+ let act = mkSigned sk $ Activity (Seen (Val starttxt')) Nothing mempty
let startmsg = ActivityMessage act
B.hPut stdout starttxt'
hFlush stdout
@@ -143,7 +143,7 @@ instance SendableToDeveloper Seen where
mkSigned (userSessionKey st) $
Activity seen
(loggedHash prev)
- (Just $ mkElapsedTime (lastSeenTs st) now)
+ (mkElapsedTime (lastSeenTs st) now)
let l = mkLog (User msg) now
writeTMChan ochan msg
writeTVar us $ st
@@ -306,7 +306,6 @@ reduceBacklog (b :| l) = b :| go 0 (take 1000 l)
-- Does not check the signature.
isLegalEntered :: Activity Entered -> UserState -> Bool
isLegalEntered (Activity _ Nothing _ _) _ = False
-isLegalEntered (Activity _ _ Nothing _) _ = False
isLegalEntered (Activity a (Just hp) _ _) us
| loggedHash lastact == Just hp = True
| B.null (val (echoData a)) = False -- optimisation