From 3bd3fd2c6eae2f36f69f247403421e8cf8226394 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20Benencia?= Date: Thu, 5 Sep 2013 19:57:02 -0300 Subject: Moved all code to src/ --- src/Lazymail/Config.hs | 55 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 src/Lazymail/Config.hs (limited to 'src/Lazymail/Config.hs') diff --git a/src/Lazymail/Config.hs b/src/Lazymail/Config.hs new file mode 100644 index 0000000..2566bc9 --- /dev/null +++ b/src/Lazymail/Config.hs @@ -0,0 +1,55 @@ +{- Lazymail user configuration + - + - Copyright 2013 Raúl Benencia + - + - Licensed under the GNU GPL version 3 or higher + - + -} + +module Lazymail.Config(LazymailConfig(..), defaultConfig, customConfig) where + +import Data.List(sort, stripPrefix) +import System.Posix.Files(getSymbolicLinkStatus, isSymbolicLink) +import UI.NCurses(Color(..)) + +import Lazymail.Keymap +import Lazymail.Types(LazymailConfig(..)) + +defaultConfig = LazymailConfig { + baseColor = (ColorWhite, ColorBlack) + , selectionColor = (ColorBlack, ColorWhite) + , statusBarColor = (ColorBlack, ColorBlue) + , headerColor = (ColorGreen, ColorBlack) + , newEmailColor = (ColorBlue, ColorBlack) + , showStatusBar = True + , initialPath = "" + , filterMaildirsHook = \mds -> return mds + , indexDateFormat = "%m %d" + , headersToShow = ["date", "from", "to", "cc", "bcc", "subject", "reply-to"] + , globalKeymaps = defaultGlobalKeymap + , maildirModeKeymap = defaultMaildirKeymap + , indexModeKeymap = defaultIndexKeymap + , emailModeKeymap = defaultEmailKeymap + , composeModeKeymap = defaultComposeKeymap +} + +-- +-- | Users should modify customConfig in order to set-up their +-- preferences. In a possible future maybe I'll work in a not-so-crappy +-- config system. +-- +--customConfig = defaultConfig { initialPath = "/home/rul/mail/"} + +customConfig = defaultConfig { initialPath = "/home/rul/mail/" + , filterMaildirsHook = filterSymlinks } + +filterSymlinks :: [FilePath] -> IO [FilePath] +filterSymlinks [] = return [] +filterSymlinks (md:mds) = do + filtered <- do + fs <- getSymbolicLinkStatus md + rest <- filterSymlinks mds + if isSymbolicLink fs + then return rest + else return (md:rest) + return $ sort filtered \ No newline at end of file -- cgit v1.2.3