network-protocol-xmpp 0.4.9 → 0.4.10
raw patch · 5 files changed
+20/−10 lines, 5 filesdep +network-simpledep ~network
Dependencies added: network-simple
Dependency ranges changed: network
Files
- lib/Network/Protocol/XMPP/Client.hs +1/−2
- lib/Network/Protocol/XMPP/Component.hs +1/−2
- lib/Network/Protocol/XMPP/Connections.hs +10/−2
- lib/Network/Protocol/XMPP/Handle.hs +5/−2
- network-protocol-xmpp.cabal +3/−2
lib/Network/Protocol/XMPP/Client.hs view
@@ -23,7 +23,6 @@ import Control.Monad.Trans (liftIO) import Data.ByteString (ByteString) import Data.Text (Text)-import Network (connectTo) import qualified System.IO as IO import qualified Network.Protocol.XMPP.Client.Authentication as A@@ -46,7 +45,7 @@ runClient server jid username password xmpp = do -- Open a TCP connection let C.Server sjid host port = server- rawHandle <- connectTo host port+ rawHandle <- C.connectTo host port IO.hSetBuffering rawHandle IO.NoBuffering let handle = H.PlainHandle rawHandle
lib/Network/Protocol/XMPP/Component.hs view
@@ -28,7 +28,6 @@ import qualified Data.Text import Data.Text (Text) import Data.Text.Encoding (encodeUtf8)-import Network (connectTo) import Network.Protocol.SASL.GNU (sha1) import qualified System.IO as IO @@ -45,7 +44,7 @@ -> IO (Either M.Error a) runComponent server password xmpp = do let C.Server jid host port = server- rawHandle <- connectTo host port+ rawHandle <- C.connectTo host port IO.hSetBuffering rawHandle IO.NoBuffering let handle = H.PlainHandle rawHandle M.startXMPP handle (s"jabber:component:accept") $ do
lib/Network/Protocol/XMPP/Connections.hs view
@@ -18,22 +18,30 @@ , xmlHeader , startOfStream , qnameStream+ , connectTo ) where -import Network (HostName, PortID)+import Network.Socket (HostName, PortNumber, socketToHandle)+import Network.Simple.TCP (connectSock) import Data.ByteString (ByteString) import qualified Data.Text import Data.Text (Text) import Data.Text.Encoding (encodeUtf8)+import qualified System.IO as IO import qualified Network.Protocol.XMPP.XML as X import Network.Protocol.XMPP.JID (JID, formatJID) import Network.Protocol.XMPP.String (s) +connectTo :: HostName -> PortNumber -> IO IO.Handle+connectTo host port =+ (`socketToHandle` IO.ReadWriteMode) =<<+ (fst <$> connectSock host (show port))+ data Server = Server { serverJID :: JID , serverHostname :: HostName- , serverPort :: PortID+ , serverPort :: PortNumber } -- Since only the opening tag should be written, normal XML
lib/Network/Protocol/XMPP/Handle.hs view
@@ -66,8 +66,11 @@ pending <- TLS.checkPending let wait = void $ IO.hWaitForInput h (- 1) when (pending == 0) (liftIO wait)- lazy <- TLS.getBytes n- return (Data.ByteString.concat (Data.ByteString.Lazy.toChunks lazy))+ Data.ByteString.concat . Data.ByteString.Lazy.toChunks <$> getBytes+ where+ getBytes = TLS.getBytes n `E.catchError` handleGetBytesErr+ handleGetBytesErr (TLS.Error (-28)) = getBytes+ handleGetBytesErr e = E.throwError e handleIsSecure :: Handle -> Bool handleIsSecure PlainHandle{} = False
network-protocol-xmpp.cabal view
@@ -1,5 +1,5 @@ name: network-protocol-xmpp-version: 0.4.9+version: 0.4.10 license: GPL-3 license-file: COPYING author: John Millikin <jmillikin@gmail.com>, Stephan Maka <stephan@spaceboyz.net>@@ -36,7 +36,8 @@ , gsasl >= 0.3 && < 0.4 , libxml-sax >= 0.7 && < 0.8 , monads-tf >= 0.1 && < 0.2- , network >= 2.2 && < 3.0.0.0+ , network >= 3.0 && < 4.0+ , network-simple >= 0.4 && < 0.5 , text >= 0.10 , transformers >= 0.2 , xml-types >= 0.3 && < 0.4