Stability | experimental |
---|---|
Maintainer | Ertugrul Soeylemez <es@ertes.de> |
Helper functions and types.
- enumHandleTimeout :: forall b m. MonadIO m => Int -> Int -> Handle -> Enumerator ByteString m b
- formatMsgs :: Vector ByteString -> String
- netLine :: forall m r. Monad m => Int -> MaybeT r (Iteratee ByteString m) ByteString
- netLines :: forall b m. Monad m => Int -> Enumeratee ByteString ByteString m b
- responseLines :: Monad m => Int -> Int -> Iteratee SmtpResponse m b -> Iteratee ByteString m b
- 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 :: forall b m. MonadIO m => Int -> Int -> Handle -> Enumerator ByteString m bSource
Enumerate from a handle with the given buffer size (first argument)
and timeout in milliseconds (second argument). If the timeout is
exceeded an exception is thrown via throwError
.
formatMsgs :: Vector ByteString -> StringSource
Format a Vector
of ByteString
messages from an SmtpResponse
for output.
netLine :: forall m r. Monad m => Int -> MaybeT r (Iteratee ByteString m) ByteStringSource
Savely read a line with the given maximum length. If a longer line
is enumerated, the excess data is dropped in constant space. Returns
Nothing
on EOF.
netLines :: forall b m. Monad m => Int -> Enumeratee ByteString ByteString m bSource
Convert a stream of bytes to a stream of lines with the given maximum length. Longer lines are silently truncated in constant space.
responseLines :: Monad m => Int -> Int -> Iteratee SmtpResponse m b -> Iteratee ByteString m bSource
Composition of all Enumeratee
s, which are needed to convert a raw
ByteString
stream to an SmtpResponse
stream. This function takes
the maximum line length and the response line limit as its first two
parameters.
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.