~singpolyma/network-protocol-xmpp

691a62fa4c62372095bfb6e4422ca61ef4f0bbe2 — John Millikin 13 years ago 5933e41
Support text-0.11
2 files changed, 13 insertions(+), 4 deletions(-)

M Network/Protocol/XMPP/JID.hs
M network-protocol-xmpp.cabal
M Network/Protocol/XMPP/JID.hs => Network/Protocol/XMPP/JID.hs +11 -2
@@ 14,6 14,7 @@
-- along with this program.  If not, see <http://www.gnu.org/licenses/>.

{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE CPP #-}
module Network.Protocol.XMPP.JID
	( JID (..)
	, Node (..)


@@ 69,11 70,11 @@ instance IsString JID where

parseJID :: T.Text -> Maybe JID
parseJID str = maybeJID where
	(node, postNode) = case T.spanBy (/= '@') str of
	(node, postNode) = case textSpanBy (/= '@') str of
		(x, y) -> if T.null y
			then ("", x)
			else (x, T.drop 1 y)
	(domain, resource) = case T.spanBy (/= '/') postNode of
	(domain, resource) = case textSpanBy (/= '/') postNode of
		(x, y) -> if T.null y
			then (x, "")
			else (x, T.drop 1 y)


@@ 104,3 105,11 @@ formatJID (JID node (Domain domain) resource) = formatted where
-- Similar to 'comparing'
equaling :: Eq a => (b -> a) -> b -> b -> Bool
equaling f x y = f x == f y

-- multi-version 'text' compatibility
textSpanBy :: (Char -> Bool) -> T.Text -> (T.Text, T.Text)
#if MIN_VERSION_text(0,11,0)
textSpanBy = T.span
#else
textSpanBy = T.spanBy
#endif

M network-protocol-xmpp.cabal => network-protocol-xmpp.cabal +2 -2
@@ 1,5 1,5 @@
name: network-protocol-xmpp
version: 0.3.2.4
version: 0.3.2.5
synopsis: Client->Server XMPP
license: GPL-3
license-file: License.txt


@@ 27,7 27,7 @@ library

  build-depends:
      base >= 3 && < 5
    , text >= 0.7 && < 0.11
    , text >= 0.10 && < 0.12
    , gnuidn >= 0.1 && < 0.2
    , gnutls >= 0.1 && < 0.3
    , bytestring >= 0.9 && < 0.10