Add defaultSettings helpers for each protocol
This commit is contained in:
parent
b26be26666
commit
e703d1c36a
@ -2,6 +2,8 @@ module Network.HaskellNet.IMAP.SSL
|
||||
( -- * Establishing connection
|
||||
connectIMAPSSL
|
||||
, connectIMAPSSLWithSettings
|
||||
-- * Settings
|
||||
, defaultSettingsIMAPSSL
|
||||
) where
|
||||
|
||||
import Network.HaskellNet.IMAP.Connection
|
||||
@ -11,8 +13,10 @@ import Network.HaskellNet.SSL
|
||||
import Network.HaskellNet.SSL.Internal
|
||||
|
||||
connectIMAPSSL :: String -> IO IMAPConnection
|
||||
connectIMAPSSL hostname = connectIMAPSSLWithSettings hostname cfg
|
||||
where cfg = defaultSettingsWithPort 993
|
||||
connectIMAPSSL hostname = connectIMAPSSLWithSettings hostname defaultSettingsIMAPSSL
|
||||
|
||||
connectIMAPSSLWithSettings :: String -> Settings -> IO IMAPConnection
|
||||
connectIMAPSSLWithSettings hostname cfg = connectSSL hostname cfg >>= connectStream
|
||||
|
||||
defaultSettingsIMAPSSL :: Settings
|
||||
defaultSettingsIMAPSSL = defaultSettingsWithPort 993
|
||||
|
||||
@ -2,6 +2,8 @@ module Network.HaskellNet.POP3.SSL
|
||||
( -- * Establishing connection
|
||||
connectPop3SSL
|
||||
, connectPop3SSLWithSettings
|
||||
-- * Settings
|
||||
, defaultSettingsPop3SSL
|
||||
) where
|
||||
|
||||
import Network.HaskellNet.POP3.Connection
|
||||
@ -11,8 +13,10 @@ import Network.HaskellNet.SSL
|
||||
import Network.HaskellNet.SSL.Internal
|
||||
|
||||
connectPop3SSL :: String -> IO POP3Connection
|
||||
connectPop3SSL hostname = connectPop3SSLWithSettings hostname cfg
|
||||
where cfg = defaultSettingsWithPort 995
|
||||
connectPop3SSL hostname = connectPop3SSLWithSettings hostname defaultSettingsPop3SSL
|
||||
|
||||
connectPop3SSLWithSettings :: String -> Settings -> IO POP3Connection
|
||||
connectPop3SSLWithSettings hostname cfg = connectSSL hostname cfg >>= connectStream
|
||||
|
||||
defaultSettingsPop3SSL :: Settings
|
||||
defaultSettingsPop3SSL = defaultSettingsWithPort 995
|
||||
|
||||
@ -9,6 +9,9 @@ module Network.HaskellNet.SMTP.SSL
|
||||
, doSMTPSSLWithSettings
|
||||
, doSMTPSTARTTLS
|
||||
, doSMTPSTARTTLSWithSettings
|
||||
-- * Settings
|
||||
, defaultSettingsSMTPSSL
|
||||
, defaultSettingsSMTPSTARTTLS
|
||||
) where
|
||||
|
||||
import Network.HaskellNet.SMTP
|
||||
@ -26,15 +29,13 @@ import Control.Monad
|
||||
import Data.IORef
|
||||
|
||||
connectSMTPSSL :: String -> IO SMTPConnection
|
||||
connectSMTPSSL hostname = connectSMTPSSLWithSettings hostname cfg
|
||||
where cfg = defaultSettingsWithPort 465
|
||||
connectSMTPSSL hostname = connectSMTPSSLWithSettings hostname defaultSettingsSMTPSSL
|
||||
|
||||
connectSMTPSSLWithSettings :: String -> Settings -> IO SMTPConnection
|
||||
connectSMTPSSLWithSettings hostname cfg = connectSSL hostname cfg >>= connectStream
|
||||
|
||||
connectSMTPSTARTTLS :: String -> IO SMTPConnection
|
||||
connectSMTPSTARTTLS hostname = connectSMTPSTARTTLSWithSettings hostname cfg
|
||||
where cfg = defaultSettingsWithPort 587
|
||||
connectSMTPSTARTTLS hostname = connectSMTPSTARTTLSWithSettings hostname defaultSettingsSMTPSTARTTLS
|
||||
|
||||
connectSMTPSTARTTLSWithSettings :: String -> Settings -> IO SMTPConnection
|
||||
connectSMTPSTARTTLSWithSettings hostname cfg = connectSTARTTLS hostname cfg >>= connectStream
|
||||
@ -89,3 +90,9 @@ doSMTPSTARTTLS host = bracketSMTP $ connectSMTPSTARTTLS host
|
||||
|
||||
doSMTPSTARTTLSWithSettings :: String -> Settings -> (SMTPConnection -> IO a) -> IO a
|
||||
doSMTPSTARTTLSWithSettings host port = bracketSMTP $ connectSMTPSTARTTLSWithSettings host port
|
||||
|
||||
defaultSettingsSMTPSSL :: Settings
|
||||
defaultSettingsSMTPSSL = defaultSettingsWithPort 465
|
||||
|
||||
defaultSettingsSMTPSTARTTLS :: Settings
|
||||
defaultSettingsSMTPSTARTTLS = defaultSettingsWithPort 587
|
||||
|
||||
Loading…
Reference in New Issue
Block a user