Maintainer | Ertugrul Soeylemez <es@ertes.de> |
---|
Helper functions and types.
- enumHandleTimeout :: MonadIO m => Int -> Int -> Handle -> Enumerator ByteString m b
- formatMsgs :: Vector ByteString -> String
- smtpResponseLine :: Monad m => MaybeT r (Iteratee ByteString m) (Either ByteString (Integer, Bool, ByteString))
- smtpResponse :: forall m r. Monad m => Int -> MaybeT r (Iteratee ByteString m) SmtpResponse
- smtpResponses :: forall b m. Monad m => Int -> Enumeratee ByteString SmtpResponse m b
- stringToExtension :: ByteString -> Maybe Extension
Documentation
enumHandleTimeout :: MonadIO m => Int -> Int -> Handle -> Enumerator ByteString m b
Enumerate from a handle with the given buffer size (first argument)
and timeout in milliseconds (second argument). If the timeout is
exceeded a TimeoutError
exception is thrown via throwError
.
Note that this timeout is not a timeout for the whole enumeration, but for each individual read operation. In other words, this timeout protects against dead/unresponsive peers, but not against (perhaps intentionally) slowly sending peers.
formatMsgs :: Vector ByteString -> StringSource
Format a Vector
of ByteString
messages from an SmtpResponse
for output.
smtpResponseLine :: Monad m => MaybeT r (Iteratee ByteString m) (Either ByteString (Integer, Bool, ByteString))Source
Read the next SMTP response line from the given ByteString
lines
stream (i.e. a ByteString
stream converted by netLines
). Returns
Nothing
on EOF. Returns Just (Left line)
, if the next line is
not a proper SMTP response. Otherwise returns (code, more, msg)
.
smtpResponse :: forall m r. Monad m => Int -> MaybeT r (Iteratee ByteString m) SmtpResponseSource
Read the next SMTP response from a netLines
-splitted ByteString
stream. Throws an error on protocol errors. Returns at most the
given number of response messages.
smtpResponses :: forall b m. Monad m => Int -> Enumeratee ByteString SmtpResponse m bSource
Convert a stream of netLines
-splitted ByteString
lines to a
stream of SMTP responses. In case of a protocol error the
enumeration is aborted and an error is thrown.
stringToExtension :: ByteString -> Maybe ExtensionSource
Convert extension string to Extension
value, if the corresponding
extension is known.