-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | network related libraries such as POP3, SMTP, IMAP -- -- Originally written for Google SOC, provides network related libraries -- such as POP3, SMTP, IMAP. All I have done is get the project to -- compile using cabal, check that these libraries basically work, and -- add some examples @package HaskellNet @version 0.2.5 -- | Authentication related APIs 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 :: [Octet] -> String hmacMD5 :: String -> String -> [Octet] plain :: UserName -> Password -> String login :: UserName -> Password -> (String, String) cramMD5 :: String -> UserName -> Password -> String auth :: AuthType -> String -> UserName -> Password -> String instance Eq AuthType instance Show AuthType -- | A library for abstracting sockets suitable to Streams. module Network.HaskellNet.BSStream class BSStream h bsGetLine :: BSStream h => h -> IO ByteString bsGet :: BSStream h => h -> Int -> IO ByteString bsPut :: BSStream h => h -> ByteString -> IO () bsPuts :: BSStream h => h -> [ByteString] -> IO () bsPutStrLn :: BSStream h => h -> ByteString -> IO () bsPutCrLf :: BSStream h => h -> ByteString -> IO () bsPutNoFlush :: BSStream h => h -> ByteString -> IO () bsFlush :: BSStream h => h -> IO () bsClose :: BSStream h => h -> IO () bsIsOpen :: BSStream h => h -> IO Bool instance BSStream Handle -- | SMTP client implementation 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 BSStream s => SMTPConnection s -- | connecting SMTP server with the specified name and port number. connectSMTPPort :: String -> PortNumber -> IO (SMTPConnection Handle) -- | connecting SMTP server with the specified name and port 25. connectSMTP :: String -> IO (SMTPConnection Handle) -- | create SMTPConnection from already connected Stream connectStream :: BSStream s => s -> IO (SMTPConnection s) -- | send a method to a server sendCommand :: BSStream s => SMTPConnection s -> Command -> IO (ReplyCode, ByteString) -- | close the connection. This function send the QUIT method, so you do -- not have to QUIT method explicitly. closeSMTP :: BSStream s => SMTPConnection s -> IO () -- | sending a mail to a server. This is achieved by sendMessage. If -- something is wrong, it raises an IOexception. sendMail :: BSStream s => String -> [String] -> ByteString -> SMTPConnection s -> IO () -- | doSMTPPort open a connection, and do an IO action with the connection, -- and then close it. doSMTPPort :: String -> PortNumber -> (SMTPConnection Handle -> 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 Handle -> 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 s => s -> (SMTPConnection s -> IO a) -> IO a sendMimeMail :: BSStream s => String -> String -> String -> Text -> Text -> [(Text, FilePath)] -> SMTPConnection s -> IO () instance Show Command instance Eq Command instance Show Response instance Eq Response -- | POP3 client implementation module Network.HaskellNet.POP3 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 BSStream s => POP3Connection s -- | APOP key POP3C :: !s -> !String -> POP3Connection s data Response Ok :: Response Err :: Response -- | connecting to the pop3 server specified by the hostname and port -- number connectPop3Port :: String -> PortNumber -> IO (POP3Connection Handle) -- | connecting to the pop3 server specified by the hostname. 110 is used -- for the port number. connectPop3 :: String -> IO (POP3Connection Handle) -- | connecting to the pop3 server via a stream connectStream :: BSStream s => s -> IO (POP3Connection s) -- | sendCommand sends a pop3 command via a pop3 connection. This action is -- too generic. Use more specific actions sendCommand :: BSStream s => POP3Connection s -> Command -> IO (Response, ByteString) closePop3 :: BSStream s => POP3Connection s -> IO () user :: BSStream s => POP3Connection s -> String -> IO () pass :: BSStream s => POP3Connection s -> String -> IO () userPass :: BSStream s => POP3Connection s -> UserName -> Password -> IO () apop :: BSStream s => POP3Connection s -> String -> String -> IO () auth :: BSStream s => POP3Connection s -> AuthType -> UserName -> Password -> IO () stat :: BSStream s => POP3Connection s -> IO (Int, Int) dele :: BSStream s => POP3Connection s -> Int -> IO () retr :: BSStream s => POP3Connection s -> Int -> IO ByteString top :: BSStream s => POP3Connection s -> Int -> Int -> IO ByteString rset :: BSStream s => POP3Connection s -> IO () allList :: BSStream s => POP3Connection s -> IO [(Int, Int)] list :: BSStream s => POP3Connection s -> Int -> IO Int allUIDLs :: BSStream s => POP3Connection s -> IO [(Int, ByteString)] uidl :: BSStream s => POP3Connection s -> Int -> IO ByteString doPop3Port :: String -> PortNumber -> (POP3Connection Handle -> IO a) -> IO a doPop3 :: String -> (POP3Connection Handle -> IO a) -> IO a doPop3Stream :: BSStream s => s -> (POP3Connection s -> IO b) -> IO b instance Eq Response instance Show Response -- | Mime Parser module Text.Mime data Mime SinglePart :: [Header] -> ByteString -> Mime MultiPart :: [Header] -> [Mime] -> Mime type Message = ([Header], ByteString) type Header = (FieldName, FieldValue) type FieldName = String type FieldValue = String data MimeDerivs MimeDerivs :: Result MimeDerivs Message -> Result MimeDerivs Mime -> Result MimeDerivs Header -> Result MimeDerivs ByteString -> Result MimeDerivs Char -> Pos -> MimeDerivs dvMessage :: MimeDerivs -> Result MimeDerivs Message dvMime :: MimeDerivs -> Result MimeDerivs Mime dvHeader :: MimeDerivs -> Result MimeDerivs Header dvRest :: MimeDerivs -> Result MimeDerivs ByteString advChar :: MimeDerivs -> Result MimeDerivs Char advPos :: MimeDerivs -> Pos mime :: ByteString -> Mime message :: ByteString -> Message mime' :: String -> Mime message' :: String -> Message eval :: (MimeDerivs -> Result MimeDerivs r) -> ByteString -> r parse :: Pos -> ByteString -> MimeDerivs eval' :: (MimeDerivs -> Result MimeDerivs r) -> String -> r parse' :: Pos -> String -> MimeDerivs lineBreak :: Derivs d => Parser d String pHeader :: MimeDerivs -> Result MimeDerivs (String, String) pMessage :: MimeDerivs -> Result MimeDerivs Message pMime :: MimeDerivs -> Result MimeDerivs Mime type CharSet = String data RFC2047Derivs RFC2047Derivs :: Result RFC2047Derivs [(CharSet, String)] -> Result RFC2047Derivs Char -> Pos -> RFC2047Derivs dvHeaderExts :: RFC2047Derivs -> Result RFC2047Derivs [(CharSet, String)] hdvChar :: RFC2047Derivs -> Result RFC2047Derivs Char hdvPos :: RFC2047Derivs -> Pos headerExts :: ByteString -> [(CharSet, String)] headerExts' :: String -> [(CharSet, String)] pHeaderExts :: RFC2047Derivs -> Result RFC2047Derivs [(CharSet, String)] decodeQuoted :: Derivs d => Parser d String decodeB64 :: Derivs d => Parser d String showHeader' :: Header -> Doc showHeader :: CharSet -> Header -> Doc capital :: String -> String b64Encode :: String -> String showMessage :: CharSet -> Message -> Doc showMime :: CharSet -> Mime -> Doc instance Eq Mime instance Show Mime instance Derivs RFC2047Derivs instance Derivs MimeDerivs -- | URI parser and utilities module Text.URI data URI URI :: String -> String -> String -> String -> Maybe PortNumber -> String -> String -> String -> URI scheme :: URI -> String host :: URI -> String user :: URI -> String password :: URI -> String port :: URI -> Maybe PortNumber path :: URI -> String query :: URI -> String fragment :: URI -> String -- | Obtain the port number for the URI. If no port number exists, port' -- would like to estimate the port number from the scheme name. If both -- failed, it raises an error. port' :: URI -> PortNumber uri :: String -> URI -- | Parse URI string simiar to parseURI. The difference is that it -- raises an error for the case of parse failed, not returns Nothing. uri' :: ByteString -> URI escape :: [Word8] -> String unescape :: String -> String -- | Parse URI string and returns the result. If the parse is failed, it -- simply returns Nothing. parseURI :: String -> Maybe URI parseURI' :: ByteString -> Maybe URI portToName :: PortNumber -> Maybe String nameToPort :: String -> Maybe PortNumber instance Eq URI instance Derivs URIDerivs instance Show URI -- | Parsers for IMAP server responses module Text.IMAPParsers type Mailbox = String type UID = Word64 type Charset = String data MailboxInfo MboxInfo :: Mailbox -> Integer -> Integer -> [Flag] -> [Flag] -> Bool -> Bool -> UID -> UID -> MailboxInfo _mailbox :: MailboxInfo -> Mailbox _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 eval :: (RespDerivs -> Result RespDerivs r) -> String -> ByteString -> r parse :: String -> Pos -> ByteString -> RespDerivs eval' :: (RespDerivs -> Result RespDerivs r) -> String -> String -> r parse' :: String -> Pos -> String -> RespDerivs pNone :: RespDerivs -> Result RespDerivs (ServerResponse, MboxUpdate, ()) pCapability :: RespDerivs -> Result RespDerivs (ServerResponse, MboxUpdate, [String]) pList :: RespDerivs -> Result RespDerivs (ServerResponse, MboxUpdate, [([Attribute], String, Mailbox)]) pLsub :: RespDerivs -> Result RespDerivs (ServerResponse, MboxUpdate, [([Attribute], String, Mailbox)]) pStatus :: RespDerivs -> Result RespDerivs (ServerResponse, MboxUpdate, [(MailboxStatus, Integer)]) pExpunge :: RespDerivs -> Result RespDerivs (ServerResponse, MboxUpdate, [Integer]) pSearch :: RespDerivs -> Result RespDerivs (ServerResponse, MboxUpdate, [UID]) pSelect :: RespDerivs -> Result RespDerivs (ServerResponse, MboxUpdate, MailboxInfo) pFetch :: RespDerivs -> Result RespDerivs (ServerResponse, MboxUpdate, [(Integer, [(String, String)])]) pDone :: RespDerivs -> Result RespDerivs ServerResponse pFlag :: Parser RespDerivs Flag pParenFlags :: RespDerivs -> Result RespDerivs [Flag] atomChar :: Derivs d => Parser d Char pNumberedLine :: String -> Parser RespDerivs Integer pRecentLine :: Parser RespDerivs Integer pExpungeLine :: Parser RespDerivs Integer pExistsLine :: Parser RespDerivs Integer pOtherLine :: Parser RespDerivs (Either (String, Integer) b) pCapabilityLine :: Parser RespDerivs (Either a [String]) pListLine :: String -> Parser RespDerivs (Either a ([Attribute], String, Mailbox)) pStatusLine :: Parser RespDerivs (Either a [(MailboxStatus, Integer)]) pSearchLine :: Parser RespDerivs (Either a [UID]) pSelectLine :: Parser RespDerivs (MailboxInfo -> MailboxInfo) pFetchLine :: Parser RespDerivs (Either a (Integer, [(String, String)])) crlf :: String crlfP :: Derivs d => Parser d String lookups :: Eq a => a -> [(a, b)] -> [b] catRights :: [Either a b] -> [b] catLefts :: [Either a b] -> [a] isRight :: Either a b -> Bool isLeft :: Either a b -> Bool getLeft :: Either a b -> a getRight :: Either a b -> b instance Eq Flag instance Show MailboxInfo instance Eq MailboxInfo instance Show Attribute instance Eq Attribute instance Show MboxUpdate instance Eq MboxUpdate instance Eq StatusCode instance Show StatusCode instance Eq ServerResponse instance Show ServerResponse instance Show MailboxStatus instance Read MailboxStatus instance Eq MailboxStatus instance Derivs RespDerivs instance Show Flag -- | IMAP client implementation module Network.HaskellNet.IMAP data BSStream s => IMAPConnection s mailbox :: BSStream s => IMAPConnection s -> IO Mailbox exists :: BSStream s => IMAPConnection s -> IO Integer recent :: BSStream s => IMAPConnection s -> IO Integer flags :: BSStream s => IMAPConnection s -> IO [Flag] permanentFlags :: BSStream s => IMAPConnection s -> IO [Flag] isWritable :: BSStream s => IMAPConnection s -> IO Bool isFlagWritable :: BSStream s => IMAPConnection s -> IO Bool uidNext :: BSStream s => IMAPConnection s -> IO UID uidValidity :: BSStream s => IMAPConnection s -> IO UID stream :: BSStream s => IMAPConnection s -> s connectIMAP :: String -> IO (IMAPConnection Handle) connectIMAPPort :: String -> PortNumber -> IO (IMAPConnection Handle) connectStream :: BSStream s => s -> IO (IMAPConnection s) noop :: BSStream s => IMAPConnection s -> IO () capability :: BSStream s => IMAPConnection s -> IO [String] logout :: BSStream s => IMAPConnection s -> IO () login :: BSStream s => IMAPConnection s -> UserName -> Password -> IO () authenticate :: BSStream s => IMAPConnection s -> AuthType -> UserName -> Password -> IO () select :: BSStream s => IMAPConnection s -> Mailbox -> IO () examine :: BSStream s => IMAPConnection s -> Mailbox -> IO () create :: BSStream s => IMAPConnection s -> Mailbox -> IO () delete :: BSStream s => IMAPConnection s -> Mailbox -> IO () rename :: BSStream s => IMAPConnection s -> Mailbox -> Mailbox -> IO () subscribe :: BSStream s => IMAPConnection s -> Mailbox -> IO () unsubscribe :: BSStream s => IMAPConnection s -> Mailbox -> IO () list :: BSStream s => IMAPConnection s -> IO [([Attribute], Mailbox)] lsub :: BSStream s => IMAPConnection s -> IO [([Attribute], Mailbox)] status :: BSStream s => IMAPConnection s -> Mailbox -> [MailboxStatus] -> IO [(MailboxStatus, Integer)] append :: BSStream s => IMAPConnection s -> Mailbox -> ByteString -> IO () check :: BSStream s => IMAPConnection s -> IO () close :: BSStream s => IMAPConnection s -> IO () expunge :: BSStream s => IMAPConnection s -> IO [Integer] search :: BSStream s => IMAPConnection s -> [SearchQuery] -> IO [UID] store :: BSStream s => IMAPConnection s -> UID -> FlagsQuery -> IO () copy :: BSStream s => IMAPConnection s -> UID -> Mailbox -> IO () fetch :: BSStream s => IMAPConnection s -> UID -> IO ByteString fetchHeader :: BSStream s => IMAPConnection s -> UID -> IO ByteString fetchSize :: BSStream s => IMAPConnection s -> UID -> IO Int fetchHeaderFields :: BSStream s => IMAPConnection s -> UID -> [String] -> IO ByteString fetchHeaderFieldsNot :: BSStream s => IMAPConnection s -> UID -> [String] -> IO ByteString fetchFlags :: BSStream s => IMAPConnection s -> UID -> IO [Flag] fetchR :: BSStream s => IMAPConnection s -> (UID, UID) -> IO [(UID, ByteString)] fetchByString :: BSStream s => IMAPConnection s -> UID -> String -> IO [(String, String)] fetchByStringR :: BSStream s => IMAPConnection s -> (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 instance Show SearchQuery