diff options
author | Joey Hess <joeyh@joeyh.name> | 2014-12-29 15:16:40 -0400 |
---|---|---|
committer | Joey Hess <joeyh@joeyh.name> | 2014-12-29 15:16:40 -0400 |
commit | cdb6196ab7a6b7d9602512fcc745e9dab61a9ce8 (patch) | |
tree | 9ae74c330aaaf54f64a89c01fb1b449ad9682370 /Logs | |
parent | dd7bf0eedebe4f01d702f6450a5c0b5180775c07 (diff) |
setpresentkey: A new plumbing-level command.
Diffstat (limited to 'Logs')
-rw-r--r-- | Logs/Presence/Pure.hs | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/Logs/Presence/Pure.hs b/Logs/Presence/Pure.hs index ffeb78b26..6bf36d883 100644 --- a/Logs/Presence/Pure.hs +++ b/Logs/Presence/Pure.hs @@ -30,14 +30,16 @@ parseLog = mapMaybe parseline . lines where parseline l = LogLine <$> (utcTimeToPOSIXSeconds <$> parseTime defaultTimeLocale "%s%Qs" d) - <*> parsestatus s + <*> parseStatus s <*> pure rest where (d, pastd) = separate (== ' ') l (s, rest) = separate (== ' ') pastd - parsestatus "1" = Just InfoPresent - parsestatus "0" = Just InfoMissing - parsestatus _ = Nothing + +parseStatus :: String -> Maybe LogStatus +parseStatus "1" = Just InfoPresent +parseStatus "0" = Just InfoMissing +parseStatus _ = Nothing {- Generates a log file. -} showLog :: [LogLine] -> String |