-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | Client support for POP3, SMTP, and IMAP
--   
--   This package provides client support for the POP3, SMTP, and IMAP
--   protocols. NOTE: this package will be split into smaller,
--   protocol-specific packages in the future.
@package HaskellNet
@version 0.5.1

module Network.HaskellNet.IMAP.Types
type MailboxName = String
type UID = Word64
type Charset = String
data MailboxInfo
MboxInfo :: MailboxName -> Integer -> Integer -> [Flag] -> [Flag] -> Bool -> Bool -> UID -> UID -> MailboxInfo
[_mailbox] :: MailboxInfo -> MailboxName
[_exists] :: MailboxInfo -> Integer
[_recent] :: MailboxInfo -> Integer
[_flags] :: MailboxInfo -> [Flag]
[_permanentFlags] :: MailboxInfo -> [Flag]
[_isWritable] :: MailboxInfo -> Bool
[_isFlagWritable] :: MailboxInfo -> Bool
[_uidNext] :: MailboxInfo -> UID
[_uidValidity] :: MailboxInfo -> UID
data Flag
Seen :: Flag
Answered :: Flag
Flagged :: Flag
Deleted :: Flag
Draft :: Flag
Recent :: Flag
Keyword :: String -> Flag
data Attribute
Noinferiors :: Attribute
Noselect :: Attribute
Marked :: Attribute
Unmarked :: Attribute
OtherAttr :: String -> Attribute
data MboxUpdate
MboxUpdate :: Maybe Integer -> Maybe Integer -> MboxUpdate
[exists] :: MboxUpdate -> Maybe Integer
[recent] :: MboxUpdate -> Maybe Integer
data StatusCode
ALERT :: StatusCode
BADCHARSET :: [Charset] -> StatusCode
CAPABILITY_sc :: [String] -> StatusCode
PARSE :: StatusCode
PERMANENTFLAGS :: [Flag] -> StatusCode
READ_ONLY :: StatusCode
READ_WRITE :: StatusCode
TRYCREATE :: StatusCode
UIDNEXT_sc :: UID -> StatusCode
UIDVALIDITY_sc :: UID -> StatusCode
UNSEEN_sc :: Integer -> StatusCode
data ServerResponse
OK :: (Maybe StatusCode) -> String -> ServerResponse
NO :: (Maybe StatusCode) -> String -> ServerResponse
BAD :: (Maybe StatusCode) -> String -> ServerResponse
PREAUTH :: (Maybe StatusCode) -> String -> ServerResponse

-- | the query data type for the status command
data MailboxStatus

-- | the number of messages in the mailbox
MESSAGES :: MailboxStatus

-- | the number of messages with the Recent flag set
RECENT :: MailboxStatus

-- | the next unique identifier value of the mailbox
UIDNEXT :: MailboxStatus

-- | the unique identifier validity value of the mailbox
UIDVALIDITY :: MailboxStatus
data RespDerivs
RespDerivs :: Result RespDerivs [Flag] -> Result RespDerivs String -> Result RespDerivs Char -> Pos -> RespDerivs
[dvFlags] :: RespDerivs -> Result RespDerivs [Flag]
[advTag] :: RespDerivs -> Result RespDerivs String
[advChar] :: RespDerivs -> Result RespDerivs Char
[advPos] :: RespDerivs -> Pos
emptyMboxInfo :: MailboxInfo
instance GHC.Classes.Eq Network.HaskellNet.IMAP.Types.MailboxStatus
instance GHC.Read.Read Network.HaskellNet.IMAP.Types.MailboxStatus
instance GHC.Show.Show Network.HaskellNet.IMAP.Types.MailboxStatus
instance GHC.Show.Show Network.HaskellNet.IMAP.Types.ServerResponse
instance GHC.Classes.Eq Network.HaskellNet.IMAP.Types.ServerResponse
instance GHC.Show.Show Network.HaskellNet.IMAP.Types.StatusCode
instance GHC.Classes.Eq Network.HaskellNet.IMAP.Types.StatusCode
instance GHC.Classes.Eq Network.HaskellNet.IMAP.Types.MboxUpdate
instance GHC.Show.Show Network.HaskellNet.IMAP.Types.MboxUpdate
instance GHC.Classes.Eq Network.HaskellNet.IMAP.Types.Attribute
instance GHC.Show.Show Network.HaskellNet.IMAP.Types.Attribute
instance GHC.Classes.Eq Network.HaskellNet.IMAP.Types.MailboxInfo
instance GHC.Show.Show Network.HaskellNet.IMAP.Types.MailboxInfo
instance GHC.Classes.Eq Network.HaskellNet.IMAP.Types.Flag
instance GHC.Show.Show Network.HaskellNet.IMAP.Types.Flag
instance Text.Packrat.Parse.Derivs Network.HaskellNet.IMAP.Types.RespDerivs


-- | Parsers for IMAP server responses
module Network.HaskellNet.IMAP.Parsers
eval :: (RespDerivs -> Result RespDerivs r) -> String -> ByteString -> r
eval' :: (RespDerivs -> Result RespDerivs r) -> String -> String -> r
pNone :: RespDerivs -> Result RespDerivs (ServerResponse, MboxUpdate, ())
pCapability :: RespDerivs -> Result RespDerivs (ServerResponse, MboxUpdate, [String])
pSelect :: RespDerivs -> Result RespDerivs (ServerResponse, MboxUpdate, MailboxInfo)
pList :: RespDerivs -> Result RespDerivs (ServerResponse, MboxUpdate, [([Attribute], String, MailboxName)])
pLsub :: RespDerivs -> Result RespDerivs (ServerResponse, MboxUpdate, [([Attribute], String, MailboxName)])
pStatus :: RespDerivs -> Result RespDerivs (ServerResponse, MboxUpdate, [(MailboxStatus, Integer)])
pExpunge :: RespDerivs -> Result RespDerivs (ServerResponse, MboxUpdate, [Integer])
pSearch :: RespDerivs -> Result RespDerivs (ServerResponse, MboxUpdate, [UID])
pFetch :: RespDerivs -> Result RespDerivs (ServerResponse, MboxUpdate, [(Integer, [(String, String)])])


-- | This module provides a byte string "stream" interface. This interface
--   provides some common operations on a value which supports reading and
--   writing byte strings.
module Network.HaskellNet.BSStream

-- | A byte string stream.
data BSStream
BSStream :: IO ByteString -> (Int -> IO ByteString) -> (ByteString -> IO ()) -> IO () -> IO () -> IO Bool -> (Int -> IO Bool) -> BSStream

-- | Read a line from the stream. Should return the line which was read,
--   including the newline.
[bsGetLine] :: BSStream -> IO ByteString

-- | Read the specified number of bytes from the stream. Should block until
--   the requested bytes can be read.
[bsGet] :: BSStream -> Int -> IO ByteString

-- | Write the specified byte string to the stream. Should flush the stream
--   after writing.
[bsPut] :: BSStream -> ByteString -> IO ()

-- | Flush the stream.
[bsFlush] :: BSStream -> IO ()

-- | Close the stream.
[bsClose] :: BSStream -> IO ()

-- | Is the stream open?
[bsIsOpen] :: BSStream -> IO Bool

-- | Is data available?
[bsWaitForInput] :: BSStream -> Int -> IO Bool

-- | Build a byte string stream which operates on a <a>Handle</a>.
handleToStream :: Handle -> BSStream

module Network.HaskellNet.Debug
debugStream :: BSStream -> BSStream

module Network.HaskellNet.IMAP.Connection
data IMAPConnection
withNextCommandNum :: IMAPConnection -> (Int -> IO a) -> IO (a, Int)
setMailboxInfo :: IMAPConnection -> MailboxInfo -> IO ()
modifyMailboxInfo :: IMAPConnection -> (MailboxInfo -> MailboxInfo) -> IO ()
newConnection :: BSStream -> IO IMAPConnection
mailbox :: IMAPConnection -> IO MailboxName
exists :: IMAPConnection -> IO Integer
recent :: IMAPConnection -> IO Integer
flags :: IMAPConnection -> IO [Flag]
permanentFlags :: IMAPConnection -> IO [Flag]
isWritable :: IMAPConnection -> IO Bool
isFlagWritable :: IMAPConnection -> IO Bool
uidNext :: IMAPConnection -> IO UID
uidValidity :: IMAPConnection -> IO UID
stream :: IMAPConnection -> BSStream

module Network.HaskellNet.POP3.Connection
data POP3Connection
stream :: POP3Connection -> BSStream
newConnection :: BSStream -> String -> POP3Connection

-- | APOP key
apopKey :: POP3Connection -> String

module Network.HaskellNet.Auth
type UserName = String
type Password = String
data AuthType
PLAIN :: AuthType
LOGIN :: AuthType
CRAM_MD5 :: AuthType
b64Encode :: String -> String
b64Decode :: String -> String
showOctet :: [Word8] -> String
hashMD5 :: [Word8] -> [Word8]
hmacMD5 :: String -> String -> [Word8]
plain :: UserName -> Password -> String
login :: UserName -> Password -> (String, String)
cramMD5 :: String -> UserName -> Password -> String
auth :: AuthType -> String -> UserName -> Password -> String
instance GHC.Classes.Eq Network.HaskellNet.Auth.AuthType
instance GHC.Show.Show Network.HaskellNet.Auth.AuthType

module Network.HaskellNet.IMAP
connectIMAP :: String -> IO IMAPConnection
connectIMAPPort :: String -> PortNumber -> IO IMAPConnection
connectStream :: BSStream -> IO IMAPConnection
noop :: IMAPConnection -> IO ()
capability :: IMAPConnection -> IO [String]
logout :: IMAPConnection -> IO ()
login :: IMAPConnection -> UserName -> Password -> IO ()
authenticate :: IMAPConnection -> AuthType -> UserName -> Password -> IO ()
select :: IMAPConnection -> MailboxName -> IO ()
examine :: IMAPConnection -> MailboxName -> IO ()
create :: IMAPConnection -> MailboxName -> IO ()
delete :: IMAPConnection -> MailboxName -> IO ()
rename :: IMAPConnection -> MailboxName -> MailboxName -> IO ()
subscribe :: IMAPConnection -> MailboxName -> IO ()
unsubscribe :: IMAPConnection -> MailboxName -> IO ()
list :: IMAPConnection -> IO [([Attribute], MailboxName)]
lsub :: IMAPConnection -> IO [([Attribute], MailboxName)]
status :: IMAPConnection -> MailboxName -> [MailboxStatus] -> IO [(MailboxStatus, Integer)]
append :: IMAPConnection -> MailboxName -> ByteString -> IO ()
check :: IMAPConnection -> IO ()
close :: IMAPConnection -> IO ()
expunge :: IMAPConnection -> IO [Integer]
search :: IMAPConnection -> [SearchQuery] -> IO [UID]
store :: IMAPConnection -> UID -> FlagsQuery -> IO ()
copy :: IMAPConnection -> UID -> MailboxName -> IO ()
idle :: IMAPConnection -> Int -> IO ()
fetch :: IMAPConnection -> UID -> IO ByteString
fetchHeader :: IMAPConnection -> UID -> IO ByteString
fetchSize :: IMAPConnection -> UID -> IO Int
fetchHeaderFields :: IMAPConnection -> UID -> [String] -> IO ByteString
fetchHeaderFieldsNot :: IMAPConnection -> UID -> [String] -> IO ByteString
fetchFlags :: IMAPConnection -> UID -> IO [Flag]
fetchR :: IMAPConnection -> (UID, UID) -> IO [(UID, ByteString)]
fetchByString :: IMAPConnection -> UID -> String -> IO [(String, String)]
fetchByStringR :: IMAPConnection -> (UID, UID) -> String -> IO [(UID, [(String, String)])]
data Flag
Seen :: Flag
Answered :: Flag
Flagged :: Flag
Deleted :: Flag
Draft :: Flag
Recent :: Flag
Keyword :: String -> Flag
data Attribute
Noinferiors :: Attribute
Noselect :: Attribute
Marked :: Attribute
Unmarked :: Attribute
OtherAttr :: String -> Attribute

-- | the query data type for the status command
data MailboxStatus

-- | the number of messages in the mailbox
MESSAGES :: MailboxStatus

-- | the number of messages with the Recent flag set
RECENT :: MailboxStatus

-- | the next unique identifier value of the mailbox
UIDNEXT :: MailboxStatus

-- | the unique identifier validity value of the mailbox
UIDVALIDITY :: MailboxStatus
data SearchQuery
ALLs :: SearchQuery
FLAG :: Flag -> SearchQuery
UNFLAG :: Flag -> SearchQuery
BCCs :: String -> SearchQuery
BEFOREs :: CalendarTime -> SearchQuery
BODYs :: String -> SearchQuery
CCs :: String -> SearchQuery
FROMs :: String -> SearchQuery
HEADERs :: String -> String -> SearchQuery
LARGERs :: Integer -> SearchQuery
NEWs :: SearchQuery
NOTs :: SearchQuery -> SearchQuery
OLDs :: SearchQuery
ONs :: CalendarTime -> SearchQuery
ORs :: SearchQuery -> SearchQuery -> SearchQuery
SENTBEFOREs :: CalendarTime -> SearchQuery
SENTONs :: CalendarTime -> SearchQuery
SENTSINCEs :: CalendarTime -> SearchQuery
SINCEs :: CalendarTime -> SearchQuery
SMALLERs :: Integer -> SearchQuery
SUBJECTs :: String -> SearchQuery
TEXTs :: String -> SearchQuery
TOs :: String -> SearchQuery
UIDs :: [UID] -> SearchQuery
data FlagsQuery
ReplaceFlags :: [Flag] -> FlagsQuery
PlusFlags :: [Flag] -> FlagsQuery
MinusFlags :: [Flag] -> FlagsQuery
data AuthType
PLAIN :: AuthType
LOGIN :: AuthType
CRAM_MD5 :: AuthType
instance GHC.Show.Show Network.HaskellNet.IMAP.SearchQuery

module Network.HaskellNet.POP3.Types
data Command
USER :: UserName -> Command
PASS :: Password -> Command
APOP :: UserName -> Password -> Command
AUTH :: AuthType -> UserName -> Password -> Command
NOOP :: Command
QUIT :: Command
STAT :: Command
LIST :: (Maybe Int) -> Command
DELE :: Int -> Command
RETR :: Int -> Command
RSET :: Command
TOP :: Int -> Int -> Command
UIDL :: (Maybe Int) -> Command
data Response
Ok :: Response
Err :: Response
instance GHC.Show.Show Network.HaskellNet.POP3.Types.Response
instance GHC.Classes.Eq Network.HaskellNet.POP3.Types.Response

module Network.HaskellNet.POP3

-- | connecting to the pop3 server specified by the hostname and port
--   number
connectPop3Port :: String -> PortNumber -> IO POP3Connection

-- | connecting to the pop3 server specified by the hostname. 110 is used
--   for the port number.
connectPop3 :: String -> IO POP3Connection

-- | connecting to the pop3 server via a stream
connectStream :: BSStream -> IO POP3Connection

-- | sendCommand sends a pop3 command via a pop3 connection. This action is
--   too generic. Use more specific actions
sendCommand :: POP3Connection -> Command -> IO (Response, ByteString)
closePop3 :: POP3Connection -> IO ()
user :: POP3Connection -> String -> IO ()
pass :: POP3Connection -> String -> IO ()
userPass :: POP3Connection -> UserName -> Password -> IO ()
apop :: POP3Connection -> String -> String -> IO ()
auth :: POP3Connection -> AuthType -> UserName -> Password -> IO ()
stat :: POP3Connection -> IO (Int, Int)
dele :: POP3Connection -> Int -> IO ()
retr :: POP3Connection -> Int -> IO ByteString
top :: POP3Connection -> Int -> Int -> IO ByteString
rset :: POP3Connection -> IO ()
allList :: POP3Connection -> IO [(Int, Int)]
list :: POP3Connection -> Int -> IO Int
allUIDLs :: POP3Connection -> IO [(Int, ByteString)]
uidl :: POP3Connection -> Int -> IO ByteString
doPop3Port :: String -> PortNumber -> (POP3Connection -> IO a) -> IO a
doPop3 :: String -> (POP3Connection -> IO a) -> IO a
doPop3Stream :: BSStream -> (POP3Connection -> IO b) -> IO b
data AuthType
PLAIN :: AuthType
LOGIN :: AuthType
CRAM_MD5 :: AuthType


-- | This module provides functions for working with the SMTP protocol in
--   the client side, including <i>opening</i> and <i>closing</i>
--   connections, <i>sending commands</i> to the server,
--   <i>authenticate</i> and <i>sending mails</i>.
--   
--   Here's a basic usage example:
--   
--   <pre>
--   import Network.HaskellNet.SMTP
--   import Network.HaskellNet.Auth
--   import qualified Data.Text.Lazy as T
--   
--   main = doSMTP "your.smtp.server.com" $ \conn -&gt;
--      authSucceed &lt;- authenticate PLAIN "username" "password" conn
--      if authSucceed
--          then sendPlainTextMail "receiver@server.com" "sender@server.com" "subject" (T.pack "Hello! This is the mail body!") conn
--          else print "Authentication failed."
--   </pre>
--   
--   Notes for the above example:
--   
--   <ul>
--   <li>First the <a>SMTPConnection</a> is opened with the <a>doSMTP</a>
--   function. The connection should also be established with functions
--   such as <a>connectSMTP</a>, <a>connectSMTPPort</a> and
--   <a>doSMTPPort</a>. With the <tt>doSMTP*</tt> functions the connection
--   is opened, then executed an action with it and then closed
--   automatically. If the connection is opened with the
--   <tt>connectSMTP*</tt> functions you may want to close it with the
--   <a>closeSMTP</a> function after using it. It is also possible to
--   create a <a>SMTPConnection</a> from an already opened connection
--   stream (<a>BSStream</a>) using the <a>connectStream</a> or
--   <a>doSMTPStream</a> functions.</li>
--   </ul>
--   
--   <i>NOTE:</i> For <i>SSL/TLS</i> support you may establish the
--   connection using the functions (such as <tt>connectSMTPSSL</tt>)
--   provided in the <tt>Network.HaskellNet.SMTP.SSL</tt> module of the
--   <a>HaskellNet-SSL</a> package.
--   
--   <ul>
--   <li>The <a>authenticate</a> function authenticates to the server with
--   the specified <a>AuthType</a>. <a>PLAIN</a>, <a>LOGIN</a> and
--   <a>CRAM_MD5</a> <a>AuthType</a>s are available. It returns a
--   <a>Bool</a> indicating either the authentication succeed or not.</li>
--   <li>To send a mail you can use <a>sendPlainTextMail</a> for plain text
--   mail, or <a>sendMimeMail</a> for mime mail.</li>
--   </ul>
module Network.HaskellNet.SMTP
data Command
HELO :: String -> Command
EHLO :: String -> Command
MAIL :: String -> Command
RCPT :: String -> Command
DATA :: ByteString -> Command
EXPN :: String -> Command
VRFY :: String -> Command
HELP :: String -> Command
AUTH :: AuthType -> UserName -> Password -> Command
NOOP :: Command
RSET :: Command
QUIT :: Command
data Response
Ok :: Response
SystemStatus :: Response
HelpMessage :: Response
ServiceReady :: Response
ServiceClosing :: Response
UserNotLocal :: Response
CannotVerify :: Response
StartMailInput :: Response
ServiceNotAvailable :: Response
MailboxUnavailable :: Response
ErrorInProcessing :: Response
InsufficientSystemStorage :: Response
SyntaxError :: Response
ParameterError :: Response
CommandNotImplemented :: Response
BadSequence :: Response
ParameterNotImplemented :: Response
MailboxUnavailableError :: Response
UserNotLocalError :: Response
ExceededStorage :: Response
MailboxNotAllowed :: Response
TransactionFailed :: Response
data AuthType
PLAIN :: AuthType
LOGIN :: AuthType
CRAM_MD5 :: AuthType
data SMTPConnection

-- | connecting SMTP server with the specified name and port number.
connectSMTPPort :: String -> PortNumber -> IO SMTPConnection

-- | connecting SMTP server with the specified name and port 25.
connectSMTP :: String -> IO SMTPConnection

-- | create SMTPConnection from already connected Stream
connectStream :: BSStream -> IO SMTPConnection

-- | send a method to a server
sendCommand :: SMTPConnection -> Command -> IO (ReplyCode, ByteString)

-- | close the connection. This function send the QUIT method, so you do
--   not have to QUIT method explicitly.
closeSMTP :: SMTPConnection -> IO ()

-- | This function will return <a>True</a> if the authentication succeeds.
--   Here's an example of sending a mail with a server that requires
--   authentication:
--   
--   <pre>
--   authSucceed &lt;- authenticate PLAIN "username" "password" conn
--   if authSucceed
--       then sendPlainTextMail "receiver@server.com" "sender@server.com" "subject" (T.pack "Hello!") conn
--       else print "Authentication failed."
--   </pre>
authenticate :: AuthType -> UserName -> Password -> SMTPConnection -> IO Bool

-- | sending a mail to a server. This is achieved by sendMessage. If
--   something is wrong, it raises an IOexception.
sendMail :: String -> [String] -> ByteString -> SMTPConnection -> IO ()

-- | doSMTPPort open a connection, and do an IO action with the connection,
--   and then close it.
doSMTPPort :: String -> PortNumber -> (SMTPConnection -> IO a) -> IO a

-- | doSMTP is similar to doSMTPPort, except that it does not require port
--   number but connects to the server with port 25.
doSMTP :: String -> (SMTPConnection -> IO a) -> IO a

-- | doSMTPStream is similar to doSMTPPort, except that its argument is a
--   Stream data instead of hostname and port number.
doSMTPStream :: BSStream -> (SMTPConnection -> IO a) -> IO a

-- | Send a plain text mail.
sendPlainTextMail :: String -> String -> String -> Text -> SMTPConnection -> IO ()

-- | Send a mime mail. The attachments are included with the file path.
sendMimeMail :: String -> String -> String -> Text -> Text -> [(Text, FilePath)] -> SMTPConnection -> IO ()

-- | Send a mime mail. The attachments are included with in-memory
--   <a>ByteString</a>.
sendMimeMail' :: String -> String -> String -> Text -> Text -> [(Text, Text, ByteString)] -> SMTPConnection -> IO ()
sendMimeMail2 :: Mail -> SMTPConnection -> IO ()
instance GHC.Classes.Eq Network.HaskellNet.SMTP.Response
instance GHC.Show.Show Network.HaskellNet.SMTP.Response
instance GHC.Classes.Eq Network.HaskellNet.SMTP.Command
instance GHC.Show.Show Network.HaskellNet.SMTP.Command
