Browse Source

remove to prefix from toLocalpart, toDomainpart and toResourcePart

master
Philipp Balzarek 13 years ago
parent
commit
65137386b1
  1. 6
      source/Network/Xmpp.hs
  2. 26
      source/Network/Xmpp/Types.hs

6
source/Network/Xmpp.hs

@ -52,9 +52,9 @@ module Network.Xmpp
, jidToText , jidToText
, jidToTexts , jidToTexts
, toBare , toBare
, toLocalpart , localpart
, toDomainpart , domainpart
, toResourcepart , resourcepart
, parseJid , parseJid
, getJid , getJid
-- * Stanzas -- * Stanzas

26
source/Network/Xmpp/Types.hs

@ -50,9 +50,9 @@ module Network.Xmpp.Types
, jidToText , jidToText
, jidToTexts , jidToTexts
, toBare , toBare
, toLocalpart , localpart
, toDomainpart , domainpart
, toResourcepart , resourcepart
, parseJid , parseJid
, StreamEnd(..) , StreamEnd(..)
, InvalidXmppXml(..) , InvalidXmppXml(..)
@ -913,9 +913,9 @@ newtype Stream = Stream { unStream :: TMVar StreamState }
-- the entity associated with an XMPP localpart at a domain -- the entity associated with an XMPP localpart at a domain
-- (i.e., @localpart\@domainpart/resourcepart@). -- (i.e., @localpart\@domainpart/resourcepart@).
data Jid = Jid { localpart :: !(Maybe Text) data Jid = Jid { localpart_ :: !(Maybe Text)
, domainpart :: !Text , domainpart_ :: !Text
, resourcepart :: !(Maybe Text) , resourcepart_ :: !(Maybe Text)
} deriving (Eq, Ord) } deriving (Eq, Ord)
-- | Converts a JID to a Text. -- | Converts a JID to a Text.
@ -1010,19 +1010,19 @@ isFull = not . isBare
-- | Returns the @Jid@ without the resourcepart (if any). -- | Returns the @Jid@ without the resourcepart (if any).
toBare :: Jid -> Jid toBare :: Jid -> Jid
toBare (Jid localpart domainpart _) = Jid localpart domainpart Nothing toBare jid = jid{resourcepart_ = Nothing}
-- | Returns the localpart of the @Jid@ (if any). -- | Returns the localpart of the @Jid@ (if any).
toLocalpart :: Jid -> Maybe Text localpart :: Jid -> Maybe Text
toLocalpart = localpart localpart = localpart_
-- | Returns the domainpart of the @Jid@. -- | Returns the domainpart of the @Jid@.
toDomainpart :: Jid -> Text domainpart :: Jid -> Text
toDomainpart = domainpart domainpart = domainpart_
-- | Returns the resourcepart of the @Jid@ (if any). -- | Returns the resourcepart of the @Jid@ (if any).
toResourcepart :: Jid -> Maybe Text resourcepart :: Jid -> Maybe Text
toResourcepart = resourcepart resourcepart = resourcepart_
-- Parses an JID string and returns its three parts. It performs no validation -- Parses an JID string and returns its three parts. It performs no validation
-- or transformations. -- or transformations.

Loading…
Cancel
Save