packages feed

check-email 0.1 → 1.0

raw patch · 2 files changed

+12/−10 lines, 2 filesdep +bytestringdep ~email-validatePVP ok

version bump matches the API change (PVP)

Dependencies added: bytestring

Dependency ranges changed: email-validate

API changes (from Hackage documentation)

- Network.Email.Check: check :: String -> IO (Either String EmailAddress)
+ Network.Email.Check: check :: ByteString -> IO (Either String EmailAddress)

Files

check-email.cabal view
@@ -1,7 +1,7 @@ Name:                check-email Category:            Network License-File:        LICENSE-Version:             0.1+Version:             1.0 Cabal-version:       >= 1.2 Build-type:          Simple Copyright:           2010 Chris Done@@ -13,12 +13,12 @@ Extra-source-files:  cbits/check-mx.h  Library-  Build-depends:    base >= 4 && < 5, email-validate >= 0.2 && <0.3+  Build-depends:    base >= 4 && < 5+                  , bytestring+                  , email-validate >= 0.2   Extensions:       ForeignFunctionInterface   Exposed-Modules:  Network.Email.Check   Ghc-options:      -Wall-  Extra-libraries:  gd, png, z, jpeg, m, fontconfig, freetype, expat-  Includes:         gd.h   Include-dirs:     cbits   Install-includes: check-mx.h   C-sources:        cbits/check-mx.c
src/Network/Email/Check.hsc view
@@ -2,9 +2,12 @@  module Network.Email.Check where -import Foreign.C.Types-import Text.Email.Validate+import Data.ByteString (ByteString)+import qualified Data.ByteString as S+import qualified Data.ByteString.Char8 as S8 import Foreign.C+import Foreign.C.Types+import Text.Email.Validate (validate,domainPart,EmailAddress)  #include "check-mx.h" @@ -13,13 +16,12 @@  -- | Check to see whether an email is (1) RFC-valid and (2) has an -- existant MX record.-check :: String -> IO (Either String EmailAddress)+check :: ByteString -> IO (Either String EmailAddress) check email = do   case validate email of     Left e -> return $ Left $ show e-    Right e -> do exists <- withCString (domainPart e) checkMx +    Right e -> do exists <- S.useAsCString (domainPart e) checkMx                   if exists /= 0                      then return $ Right e                      else return $ Left $ "no MX record exists for domain "-                                          ++ (domainPart e)-    +                                          ++ S8.unpack (domainPart e)