diff options
Diffstat (limited to 'Presence/XMPP.hs')
-rw-r--r-- | Presence/XMPP.hs | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/Presence/XMPP.hs b/Presence/XMPP.hs index e15b10cc..5435c913 100644 --- a/Presence/XMPP.hs +++ b/Presence/XMPP.hs | |||
@@ -282,6 +282,23 @@ handleIQSetBind session cmdChan stanza_id = do | |||
282 | atomically $ writeTChan cmdChan (Send $ iq_bind_reply stanza_id (toStrict $ L.decodeUtf8 $ L.show jid) ) | 282 | atomically $ writeTChan cmdChan (Send $ iq_bind_reply stanza_id (toStrict $ L.decodeUtf8 $ L.show jid) ) |
283 | _ -> unhandledBind | 283 | _ -> unhandledBind |
284 | 284 | ||
285 | |||
286 | iq_session_reply host stanza_id = | ||
287 | [ EventBeginElement "{jabber:client}iq" | ||
288 | [("id",[ContentText stanza_id]) | ||
289 | ,("from",[ContentText host]) | ||
290 | ,("type",[ContentText "result"]) | ||
291 | ] | ||
292 | , EventEndElement "{jabber:client}iq" | ||
293 | ] | ||
294 | |||
295 | handleIQSetSession session cmdChan stanza_id = do | ||
296 | host <- liftIO $ do | ||
297 | jid <- getJID session | ||
298 | names <- getNamesForPeer (peer jid) | ||
299 | return (S.decodeUtf8 . head $ names) | ||
300 | liftIO . atomically . writeTChan cmdChan . Send $ iq_session_reply host stanza_id | ||
301 | |||
285 | handleIQSet session cmdChan tag = do | 302 | handleIQSet session cmdChan tag = do |
286 | withJust (lookupAttrib "id" (tagAttrs tag)) $ \stanza_id -> do | 303 | withJust (lookupAttrib "id" (tagAttrs tag)) $ \stanza_id -> do |
287 | whenJust nextElement $ \child -> do | 304 | whenJust nextElement $ \child -> do |
@@ -289,6 +306,8 @@ handleIQSet session cmdChan tag = do | |||
289 | case tagName child of | 306 | case tagName child of |
290 | "{urn:ietf:params:xml:ns:xmpp-bind}bind" | 307 | "{urn:ietf:params:xml:ns:xmpp-bind}bind" |
291 | -> handleIQSetBind session cmdChan stanza_id | 308 | -> handleIQSetBind session cmdChan stanza_id |
309 | "{urn:ietf:params:xml:ns:xmpp-session}session" | ||
310 | -> handleIQSetSession session cmdChan stanza_id | ||
292 | _ -> unhandledSet | 311 | _ -> unhandledSet |
293 | 312 | ||
294 | matchAttrib name value attrs = | 313 | matchAttrib name value attrs = |
@@ -329,6 +348,7 @@ fromClient session cmdChan = doNestingXML $ do | |||
329 | send $ greet host | 348 | send $ greet host |
330 | 349 | ||
331 | fix $ \loop -> do | 350 | fix $ \loop -> do |
351 | log "waiting for stanza." | ||
332 | whenJust nextElement $ \stanza -> do | 352 | whenJust nextElement $ \stanza -> do |
333 | stanza_lvl <- nesting | 353 | stanza_lvl <- nesting |
334 | 354 | ||