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
|
( -- * Establishing connection
|
||||||
connectIMAPSSL
|
connectIMAPSSL
|
||||||
, connectIMAPSSLWithSettings
|
, connectIMAPSSLWithSettings
|
||||||
|
-- * Settings
|
||||||
|
, defaultSettingsIMAPSSL
|
||||||
) where
|
) where
|
||||||
|
|
||||||
import Network.HaskellNet.IMAP.Connection
|
import Network.HaskellNet.IMAP.Connection
|
||||||
@ -11,8 +13,10 @@ import Network.HaskellNet.SSL
|
|||||||
import Network.HaskellNet.SSL.Internal
|
import Network.HaskellNet.SSL.Internal
|
||||||
|
|
||||||
connectIMAPSSL :: String -> IO IMAPConnection
|
connectIMAPSSL :: String -> IO IMAPConnection
|
||||||
connectIMAPSSL hostname = connectIMAPSSLWithSettings hostname cfg
|
connectIMAPSSL hostname = connectIMAPSSLWithSettings hostname defaultSettingsIMAPSSL
|
||||||
where cfg = defaultSettingsWithPort 993
|
|
||||||
|
|
||||||
connectIMAPSSLWithSettings :: String -> Settings -> IO IMAPConnection
|
connectIMAPSSLWithSettings :: String -> Settings -> IO IMAPConnection
|
||||||
connectIMAPSSLWithSettings hostname cfg = connectSSL hostname cfg >>= connectStream
|
connectIMAPSSLWithSettings hostname cfg = connectSSL hostname cfg >>= connectStream
|
||||||
|
|
||||||
|
defaultSettingsIMAPSSL :: Settings
|
||||||
|
defaultSettingsIMAPSSL = defaultSettingsWithPort 993
|
||||||
|
|||||||
@ -2,6 +2,8 @@ module Network.HaskellNet.POP3.SSL
|
|||||||
( -- * Establishing connection
|
( -- * Establishing connection
|
||||||
connectPop3SSL
|
connectPop3SSL
|
||||||
, connectPop3SSLWithSettings
|
, connectPop3SSLWithSettings
|
||||||
|
-- * Settings
|
||||||
|
, defaultSettingsPop3SSL
|
||||||
) where
|
) where
|
||||||
|
|
||||||
import Network.HaskellNet.POP3.Connection
|
import Network.HaskellNet.POP3.Connection
|
||||||
@ -11,8 +13,10 @@ import Network.HaskellNet.SSL
|
|||||||
import Network.HaskellNet.SSL.Internal
|
import Network.HaskellNet.SSL.Internal
|
||||||
|
|
||||||
connectPop3SSL :: String -> IO POP3Connection
|
connectPop3SSL :: String -> IO POP3Connection
|
||||||
connectPop3SSL hostname = connectPop3SSLWithSettings hostname cfg
|
connectPop3SSL hostname = connectPop3SSLWithSettings hostname defaultSettingsPop3SSL
|
||||||
where cfg = defaultSettingsWithPort 995
|
|
||||||
|
|
||||||
connectPop3SSLWithSettings :: String -> Settings -> IO POP3Connection
|
connectPop3SSLWithSettings :: String -> Settings -> IO POP3Connection
|
||||||
connectPop3SSLWithSettings hostname cfg = connectSSL hostname cfg >>= connectStream
|
connectPop3SSLWithSettings hostname cfg = connectSSL hostname cfg >>= connectStream
|
||||||
|
|
||||||
|
defaultSettingsPop3SSL :: Settings
|
||||||
|
defaultSettingsPop3SSL = defaultSettingsWithPort 995
|
||||||
|
|||||||
@ -9,6 +9,9 @@ module Network.HaskellNet.SMTP.SSL
|
|||||||
, doSMTPSSLWithSettings
|
, doSMTPSSLWithSettings
|
||||||
, doSMTPSTARTTLS
|
, doSMTPSTARTTLS
|
||||||
, doSMTPSTARTTLSWithSettings
|
, doSMTPSTARTTLSWithSettings
|
||||||
|
-- * Settings
|
||||||
|
, defaultSettingsSMTPSSL
|
||||||
|
, defaultSettingsSMTPSTARTTLS
|
||||||
) where
|
) where
|
||||||
|
|
||||||
import Network.HaskellNet.SMTP
|
import Network.HaskellNet.SMTP
|
||||||
@ -26,15 +29,13 @@ import Control.Monad
|
|||||||
import Data.IORef
|
import Data.IORef
|
||||||
|
|
||||||
connectSMTPSSL :: String -> IO SMTPConnection
|
connectSMTPSSL :: String -> IO SMTPConnection
|
||||||
connectSMTPSSL hostname = connectSMTPSSLWithSettings hostname cfg
|
connectSMTPSSL hostname = connectSMTPSSLWithSettings hostname defaultSettingsSMTPSSL
|
||||||
where cfg = defaultSettingsWithPort 465
|
|
||||||
|
|
||||||
connectSMTPSSLWithSettings :: String -> Settings -> IO SMTPConnection
|
connectSMTPSSLWithSettings :: String -> Settings -> IO SMTPConnection
|
||||||
connectSMTPSSLWithSettings hostname cfg = connectSSL hostname cfg >>= connectStream
|
connectSMTPSSLWithSettings hostname cfg = connectSSL hostname cfg >>= connectStream
|
||||||
|
|
||||||
connectSMTPSTARTTLS :: String -> IO SMTPConnection
|
connectSMTPSTARTTLS :: String -> IO SMTPConnection
|
||||||
connectSMTPSTARTTLS hostname = connectSMTPSTARTTLSWithSettings hostname cfg
|
connectSMTPSTARTTLS hostname = connectSMTPSTARTTLSWithSettings hostname defaultSettingsSMTPSTARTTLS
|
||||||
where cfg = defaultSettingsWithPort 587
|
|
||||||
|
|
||||||
connectSMTPSTARTTLSWithSettings :: String -> Settings -> IO SMTPConnection
|
connectSMTPSTARTTLSWithSettings :: String -> Settings -> IO SMTPConnection
|
||||||
connectSMTPSTARTTLSWithSettings hostname cfg = connectSTARTTLS hostname cfg >>= connectStream
|
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 :: String -> Settings -> (SMTPConnection -> IO a) -> IO a
|
||||||
doSMTPSTARTTLSWithSettings host port = bracketSMTP $ connectSMTPSTARTTLSWithSettings host port
|
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