summaryrefslogtreecommitdiff
path: root/Presence/main.hs
diff options
context:
space:
mode:
authorjoe <joe@jerkface.net>2013-07-01 22:15:50 -0400
committerjoe <joe@jerkface.net>2013-07-01 22:15:50 -0400
commit09d58ee7dac8e147d71c2fefe77343457d1f57d8 (patch)
tree8c6a15ad4a8839e143023226132ef918ec52f517 /Presence/main.hs
parent43c4487e3763b741291c928e33f71aac0aa47358 (diff)
discard bad hostnames in sendProbes
Diffstat (limited to 'Presence/main.hs')
-rw-r--r--Presence/main.hs7
1 files changed, 5 insertions, 2 deletions
diff --git a/Presence/main.hs b/Presence/main.hs
index 7a319630..fa4a98c1 100644
--- a/Presence/main.hs
+++ b/Presence/main.hs
@@ -35,7 +35,7 @@ import XMPP
35#endif 35#endif
36import ControlMaybe 36import ControlMaybe
37import Data.HList 37import Data.HList
38import Control.Exception 38import Control.Exception hiding (catch)
39import LocalPeerCred 39import LocalPeerCred
40import System.Posix.User 40import System.Posix.User
41import qualified Data.Set as Set 41import qualified Data.Set as Set
@@ -234,9 +234,12 @@ newPresenceState hostname = atomically $ do
234 234
235sendProbes state jid = do 235sendProbes state jid = do
236 withJust (name jid) $ \user -> do 236 withJust (name jid) $ \user -> do
237 let parseHostNameJID' str = do
238 handle (\(SomeException _) -> return Nothing)
239 (fmap Just . parseHostNameJID $ str)
237 buddies <- do 240 buddies <- do
238 buddies <- ConfigFiles.getBuddies user 241 buddies <- ConfigFiles.getBuddies user
239 mapM parseHostNameJID buddies 242 fmap catMaybes (mapM parseHostNameJID' buddies)
240 remotes <- readTVarIO (remoteUsers state) 243 remotes <- readTVarIO (remoteUsers state)
241 forM_ buddies $ \buddy -> do 244 forM_ buddies $ \buddy -> do
242 let mjids = fmap snd $ Map.lookup (peer buddy) remotes 245 let mjids = fmap snd $ Map.lookup (peer buddy) remotes