google-mail-filters 0.0.1.1 → 0.0.1.2
raw patch · 3 files changed
+63/−23 lines, 3 filesdep ~google-searchdep ~timePVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependency ranges changed: google-search, time
API changes (from Hackage documentation)
- Data.Google.Mail.Filters: actions :: Filter -> [Action]
- Data.Google.Mail.Filters: hasTheWord :: Filter -> Mail
- Data.Google.Mail.Filters: instance Show Action
- Data.Google.Mail.Filters: instance Show Filter
+ Data.Google.Mail.Filters: [actions] :: Filter -> [Action]
+ Data.Google.Mail.Filters: [hasTheWord] :: Filter -> Mail
+ Data.Google.Mail.Filters: instance GHC.Show.Show Data.Google.Mail.Filters.Action
+ Data.Google.Mail.Filters: instance GHC.Show.Show Data.Google.Mail.Filters.Filter
Files
- example.hs +46/−17
- google-mail-filters.cabal +14/−5
- src/Data/Google/Mail/Filters.hs +3/−1
example.hs view
@@ -1,9 +1,16 @@+{-# LANGUAGE CPP #-} {-# LANGUAGE OverloadedStrings #-}+{-# OPTIONS_GHC -Wall #-} import Prelude+#if !MIN_VERSION_base(4,8,0) import Control.Applicative+#endif+import qualified Data.Text.Lazy as TL+import qualified Data.Text.Lazy.Builder as B import qualified Data.Text.Lazy.IO as TL import Data.Time.Clock+import System.IO import Text.XML as XML import Language.Google.Search.Simple as Search@@ -16,27 +23,49 @@ TL.putStrLn . XML.renderText def {rsPretty = True} $ Filters.toXML now ("Your Name", "you@example.com") filters + -- Search Terms for GMail Labs' ‘Quick Links’ by Dan P+ TL.hPutStrLn stderr . TL.append "old:\t" . searchText $ orB+ [ pure (Label "notification") /\ pure (Older 1 Months)+ , pure (Label "dev") /\ pure (Older 6 Months)+ :: Search.Mail ]++searchText :: (SearchBuilder e) => e -> TL.Text+searchText s = B.toLazyText b where PrecBuilder _prec b = searchBuilder s+ filters :: [Filter] filters =+ [ Filter [Archive, LabelAs "shopping"]+ $ (pure . From . orB)+ [ "googleplay-noreply@google.com"+ , "noreply@indiegogo.com" ]+ \/ ( pure . From $ "amazon" /\ orB+ ["confirm", "digital", "marketplace", "no-reply", "update"] )+ \/ andB [ pure $ From "no-reply@kickstarter.com"+ , notB . pure $ Subject "reminder" ] - [ Filter [Archive, LabelAs "shopping"] $ orB- [ pure (From $ ("auto-confirm" \/ "noreply") /\ "amazon")- , pure (From "no-reply@kickstarter.com")- , pure (From $ "service" /\ "paypal")+ , Filter [Archive, LabelAs "dev"] $ orB+ [ pure (From "ghc-devs@haskell.org")+ /\ pure (Cc "ghc-tickets@haskell.org")+ , pure . Subject $ Exact <$> "Haskell Weekly News"+ , (pure . From . orB)+ [ "notifications@travis-ci.org"+ , "notifications@github.com"+ , "googlecode.com"+ ] ] - , Filter [Archive, LabelAs "haskell"]- $ pure (List "haskell-cafe.haskell.org")- /\ notB haskellWeeklyNews -- keep in inbox- , Filter [LabelAs "haskell"] haskellWeeklyNews-- , Filter [LabelAs "notification", MarkAsImportant False, NeverSpam] $ orB- [ pure $ From "plus.google.com"- , pure $ From "facebookmail.com"- , pure $ From "postmaster.twitter.com"- , pure $ From "noreply@foursquare.com"- ]+ , Filter [LabelAs "notification", MarkAsImportant False, NeverSpam]+ $ (pure . From . orB)+ [ "MAILER-DAEMON"+ , "facebookmail.com"+ , "no-reply@mail.instagram.com"+ , "noreply@foursquare.com"+ , "noreply@youtube.com"+ , "notifications.pinterest.com"+ , "notify@twitter.com"+ , "plus.google.com"+ ]+ \/ pure (List "meetup.com") - ] where- haskellWeeklyNews = pure . Subject $ Exact <$> "Haskell Weekly News"+ ]
google-mail-filters.cabal view
@@ -1,5 +1,5 @@ name: google-mail-filters-version: 0.0.1.1+version: 0.0.1.2 synopsis: Write GMail filters and output to importable XML description: Organise your Google Mail filters as a Haskell EDSL, and produce XML@@ -18,24 +18,33 @@ stability: experimental extra-source-files: example.hs+tested-with:+ GHC == 7.4.2, GHC == 7.6.3, GHC == 7.8.4,+ GHC == 7.10.2, GHC == 7.10.3 source-repository head type: git location: http://github.com/liyang/google-mail-filters +flag old-time+ description: time < 1.5+ default: False+ library hs-source-dirs: src+ ghc-options: -Wall exposed-modules: Data.Google.Mail.Filters build-depends: base >= 4.5 && <= 9000, containers >= 0.4,- google-search >= 0.1.0.1,- old-locale >= 1.0,+ google-search >= 0.2.0.0, text >= 0.11,- time >= 1.4, xml-conduit >= 0.7- ghc-options: -Wall+ if flag(old-time)+ build-depends: old-locale >= 1.0, time >= 1.4 && < 1.5+ else+ build-depends: time >= 1.5 test-suite example type: exitcode-stdio-1.0
src/Data/Google/Mail/Filters.hs view
@@ -15,7 +15,9 @@ import qualified Data.Text.Lazy.Builder as B import Data.Time.Clock import Data.Time.Format-import System.Locale+#if !MIN_VERSION_time(1,5,0)+import System.Locale (defaultTimeLocale)+#endif import Text.XML import Language.Google.Search.Simple as Search