|
@@ -12,7 +12,7 @@ import Data.SMTP.Account
|
|
|
|
|
|
import qualified Data.SMTP.Mime as Mime
|
|
|
import Data.SMTP.Response
|
|
|
-import Text.StringConvert
|
|
|
+import qualified Text.StringConvert as SC
|
|
|
|
|
|
import Data.Time.ISO8601
|
|
|
import Data.IP
|
|
@@ -59,7 +59,7 @@ data MaybeMetadata = MaybeMetadata {_mclientId :: Maybe ClientIdentity, _mclient
|
|
|
uq :: Eq a => (b -> a) -> b -> b -> Bool
|
|
|
uq f a b = f a == f b
|
|
|
|
|
|
-sq :: (Eq a, Ord a) => (b -> [a]) -> b -> b -> Bool
|
|
|
+sq :: Ord a => (b -> [a]) -> b -> b -> Bool
|
|
|
sq f a b = (List.sort . f $ a) == (List.sort . f $ b)
|
|
|
|
|
|
|
|
@@ -233,7 +233,7 @@ renderMetadata m = BS.concat $ serializeDt ++ serializeMain ++ ["\r\n"]
|
|
|
"Recv-Date: ", formatISO8601 rcv, "\r\n",
|
|
|
"Data-Size: ", show sz, "\r\n"
|
|
|
] :: [String]
|
|
|
- in map s h ++ usrStr ++ unrec
|
|
|
+ in map SC.s h ++ usrStr ++ unrec
|
|
|
serializeDt = case m^.actionData of
|
|
|
Deliver dt -> "Action: DELIVER\r\n" : serializeDeliver dt
|
|
|
WillHandle dt -> "Action: WILLHANDLE\r\n" : serializeHandle dt
|
|
@@ -250,32 +250,32 @@ renderMetadata m = BS.concat $ serializeDt ++ serializeMain ++ ["\r\n"]
|
|
|
toStr = List.concatMap (\x -> ["To: ", fullAccount x, "\r\n"]) rto
|
|
|
failStr = List.concatMap (\(a, r) -> ["Failed: ", fullAccount a, "; ", renderLineResponse r, "\r\n"]) rfail
|
|
|
h = [
|
|
|
- "Client-Name: ", s cnm, "\r\n",
|
|
|
- "Return-Path: ", s . normalize $ rfm, "\r\n",
|
|
|
+ "Client-Name: ", SC.s cnm, "\r\n",
|
|
|
+ "Return-Path: ", SC.s . normalize $ rfm, "\r\n",
|
|
|
"Body-Encoding: ", show enc, "\r\n",
|
|
|
"SMTP-UTF8: ", serialBool utf, "\r\n"
|
|
|
] :: [String]
|
|
|
- in map s h ++ toStr ++ failStr
|
|
|
- serializeHandle (AccountRequest a) = ["To: ", s . fullAccount $ a, "\r\n"]
|
|
|
+ in map SC.s h ++ toStr ++ failStr
|
|
|
+ serializeHandle (AccountRequest a) = ["To: ", SC.s . fullAccount $ a, "\r\n"]
|
|
|
serializeHandle (AccountResponse (a, r)) = ["Failed: ", fullAccount a, "; ", renderLineResponse r, "\r\n"]
|
|
|
serializeHandle AccountOk = []
|
|
|
serializeFetchResc (FetchRescData cnm rfm ofst sz trg resp) =
|
|
|
- ["Client-Name: ", s cnm, "\r\n",
|
|
|
- "Return-Path: ", s . normalize $ rfm, "\r\n",
|
|
|
+ ["Client-Name: ", SC.s cnm, "\r\n",
|
|
|
+ "Return-Path: ", SC.s . normalize $ rfm, "\r\n",
|
|
|
"Headers: No\r\n",
|
|
|
- "Offset: ", s . show $ ofst, "\r\n",
|
|
|
- "Block-Size: ", s . show $ sz, "\r\n",
|
|
|
- "Target: ", s . show $ trg, "\r\n"] ++
|
|
|
+ "Offset: ", SC.s . show $ ofst, "\r\n",
|
|
|
+ "Block-Size: ", SC.s . show $ sz, "\r\n",
|
|
|
+ "Target: ", SC.s . show $ trg, "\r\n"] ++
|
|
|
case resp of
|
|
|
Nothing -> []
|
|
|
Just r -> ["Failure: ", renderLineResponse r, "\r\n"]
|
|
|
serializeFetchHdr (FetchHdrData cnm rfm r q trg resp) =
|
|
|
- ["Client-Name: ", s cnm, "\r\n",
|
|
|
- "Return-Path: ", s . normalize $ rfm, "\r\n",
|
|
|
+ ["Client-Name: ", SC.s cnm, "\r\n",
|
|
|
+ "Return-Path: ", SC.s . normalize $ rfm, "\r\n",
|
|
|
"Headers: Yes\r\n",
|
|
|
"Recursive: ", serialBool r, "\r\n",
|
|
|
"Query: ", serializeFtchQuery q, "\r\n",
|
|
|
- "Target: ", s . show $ trg, "\r\n"] ++
|
|
|
+ "Target: ", SC.s . show $ trg, "\r\n"] ++
|
|
|
case resp of
|
|
|
Nothing -> []
|
|
|
Just rs -> ["Failure: ", renderLineResponse rs, "\r\n"]
|
|
@@ -398,7 +398,7 @@ parseMetadata = do
|
|
|
skipHorizontalSpace
|
|
|
t <- bsval
|
|
|
r <- case A.parseOnly f t of
|
|
|
- Left _ -> fail $ "failed parsing value of " ++ s pt
|
|
|
+ Left _ -> fail $ "failed parsing value of " ++ SC.s pt
|
|
|
Right v -> return v
|
|
|
skipHorizontalSpace
|
|
|
return r
|
|
@@ -410,12 +410,12 @@ parseMetadata = do
|
|
|
parseRead :: Read a => Parser a
|
|
|
parseRead = do
|
|
|
v <- A.takeTill A.isSpace
|
|
|
- case readMaybe . s $ v of
|
|
|
+ case readMaybe . SC.s $ v of
|
|
|
Nothing -> fail "failed parsing value"
|
|
|
Just i -> return i
|
|
|
parseISO8601Val = do
|
|
|
v <- A.takeTill A.isSpace
|
|
|
- case parseISO8601 . s $ v of
|
|
|
+ case parseISO8601 . SC.s $ v of
|
|
|
Nothing -> fail "failed parsing ISO8601 date"
|
|
|
Just t -> return t
|
|
|
parseMetadataBool :: Parser Bool
|