diff options
Diffstat (limited to 'Presence/XMPP.hs')
-rw-r--r-- | Presence/XMPP.hs | 42 |
1 files changed, 19 insertions, 23 deletions
diff --git a/Presence/XMPP.hs b/Presence/XMPP.hs index 3f81f000..d35e5617 100644 --- a/Presence/XMPP.hs +++ b/Presence/XMPP.hs | |||
@@ -241,21 +241,25 @@ tagName (EventBeginElement n _) = n | |||
241 | tagName _ = "" | 241 | tagName _ = "" |
242 | 242 | ||
243 | handleIQSetBind session cmdChan stanza_id = do | 243 | handleIQSetBind session cmdChan stanza_id = do |
244 | whenJust nextElement $ \child -> do | 244 | mchild <- nextElement |
245 | let unhandledBind = liftIO $ putStrLn $ "unhandled-bind: "++show child | 245 | case mchild of |
246 | case tagName child of | 246 | Just child -> do |
247 | "{urn:ietf:params:xml:ns:xmpp-bind}resource" | 247 | let unhandledBind = liftIO $ putStrLn $ "unhandled-bind: "++show child |
248 | -> do | 248 | case tagName child of |
249 | rsc <- lift content | 249 | "{urn:ietf:params:xml:ns:xmpp-bind}resource" |
250 | liftIO $ do | 250 | -> do |
251 | putStrLn $ "iq-set-bind-resource " ++ show rsc | 251 | rsc <- lift content |
252 | setResource session (L.fromChunks [S.encodeUtf8 rsc]) | 252 | liftIO $ do |
253 | jid <- getJID session | 253 | putStrLn $ "iq-set-bind-resource " ++ show rsc |
254 | atomically $ writeTChan cmdChan (Send $ iq_bind_reply stanza_id (toStrict $ L.decodeUtf8 $ L.show jid) ) | 254 | setResource session (L.fromChunks [S.encodeUtf8 rsc]) |
255 | forCachedPresence session $ \presence -> do | 255 | jid <- getJID session |
256 | xs <- xmlifyPresenceForClient presence | 256 | atomically $ writeTChan cmdChan (Send $ iq_bind_reply stanza_id (toStrict $ L.decodeUtf8 $ L.show jid) ) |
257 | atomically . writeTChan cmdChan . Send $ xs | 257 | forCachedPresence session $ \presence -> do |
258 | _ -> unhandledBind | 258 | xs <- xmlifyPresenceForClient presence |
259 | atomically . writeTChan cmdChan . Send $ xs | ||
260 | _ -> unhandledBind | ||
261 | Nothing -> do | ||
262 | liftIO $ putStrLn $ "empty bind request!" | ||
259 | 263 | ||
260 | 264 | ||
261 | iq_session_reply host stanza_id = | 265 | iq_session_reply host stanza_id = |
@@ -598,14 +602,6 @@ fromPeer session = doNestingXML $ do | |||
598 | 602 | ||
599 | 603 | ||
600 | 604 | ||
601 | {- | ||
602 | seekRemotePeers :: XMPPConfig config => | ||
603 | config -> TChan Presence -> IO () | ||
604 | seekRemotePeers config chan = do | ||
605 | putStrLn "unimplemented: seekRemotePeers" | ||
606 | -- TODO | ||
607 | return () | ||
608 | -} | ||
609 | 605 | ||
610 | data OutBoundMessage = OutBoundPresence Presence | PresenceProbe JID JID | 606 | data OutBoundMessage = OutBoundPresence Presence | PresenceProbe JID JID |
611 | deriving Prelude.Show | 607 | deriving Prelude.Show |