summaryrefslogtreecommitdiff
path: root/Presence/main.hs
diff options
context:
space:
mode:
authorjoe <joe@jerkface.net>2013-07-14 13:38:29 -0400
committerjoe <joe@jerkface.net>2013-07-14 13:38:29 -0400
commit8556b4bcc0ce2b308fc9c2ec424f43feef5faa52 (patch)
tree2f7de8c8fe933d15e0863d4f6182cdbf87590c03 /Presence/main.hs
parenta48e699c956b66de5591638eddb68e251800ad51 (diff)
renamed outgoingConnections to remotePeers in the PresenceState global
record.
Diffstat (limited to 'Presence/main.hs')
-rw-r--r--Presence/main.hs20
1 files changed, 10 insertions, 10 deletions
diff --git a/Presence/main.hs b/Presence/main.hs
index 3d5ac046..92ef7034 100644
--- a/Presence/main.hs
+++ b/Presence/main.hs
@@ -88,8 +88,8 @@ data PresenceState = PresenceState
88 -- on connect so that it can populate it's notion of online users. 88 -- on connect so that it can populate it's notion of online users.
89 , remoteUsers :: TVar (Map Peer (RefCount,TVar (MultiMap JabberUser (JabberResource,JabberShow)))) 89 , remoteUsers :: TVar (Map Peer (RefCount,TVar (MultiMap JabberUser (JabberResource,JabberShow))))
90 90
91 -- outGoingConnections - a set of channels that may be used to send messages to remote peers. 91 -- remotePeers - a set of channels that may be used to send messages to remote peers.
92 , outGoingConnections :: OutgoingConnections CachedMessages 92 , remotePeers :: OutgoingConnections CachedMessages
93 } 93 }
94 94
95 95
@@ -244,7 +244,7 @@ instance JabberClientSession ClientSession where
244 244
245 rosterPush (RequestedSubscription user jid_str) (presence_state s) 245 rosterPush (RequestedSubscription user jid_str) (presence_state s)
246 246
247 sendMessage (outGoingConnections . presence_state $ s) 247 sendMessage (remotePeers . presence_state $ s)
248 (Solicitation me jid) 248 (Solicitation me jid)
249 (peer jid) 249 (peer jid)
250 250
@@ -298,12 +298,12 @@ instance JabberClientSession ClientSession where
298 rosterPush (NewSubscriber user contact) (presence_state s) 298 rosterPush (NewSubscriber user contact) (presence_state s)
299 299
300 -- notify peer 300 -- notify peer
301 sendMessage (outGoingConnections . presence_state $ s) 301 sendMessage (remotePeers . presence_state $ s)
302 (Approval (JID (Just user) LocalHost Nothing) 302 (Approval (JID (Just user) LocalHost Nothing)
303 cjid) 303 cjid)
304 (peer cjid) 304 (peer cjid)
305 presence <- getUserStatus (presence_state s) user 305 presence <- getUserStatus (presence_state s) user
306 let cons = outGoingConnections . presence_state $ s 306 let cons = remotePeers . presence_state $ s
307 forM_ presence $ \p -> sendMessage cons (OutBoundPresence p) (peer cjid) 307 forM_ presence $ \p -> sendMessage cons (OutBoundPresence p) (peer cjid)
308 return () 308 return ()
309 309
@@ -322,14 +322,14 @@ instance JabberClientSession ClientSession where
322 322
323 -- notify peer 323 -- notify peer
324 when (was_pending || was_subscribed) $ do 324 when (was_pending || was_subscribed) $ do
325 let cons = outGoingConnections . presence_state $ s 325 let cons = remotePeers . presence_state $ s
326 isonline (Presence _ Offline) = False 326 isonline (Presence _ Offline) = False
327 isonline _ = True 327 isonline _ = True
328 presence <- fmap (filter isonline) $ getUserStatus (presence_state s) user 328 presence <- fmap (filter isonline) $ getUserStatus (presence_state s) user
329 me <- getJID s 329 me <- getJID s
330 when (not (null presence)) $ 330 when (not (null presence)) $
331 sendMessage cons (OutBoundPresence . Presence me $ Offline) (peer cjid) 331 sendMessage cons (OutBoundPresence . Presence me $ Offline) (peer cjid)
332 sendMessage (outGoingConnections . presence_state $ s) 332 sendMessage (remotePeers . presence_state $ s)
333 (Rejection (JID (Just user) LocalHost Nothing) 333 (Rejection (JID (Just user) LocalHost Nothing)
334 cjid) 334 cjid)
335 (peer cjid) 335 (peer cjid)
@@ -398,7 +398,7 @@ instance JabberPeerSession PeerSession where
398 stat -> maybe jids (\r -> MM.insert u (r,stat) jids) rsc 398 stat -> maybe jids (\r -> MM.insert u (r,stat) jids) rsc
399 399
400 sendPeerMessage session msg = do 400 sendPeerMessage session msg = do
401 let cons = outGoingConnections . peer_global $ session 401 let cons = remotePeers . peer_global $ session
402 putStrLn $ "sendPeerMessage " <++> bshow msg <++> " --> "<++>bshow (peer_name session) 402 putStrLn $ "sendPeerMessage " <++> bshow msg <++> " --> "<++>bshow (peer_name session)
403 sendMessage cons msg (peer_name session) 403 sendMessage cons msg (peer_name session)
404 404
@@ -612,7 +612,7 @@ sendProbes state jid = do
612 when noinfo $ do 612 when noinfo $ do
613 let msg = if got then PresenceProbe jid buddy else Solicitation jid buddy 613 let msg = if got then PresenceProbe jid buddy else Solicitation jid buddy
614 L.putStrLn $ "sendMessage " <++> bshow msg 614 L.putStrLn $ "sendMessage " <++> bshow msg
615 sendMessage (outGoingConnections state) msg (peer buddy) 615 sendMessage (remotePeers state) msg (peer buddy)
616 616
617 617
618track_login host state e = do 618track_login host state e = do
@@ -666,7 +666,7 @@ start ip4or6 = do
666 dologin :: t -> IO () 666 dologin :: t -> IO ()
667 667
668 chan <- atomically $ subscribeToChan (localSubscriber global_state) 668 chan <- atomically $ subscribeToChan (localSubscriber global_state)
669 remotes <- forkIO $ seekRemotePeers (PeerSessions global_state) chan (outGoingConnections global_state) 669 remotes <- forkIO $ seekRemotePeers (PeerSessions global_state) chan (remotePeers global_state)
670 670
671 installHandler sigUSR1 (Catch (dologin (userError "signaled"))) Nothing 671 installHandler sigUSR1 (Catch (dologin (userError "signaled"))) Nothing
672 -- installHandler sigTERM (CatchOnce (dologin (userError "term signaled"))) Nothing 672 -- installHandler sigTERM (CatchOnce (dologin (userError "term signaled"))) Nothing