diff options
-rw-r--r-- | Presence/XMPPServer.hs | 5 | ||||
-rw-r--r-- | xmppServer.hs | 10 |
2 files changed, 13 insertions, 2 deletions
diff --git a/Presence/XMPPServer.hs b/Presence/XMPPServer.hs index e66eea70..7fc11124 100644 --- a/Presence/XMPPServer.hs +++ b/Presence/XMPPServer.hs | |||
@@ -1503,6 +1503,7 @@ monitor sv params xmpp = do | |||
1503 | RequiresPing -> return () -- wlog $ tomsg k "RequiresPing" | 1503 | RequiresPing -> return () -- wlog $ tomsg k "RequiresPing" |
1504 | _ -> return () | 1504 | _ -> return () |
1505 | , readTChan stanzas >>= \stanza -> return $ do | 1505 | , readTChan stanzas >>= \stanza -> return $ do |
1506 | {- | ||
1506 | dup <- case stanzaType stanza of | 1507 | dup <- case stanzaType stanza of |
1507 | -- Must dup anything that is going to be delivered... | 1508 | -- Must dup anything that is going to be delivered... |
1508 | Message {} -> do | 1509 | Message {} -> do |
@@ -1512,6 +1513,9 @@ monitor sv params xmpp = do | |||
1512 | dup <- cloneStanza stanza -- dupped so we can make debug print | 1513 | dup <- cloneStanza stanza -- dupped so we can make debug print |
1513 | return dup | 1514 | return dup |
1514 | _ -> return stanza | 1515 | _ -> return stanza |
1516 | -} | ||
1517 | dup <- cloneStanza stanza | ||
1518 | |||
1515 | forkIO $ do | 1519 | forkIO $ do |
1516 | case stanzaOrigin stanza of | 1520 | case stanzaOrigin stanza of |
1517 | NetworkOrigin k@(ClientKey {}) replyto -> | 1521 | NetworkOrigin k@(ClientKey {}) replyto -> |
@@ -1574,6 +1578,7 @@ monitor sv params xmpp = do | |||
1574 | case stanzaType stanza of | 1578 | case stanzaType stanza of |
1575 | PresenceRequestStatus {} -> do | 1579 | PresenceRequestStatus {} -> do |
1576 | xmppAnswerProbe xmpp k stanza replyto | 1580 | xmppAnswerProbe xmpp k stanza replyto |
1581 | _ -> return () | ||
1577 | _ -> return () | 1582 | _ -> return () |
1578 | let deliver replyto = do | 1583 | let deliver replyto = do |
1579 | -- TODO: Issuing RecipientUnavailable for all errors is a presence leak | 1584 | -- TODO: Issuing RecipientUnavailable for all errors is a presence leak |
diff --git a/xmppServer.hs b/xmppServer.hs index 5487e532..3899a258 100644 --- a/xmppServer.hs +++ b/xmppServer.hs | |||
@@ -414,6 +414,7 @@ informClientPresence state k stanza = do | |||
414 | writeTVar (clientStatus cstate) $ Just dup | 414 | writeTVar (clientStatus cstate) $ Just dup |
415 | 415 | ||
416 | answerProbe state k stanza chan = do | 416 | answerProbe state k stanza chan = do |
417 | putStrLn $ "answerProbe! " ++ show (stanzaType stanza) | ||
417 | ktc <- atomically $ readTVar (keyToChan state) | 418 | ktc <- atomically $ readTVar (keyToChan state) |
418 | replies <- runTraversableT $ do | 419 | replies <- runTraversableT $ do |
419 | let liftMaybe = liftT . maybeToList | 420 | let liftMaybe = liftT . maybeToList |
@@ -427,8 +428,13 @@ answerProbe state k stanza chan = do | |||
427 | cbu <- lift . atomically $ readTVar (clientsByUser state) | 428 | cbu <- lift . atomically $ readTVar (clientsByUser state) |
428 | lpres <- liftMaybe $ Map.lookup u cbu | 429 | lpres <- liftMaybe $ Map.lookup u cbu |
429 | clientState <- liftT $ Map.elems (networkClients lpres) | 430 | clientState <- liftT $ Map.elems (networkClients lpres) |
430 | mstanza <- lift $ atomically (readTVar (clientStatus clientState)) | 431 | stanza <- liftIOMaybe $ atomically (readTVar (clientStatus clientState)) |
431 | liftMaybe mstanza | 432 | -- TODO: from address!! |
433 | let jid = unsplitJID (Just $ clientUser clientState | ||
434 | , ch | ||
435 | ,Just $ clientResource clientState) | ||
436 | ch = addrToText (auxAddr conn) | ||
437 | return stanza { stanzaFrom = Just jid } | ||
432 | forM_ replies $ \reply -> do | 438 | forM_ replies $ \reply -> do |
433 | sendModifiedStanzaToPeer reply chan | 439 | sendModifiedStanzaToPeer reply chan |
434 | -- TODO: if null replies, send offline message | 440 | -- TODO: if null replies, send offline message |