Browse Source

pickle pre-approval stream feature

master
Philipp Balzarek 10 years ago
parent
commit
c0a8bb502d
  1. 11
      source/Network/Xmpp/Marshal.hs
  2. 1
      source/Network/Xmpp/Types.hs

11
source/Network/Xmpp/Marshal.hs

@ -350,18 +350,21 @@ xpStream = xpElemAttrs @@ -350,18 +350,21 @@ xpStream = xpElemAttrs
-- Pickler/Unpickler for the stream features - TLS, SASL, and the rest.
xpStreamFeatures :: PU [Node] StreamFeatures
xpStreamFeatures = ("xpStreamFeatures","") <?> xpWrap
(\(tls, sasl, ver, rest) -> StreamFeatures tls (mbl sasl) ver rest)
(\(StreamFeatures tls sasl ver rest) -> (tls, lmb sasl, ver, rest))
(\(tls, sasl, ver, preAppr, rest)
-> StreamFeatures tls (mbl sasl) ver preAppr rest)
(\(StreamFeatures tls sasl ver preAppr rest)
-> (tls, lmb sasl, ver, preAppr, rest))
(xpElemNodes
(Name
"features"
(Just "http://etherx.jabber.org/streams")
(Just "stream")
)
(xp4Tuple
(xp5Tuple
(xpOption pickleTlsFeature)
(xpOption pickleSaslFeature)
(xpOption pickleRosterVer)
picklePreApproval
(xpAll xpElemVerbatim)
)
)
@ -377,6 +380,8 @@ xpStreamFeatures = ("xpStreamFeatures","") <?> xpWrap @@ -377,6 +380,8 @@ xpStreamFeatures = ("xpStreamFeatures","") <?> xpWrap
"{urn:ietf:params:xml:ns:xmpp-sasl}mechanism" (xpContent xpId))
pickleRosterVer = xpElemNodes "{urn:xmpp:features:rosterver}ver" $
xpElemExists "{urn:xmpp:features:rosterver}optional"
picklePreApproval = xpElemExists "{urn:xmpp:features:pre-approval}sub"
xpJid :: PU Text Jid
xpJid = ("xpJid", "") <?>

1
source/Network/Xmpp/Types.hs

@ -728,6 +728,7 @@ data StreamFeatures = StreamFeatures @@ -728,6 +728,7 @@ data StreamFeatures = StreamFeatures
-- when the server sends the
-- non-standard "optional" element
-- (observed with prosody).
, streamSubPreApproval :: !Bool -- ^ Does the server support pre-approval
, streamOtherFeatures :: ![Element] -- TODO: All feature elements instead?
} deriving (Eq, Show)

Loading…
Cancel
Save