module Bytor.Main where
import qualified Brick as B
import qualified Control.Concurrent.Chan as Chan
import qualified Data.Default as Def
import Data.Monoid (mempty)
import qualified Graphics.Vty as Vty
import qualified Network.Courriel.Parse as Courriel
import Data.Attoparsec.ByteString (IResult(..))
import Bytor.Draw
import Bytor.Event
import Bytor.Types
app :: B.App State Event Cursor
app = B.App
{ B.appDraw = \ st -> drawMain st -- [B.txt (_stMessage st)]
, B.appChooseCursor = B.showFirstCursor
, B.appHandleEvent = handleEvent
, B.appStartEvent = return
, B.appAttrMap = \ _ -> B.attrMap mempty []
}
main :: IO ()
main = do
rs <- Courriel.readBox "/home/gdritter/.mail/INBOX/cur"
mapM_ print [ Courriel.getSubject em | (_, Right em) <- rs ]
-- eventChan <- Chan.newChan
-- _ <- B.customMain (Vty.mkVty Def.def) (Just eventChan) app emptyState
return ()