HaskellNet 0.5.2 → 0.5.3
raw patch · 9 files changed
+57/−40 lines, 9 filesdep +cryptohash-md5dep −cryptohashdep ~basenew-uploaderPVP ok
version bump matches the API change (PVP)
Dependencies added: cryptohash-md5
Dependencies removed: cryptohash
Dependency ranges changed: base
API changes (from Hackage documentation)
Files
- CHANGELOG +7/−0
- HaskellNet.cabal +12/−13
- README.md +1/−3
- src/Network/HaskellNet/Auth.hs +5/−1
- src/Network/HaskellNet/IMAP.hs +4/−2
- src/Network/HaskellNet/IMAP/Connection.hs +1/−3
- src/Network/HaskellNet/IMAP/Parsers.hs +2/−2
- src/Network/HaskellNet/POP3.hs +3/−2
- src/Network/HaskellNet/SMTP.hs +22/−14
CHANGELOG view
@@ -1,3 +1,10 @@+0.5.3 (2020-12-22)+------------------++ - Allow 0 spaces or more than 1 space in separator (thanks Daniel Smith <danielspencersmith@gmail.com>)+ - Use cryptohash-md5 instead of cryptohash (thanks to amesgen <amesgen@amesgen.de>)+ - Fix long passwords encoding (thanks to Victor Nawothnig <Victor.Nawothnig@gmail.com>)+ 0.5.2 (2020-03-19) ------------------
HaskellNet.cabal view
@@ -4,29 +4,27 @@ SMTP, and IMAP protocols. NOTE: this package will be split into smaller, protocol-specific packages in the future.-Version: 0.5.2+Version: 0.5.3 Copyright: (c) 2006 Jun Mukai Author: Jun Mukai-Maintainer: Jonathan Daugherty <cygnus@foobox.com>,+Maintainer: Alexander Vershilov <alexander.vershilov@sirius.online>,+ Jonathan Daugherty <cygnus@foobox.com>, Leza Morais Lutonda <lemol-c@outlook.com> License: BSD3 License-file: LICENSE Category: Network-Homepage: https://github.com/jtdaugherty/HaskellNet-Cabal-version: >=1.8+Homepage: https://github.com/qnikst/HaskellNet+Cabal-version: >=1.10 Build-type: Simple Tested-with:- GHC ==7.0.4- || ==7.2.2- || ==7.4.2- || ==7.6.3- || ==7.8.4+ GHC ==7.8.4 || ==7.10.3 || ==8.0.2 || ==8.2.2 || ==8.4.4 || ==8.6.5- || ==8.8.1+ || ==8.8.4+ || ==8.10.2 Extra-Source-Files: CHANGELOG@@ -35,7 +33,7 @@ Source-Repository head type: git- location: git://github.com/jtdaugherty/HaskellNet.git+ location: git://github.com/qnikst/HaskellNet.git Flag network-bsd description: Use network-bsd@@ -44,6 +42,7 @@ Library Hs-Source-Dirs: src+ default-language: Haskell2010 GHC-Options: -Wall -fno-warn-unused-do-bind Exposed-modules:@@ -65,13 +64,13 @@ Text.Packrat.Parse Build-Depends:- base >= 4.3 && < 4.14,+ base >= 4.3 && < 4.15, network >= 2.6.3.1 && < 3.2, mtl, bytestring >=0.10.2, pretty, array,- cryptohash >=0.6,+ cryptohash-md5, base64-string, old-time, mime-mail >= 0.4.7 && < 0.6,
README.md view
@@ -1,9 +1,7 @@ HaskellNet ========== -[](https://travis-ci.org/lemol/HaskellNet)--**NOTE: I am seeking a maintainer for this package. If you are interested, let me know!**+ This package provides client support for the E-mail protocols POP3, SMTP, and IMAP.
src/Network/HaskellNet/Auth.hs view
@@ -26,7 +26,11 @@ showMain CRAM_MD5 = "CRAM-MD5" b64Encode :: String -> String-b64Encode = map (toEnum.fromEnum) . B64.encode . map (toEnum.fromEnum)+b64Encode = map (toEnum.fromEnum)+ -- Hotfix for https://github.com/jtdaugherty/HaskellNet/issues/61+ . delete '\n'+ . B64.encode+ . map (toEnum.fromEnum) b64Decode :: String -> String b64Decode = map (toEnum.fromEnum) . B64.decode . map (toEnum.fromEnum)
src/Network/HaskellNet/IMAP.hs view
@@ -34,7 +34,6 @@ import Data.ByteString (ByteString) import qualified Data.ByteString.Char8 as BS -import Control.Applicative ((<$>), (<*>)) import Control.Monad import System.Time@@ -44,6 +43,8 @@ import Data.Char import Text.Packrat.Parse (Result)+import Control.Applicative -- support old toolchains+import Prelude -- suffixed by `s' data SearchQuery = ALLs@@ -180,7 +181,8 @@ then getLiteral l' (getLitLen l2) else return l' crlfStr = BS.pack "\r\n"- isLiteral l = BS.last l == '}' &&+ isLiteral l = not (BS.null l) &&+ BS.last l == '}' && BS.last (fst (BS.spanEnd isDigit (BS.init l))) == '{' getLitLen = read . BS.unpack . snd . BS.spanEnd isDigit . BS.init isTagged l = BS.head l == '*' && BS.head (BS.tail l) == ' '
src/Network/HaskellNet/IMAP/Connection.hs view
@@ -25,9 +25,6 @@ , modifyIORef ) import Control.Applicative- ( (<$>)- , (<*>)- ) import Network.HaskellNet.BSStream import Network.HaskellNet.IMAP.Types@@ -37,6 +34,7 @@ , Flag , UID )+import Prelude data IMAPConnection = IMAPC { stream :: BSStream
src/Network/HaskellNet/IMAP/Parsers.hs view
@@ -324,8 +324,7 @@ num <- many1 digit string " FETCH" >> spaces char '('- pairs <- pPair `sepBy` space- char ')'+ pairs <- pPair `manyTill` char ')' crlfP return $ Right $ (read num, pairs) where pPair = do key <- (do k <- anyChar `manyTill` char '['@@ -345,6 +344,7 @@ v <- noneOf "\"" `manyTill` char '"' return ("\""++v++"\"")) <|> many1 atomChar+ spaces return (key, value) pParen = (do char '"' v <- noneOf "\"" `manyTill` char '"'
src/Network/HaskellNet/POP3.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE CPP #-} module Network.HaskellNet.POP3 ( -- * Establishing Connection connectPop3Port@@ -41,7 +42,7 @@ import Crypto.Hash.MD5 import Numeric (showHex) -import Control.Applicative ((<$>))+import Control.Applicative import Control.Exception import Control.Monad (when, unless) @@ -50,7 +51,7 @@ import System.IO -import Prelude hiding (catch)+import Prelude import Network.HaskellNet.POP3.Types import Network.HaskellNet.POP3.Connection
src/Network/HaskellNet/SMTP.hs view
@@ -149,20 +149,28 @@ -> IO SMTPConnection connectSMTP = flip connectSMTPPort 25 -tryCommand :: SMTPConnection -> Command -> Int -> ReplyCode+tryCommand :: SMTPConnection -> Command -> Int -> [ReplyCode] -> IO ByteString-tryCommand conn cmd tries expectedReply = do- (code, msg) <- sendCommand conn cmd- case () of- _ | code == expectedReply -> return msg- _ | tries > 1 ->- tryCommand conn cmd (tries - 1) expectedReply- | otherwise -> do- bsClose (bsstream conn)- fail $ "cannot execute command " ++ show cmd ++- ", expected reply code " ++ show expectedReply ++- ", but received " ++ show code ++ " " ++ BS.unpack msg+tryCommand conn cmd tries expectedReplies = do+ (code, msg) <- sendCommand conn cmd+ case () of+ _ | code `elem` expectedReplies -> return msg+ _ | tries > 1 ->+ tryCommand conn cmd (tries - 1) expectedReplies+ | otherwise -> do+ bsClose (bsstream conn)+ fail $ "cannot execute command " ++ show cmd +++ ", " ++ prettyExpected expectedReplies +++ ", " ++ prettyReceived code msg + where+ prettyReceived :: Int -> ByteString -> String+ prettyReceived co ms = "but received" ++ show co ++ " (" ++ BS.unpack ms ++ ")"++ prettyExpected :: [ReplyCode] -> String+ prettyExpected [x] = "expected reply code of " ++ show x+ prettyExpected xs = "expected any reply code of " ++ show xs+ -- | create SMTPConnection from already connected Stream connectStream :: BSStream -> IO SMTPConnection connectStream st =@@ -171,7 +179,7 @@ do bsClose st fail "cannot connect to the server" senderHost <- getHostName- msg <- tryCommand (SMTPC st []) (EHLO senderHost) 3 250+ msg <- tryCommand (SMTPC st []) (EHLO senderHost) 3 [250] return (SMTPC st (tail $ BS.lines msg)) parseResponse :: BSStream -> IO (ReplyCode, ByteString)@@ -283,7 +291,7 @@ return () where -- Try the command once and @fail@ if the response isn't 250.- sendAndCheck cmd = tryCommand conn cmd 1 250+ sendAndCheck cmd = tryCommand conn cmd 1 [250, 251] -- | doSMTPPort open a connection, and do an IO action with the -- connection, and then close it.