module Network.DomainAuth.Mail.Types where
import Data.ByteString (ByteString)
import qualified Data.ByteString.Char8 as BS
import Data.Char
import Data.Sequence
type RawMail = ByteString
type RawHeader = ByteString
type RawBody = ByteString
type RawField = ByteString
type RawFieldKey = ByteString
type RawFieldValue = ByteString
type RawBodyChunk = ByteString
data Mail = Mail {
mailHeader :: Header
, mailBody :: Body
} deriving (Eq,Show)
isEmpty :: Body -> Bool
isEmpty = (== empty)
type Header = [Field]
data Field = Field {
fieldSearchKey :: CanonFieldKey
, fieldKey :: FieldKey
, fieldValue :: FieldValue
} deriving (Eq,Show)
type CanonFieldKey = ByteString
type FieldKey = ByteString
type FieldValue = [ByteString]
type Body = Seq ByteString
canonicalizeKey :: FieldKey -> CanonFieldKey
canonicalizeKey = BS.map toLower