diff options
author | Raúl Benencia <rul@kalgan.cc> | 2013-08-25 19:55:17 -0300 |
---|---|---|
committer | Raúl Benencia <rul@kalgan.cc> | 2013-08-25 19:55:17 -0300 |
commit | 89cd31ce1275bee6c8da8b3d9f4b00155a2e5fd2 (patch) | |
tree | 7a8f21de0ce363741925a24eb7982f26701b69a3 /Screen.hs | |
parent | 910d30227082dee795d0f32a99a5f972150f13c9 (diff) |
Added a couple of hooks
Diffstat (limited to 'Screen.hs')
-rw-r--r-- | Screen.hs | 12 |
1 files changed, 8 insertions, 4 deletions
@@ -34,9 +34,11 @@ liftUpdate = lift . lift entryPoint :: Lazymail () entryPoint = do st <- get - maildirs <- liftIO $ getMaildirsRecursively $ basePath st - let mdState = (maildirState st) { detectedMDs = maildirs } cfg <- ask + maildirs <- liftIO $ do + mds <- getMaildirsRecursively $ basePath st + (filterMaildirsHook cfg) mds + let mdState = (maildirState st) { detectedMDs = maildirs } liftIO $ runCurses $ runStateT (runReaderT startCurses cfg) (st { maildirState = mdState }) return () @@ -88,16 +90,18 @@ drawMaildirHelper :: [FilePath] -> LazymailUpdate () drawMaildirHelper [] = resetCurrentRow drawMaildirHelper (md:mds) = do st <- get + cfg <- ask + let ppMd = (maildirDrawHook cfg) (basePath st) md liftUpdate $ moveCursor (curRowAsInteger st) (colPadAsInteger st) if (selectedRow st == currentRow st) then do liftUpdate $ do setColor $ selectionColorID . colorStyle $ st - drawString $ normalizeLen (screenColumns st) md + drawString $ normalizeLen (screenColumns st) ppMd setColor $ baseColorID . colorStyle $ st let maildirState' = (maildirState st) { selectedMD = md } put $ st { maildirState = maildirState' } - else liftUpdate $ drawString $ normalizeLen (screenColumns st) md + else liftUpdate $ drawString $ normalizeLen (screenColumns st) ppMd st <- get let limit = if statusBar st then (screenRows st) - 1 else screenRows st |