summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2012-11-10 01:40:50 -0400
committerGravatar Joey Hess <joey@kitenet.net>2012-11-10 01:40:50 -0400
commita41f01d88bc30c9a26b2558789566d9f8e661fa8 (patch)
tree9869530a3ee2d1bd2e9cce98240b79ef3641a777
parentcf18a864ff07942475ed1c24743d0985e3bec642 (diff)
refactor
-rw-r--r--Assistant/Threads/XMPPClient.hs12
1 files changed, 5 insertions, 7 deletions
diff --git a/Assistant/Threads/XMPPClient.hs b/Assistant/Threads/XMPPClient.hs
index ef97d653a..4d34e7eb8 100644
--- a/Assistant/Threads/XMPPClient.hs
+++ b/Assistant/Threads/XMPPClient.hs
@@ -96,17 +96,15 @@ xmppClient urlrenderer d = do
handle _ (GotNetMessage (NotifyPush us)) = void $ inAssistant $ pull us
handle selfjid (GotNetMessage (PairingNotification stage c u)) =
maybe noop (inAssistant . pairMsgReceived urlrenderer stage u selfjid) (parseJID c)
- handle _ (GotNetMessage m@(CanPush _)) = handlepushmsg m
- handle _ (GotNetMessage m@(PushRequest _)) = handlepushmsg m
- handle _ (GotNetMessage m@(StartingPush _)) = handlepushmsg m
- handle _ (GotNetMessage m) = void $ inAssistant $ queueNetPushMessage m
+ handle _ (GotNetMessage pushmsg)
+ | isPushInitiationMessage pushmsg = inAssistant $
+ unlessM (queueNetPushMessage pushmsg) $
+ void $ forkIO <~> handlePushMessage pushmsg
+ | otherwise = void $ inAssistant $ queueNetPushMessage pushmsg
handle _ (Ignorable _) = noop
handle _ (Unknown _) = noop
handle _ (ProtocolError _) = noop
- handlepushmsg m = inAssistant $
- unlessM (queueNetPushMessage m) $
- void $ forkIO <~> handlePushMessage m
data XMPPEvent
= GotNetMessage NetMessage