Browse Source

Export `Jid' helper functions, rename 'fromString(s)' to `fromText(s)'

master
Jon Kristensen 13 years ago
parent
commit
226e6481b9
  1. 2
      source/Network/Xmpp.hs
  2. 9
      source/Network/Xmpp/Types.hs

2
source/Network/Xmpp.hs

@ -39,6 +39,8 @@ module Network.Xmpp @@ -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

9
source/Network/Xmpp/Types.hs

@ -39,7 +39,8 @@ module Network.Xmpp.Types @@ -39,7 +39,8 @@ module Network.Xmpp.Types
, Jid(..)
, isBare
, isFull
, fromString
, fromText
, fromTexts
, StreamEnd(..)
, InvalidXmppXml(..)
)
@ -875,14 +876,14 @@ instance IsString Jid where @@ -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

Loading…
Cancel
Save