[Pkg-haskell-commits] [SCM] haskell-testpack branch, master, updated. debian/1.0.2-1-4-gb0d6b36

John Goerzen jgoerzen at complete.org
Fri Apr 23 14:50:34 UTC 2010


The following commit has been merged in the master branch:
commit 563bd2062b7f07af6bcb47ecf53757e91ce30d97
Author: John Goerzen <jgoerzen at complete.org>
Date:   Fri Dec 10 03:16:35 2004 +0100

    Backed out custom mail parser; documented one in wash instead
    
    Keywords:
    
    
    (jgoerzen at complete.org--projects/missingh--head--0.7--patch-61)

diff --git a/ChangeLog b/ChangeLog
index 3ac7fae..61eab2e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,20 @@
 # arch-tag: automatic-ChangeLog--jgoerzen at complete.org--projects/missingh--head--0.7
 #
 
+2004-12-09 20:16:35 GMT	John Goerzen <jgoerzen at complete.org>	patch-61
+
+    Summary:
+      Backed out custom mail parser; documented one in wash instead
+    Revision:
+      missingh--head--0.7--patch-61
+
+
+    modified files:
+     ChangeLog libsrc/MissingH/Email/Parser.hs
+     libsrc/MissingH/Wash/Mail/MailParser.hs
+     libsrc/MissingH/Wash/Mail/Message.hs
+
+
 2004-12-09 17:29:25 GMT	John Goerzen <jgoerzen at complete.org>	patch-60
 
     Summary:
diff --git a/libsrc/MissingH/Email/Parser.hs b/libsrc/MissingH/Email/Parser.hs
index c5c5472..e948b13 100644
--- a/libsrc/MissingH/Email/Parser.hs
+++ b/libsrc/MissingH/Email/Parser.hs
@@ -43,32 +43,7 @@ import Text.ParserCombinators.Parsec
 import Control.Monad.Error
 import Text.ParserCombinators.Parsec.Error
 import Text.ParserCombinators.Parsec.Pos(newPos)
-
-instance Error ParseError where
-    noMsg = strMsg ""
-    strMsg s = newErrorMessage (Message s) (newPos "" 0 0)
-
-getHeaders :: CharParser a [(String, String)]
-getHeaders =  many $ optional_field
-
-parseMsg :: CharParser a ([(String, String)], String)
-parseMsg = do f <- getHeaders
-              crlf
-              b <- body
-              return (f, b)
-
-{- | Parse a string as an e-mail, returning a
-'MissingH.Wash.Mail.Message.Message' object. 
-
-ParseError is defined in Text.ParserCombinators.Parsec.Error.
--}
-
-mailParser :: String -> Either ParseError MissingH.Wash.Mail.Message.Message
-mailParser s = do 
-               p <- parse parseMsg ""  s
-               let raw = RawMessage {rawHeaders = map Header (fst p),
-                                     rawLines = lines (snd p)}
-               return $ digestMessage raw
+import MissingH.Str
 
 {- | Given a 'MissingH.Wash.Mail.Message.Message' object, \"flatten\"
 it into a simple, non-hierarchical list of its component single parts.
diff --git a/libsrc/MissingH/Wash/Mail/MailParser.hs b/libsrc/MissingH/Wash/Mail/MailParser.hs
index 2f378d0..3dbace9 100644
--- a/libsrc/MissingH/Wash/Mail/MailParser.hs
+++ b/libsrc/MissingH/Wash/Mail/MailParser.hs
@@ -15,12 +15,15 @@ import MissingH.Wash.Utility.RFC2047 (p_token)
 import MissingH.Wash.Mail.Message
 import MissingH.Wash.Mail.HeaderField
 
+parseMessageFromFile :: FilePath -> IO (Either ParseError RawMessage)
 parseMessageFromFile fname =
   parseFromFile message fname
 
+parseMessageFromString :: String -> Either ParseError RawMessage
 parseMessageFromString str =
   parse message "MailParser" str
 
+parseDateTimeFromString :: String -> Either ParseError DateTime2822
 parseDateTimeFromString str =
   parse parseDateTime "DateTimeParser" (' ':str)
 
diff --git a/libsrc/MissingH/Wash/Mail/Message.hs b/libsrc/MissingH/Wash/Mail/Message.hs
index ee69abd..8668fbe 100644
--- a/libsrc/MissingH/Wash/Mail/Message.hs
+++ b/libsrc/MissingH/Wash/Mail/Message.hs
@@ -21,14 +21,18 @@ data Message =
 	}
     deriving Show
 
+isSinglePart :: Message -> Bool
 isSinglePart (Singlepart {}) = True
 isSinglePart _ = False
 
+isMultiPart :: Message -> Bool
 isMultiPart (Multipart {}) = True
 isMultiPart _ = False
 
+showHeader :: Header -> String
 showHeader (Header (n, v)) = n ++ ": " ++ v
 
+showParameters :: [(String, String)] -> String -> String
 showParameters c_parameters =
     foldr (\(n,v) f -> showString " ;" .
     		       showString n .

-- 
haskell-testpack



More information about the Pkg-haskell-commits mailing list