diff --git a/source/Network/Xmpp.hs b/source/Network/Xmpp.hs index cd1daf0..f2e3a51 100644 --- a/source/Network/Xmpp.hs +++ b/source/Network/Xmpp.hs @@ -39,6 +39,8 @@ module Network.Xmpp , Jid(..) , isBare , isFull + , fromText + , fromTexts -- * Stanzas -- | The basic protocol data unit in XMPP is the XML stanza. The stanza is -- essentially a fragment of XML that is sent over a stream. @Stanzas@ come in diff --git a/source/Network/Xmpp/Types.hs b/source/Network/Xmpp/Types.hs index e2eae15..b23ec9c 100644 --- a/source/Network/Xmpp/Types.hs +++ b/source/Network/Xmpp/Types.hs @@ -39,7 +39,8 @@ module Network.Xmpp.Types , Jid(..) , isBare , isFull - , fromString + , fromText + , fromTexts , StreamEnd(..) , InvalidXmppXml(..) ) @@ -875,14 +876,14 @@ instance IsString Jid where fromText :: Text -> Maybe Jid fromText t = do (l, d, r) <- eitherToMaybe $ AP.parseOnly jidParts t - fromStrings l d r + fromTexts l d r where eitherToMaybe = either (const Nothing) Just -- | Converts localpart, domainpart, and resourcepart strings to a JID. Runs the -- appropriate stringprep profiles and validates the parts. -fromStrings :: Maybe Text -> Text -> Maybe Text -> Maybe Jid -fromStrings l d r = do +fromTexts :: Maybe Text -> Text -> Maybe Text -> Maybe Jid +fromTexts l d r = do localPart <- case l of Nothing -> return Nothing Just l'-> do