Browse Source

add port argument to connect methods

master
Philipp Balzarek 13 years ago
parent
commit
f44596eb98
  1. 5
      source/Network/Xmpp.hs
  2. 6
      source/Network/Xmpp/Monad.hs

5
source/Network/Xmpp.hs

@ -238,13 +238,14 @@ simpleAuth username passwd resource = flip auth resource $
-- Note that the server might assign a different resource even when we send -- Note that the server might assign a different resource even when we send
-- a preference. -- a preference.
simpleConnect :: HostName -- ^ Target host name simpleConnect :: HostName -- ^ Target host name
-> PortID
-> Text -- ^ User name (authcid) -> Text -- ^ User name (authcid)
-> Text -- ^ Password -> Text -- ^ Password
-> Maybe Text -- ^ Desired resource (or Nothing to let the server -> Maybe Text -- ^ Desired resource (or Nothing to let the server
-- decide) -- decide)
-> XmppConMonad Jid -> XmppConMonad Jid
simpleConnect host username password resource = do simpleConnect host port username password resource = do
connect host username connect host port username
startTLS exampleParams startTLS exampleParams
saslResponse <- simpleAuth username password resource saslResponse <- simpleAuth username password resource
case saslResponse of case saslResponse of

6
source/Network/Xmpp/Monad.hs

@ -138,10 +138,10 @@ xmppNoConnection = XmppConnection
-- Connects to the given hostname on port 5222 (TODO: Make this dynamic) and -- Connects to the given hostname on port 5222 (TODO: Make this dynamic) and
-- updates the XmppConMonad XmppConnection state. -- updates the XmppConMonad XmppConnection state.
xmppRawConnect :: HostName -> Text -> XmppConMonad () xmppRawConnect :: HostName -> PortID -> Text -> XmppConMonad ()
xmppRawConnect host hostname = do xmppRawConnect host port hostname = do
con <- liftIO $ do con <- liftIO $ do
con <- connectTo host (PortNumber 5222) con <- connectTo host port
hSetBuffering con NoBuffering hSetBuffering con NoBuffering
return con return con
let raw = if debug let raw = if debug

Loading…
Cancel
Save