summaryrefslogtreecommitdiff
path: root/Presence/XMPPServer.hs
diff options
context:
space:
mode:
Diffstat (limited to 'Presence/XMPPServer.hs')
-rw-r--r--Presence/XMPPServer.hs10
1 files changed, 9 insertions, 1 deletions
diff --git a/Presence/XMPPServer.hs b/Presence/XMPPServer.hs
index 218e60e0..a0d5a69b 100644
--- a/Presence/XMPPServer.hs
+++ b/Presence/XMPPServer.hs
@@ -305,6 +305,12 @@ swapit old new (EventEndElement n) | nameNamespace n==Just old =
305 EventEndElement (n { nameNamespace = Just new }) 305 EventEndElement (n { nameNamespace = Just new })
306swapit old new x = x 306swapit old new x = x
307 307
308-- | This is invoked by sendModifiedStanzaTo* before swapping the namespace.
309--
310-- Optionally, when the namespace is jabber:server, this will set a "whitelist"
311-- attribute on a presence tag that indicates a list of users deliminated by
312-- spaces. This is so that a server can communicate to another server which
313-- users are believed to be subscribed.
308fixHeaders :: Monad m => Stanza -> ConduitM Event Event m () 314fixHeaders :: Monad m => Stanza -> ConduitM Event Event m ()
309fixHeaders Stanza { stanzaType=typ, stanzaTo=mto, stanzaFrom=mfrom } = do 315fixHeaders Stanza { stanzaType=typ, stanzaTo=mto, stanzaFrom=mfrom } = do
310 x <- await 316 x <- await
@@ -319,8 +325,10 @@ fixHeaders Stanza { stanzaType=typ, stanzaTo=mto, stanzaFrom=mfrom } = do
319 as'' = maybe as' (setAttrib "from" as') mfrom 325 as'' = maybe as' (setAttrib "from" as') mfrom
320 as3 = case typ of 326 as3 = case typ of
321 PresenceStatus {} | nameNamespace n == Just "jabber:client" 327 PresenceStatus {} | nameNamespace n == Just "jabber:client"
322 -> delAttrib "whitelist" as'' 328 -> delAttrib "whitelist" as'' -- client-to-peer "whitelist" is filtered.
323 PresenceStatus {} | otherwise 329 PresenceStatus {} | otherwise
330 -- peer-to-client, we may have set a list of subscribed users
331 -- to be communicated to the remote end.
324 -> case presenceWhiteList typ of 332 -> case presenceWhiteList typ of
325 [] -> delAttrib "whitelist" as'' 333 [] -> delAttrib "whitelist" as''
326 ws -> setAttrib "whitelist" as'' (Text.intercalate " " ws) 334 ws -> setAttrib "whitelist" as'' (Text.intercalate " " ws)