-- | IMAP SSL Connections
module Network.HaskellNet.IMAP.SSL
    ( -- * Establishing connection
      connectIMAPSSL
    , connectIMAPSSLWithSettings
      -- * Settings
    , Settings(..)
    , defaultSettingsIMAPSSL
      -- * Network.HaskellNet.IMAP re-exports
    , module Network.HaskellNet.IMAP
    ) where

import Network.HaskellNet.IMAP.Connection
import Network.HaskellNet.IMAP
import Network.HaskellNet.SSL

import Network.HaskellNet.SSL.Internal

-- | Create IMAP connection with default settings
connectIMAPSSL :: String -> IO IMAPConnection
connectIMAPSSL :: String -> IO IMAPConnection
connectIMAPSSL String
hostname = String -> Settings -> IO IMAPConnection
connectIMAPSSLWithSettings String
hostname Settings
defaultSettingsIMAPSSL

-- | Create IMAP connection with given settings
connectIMAPSSLWithSettings :: String -> Settings -> IO IMAPConnection
connectIMAPSSLWithSettings :: String -> Settings -> IO IMAPConnection
connectIMAPSSLWithSettings String
hostname Settings
cfg = String -> Settings -> IO BSStream
connectSSL String
hostname Settings
cfg IO BSStream -> (BSStream -> IO IMAPConnection) -> IO IMAPConnection
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= BSStream -> IO IMAPConnection
connectStream

-- | Default IMAP SSL settings, port 993
defaultSettingsIMAPSSL :: Settings
defaultSettingsIMAPSSL :: Settings
defaultSettingsIMAPSSL = PortNumber -> Settings
defaultSettingsWithPort PortNumber
993