diff options
author | Joey Hess <joey@kitenet.net> | 2012-11-10 13:00:13 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2012-11-10 13:00:13 -0400 |
commit | 5b4a5e8dbe91bbabe43e3ff4f9ec862e07a56a18 (patch) | |
tree | eae9cd025f8d41837ad69ffece327385ad8d59ba /Assistant/Threads/XMPPClient.hs | |
parent | d09af0d7b429b2a83f27ef3f0c3b40c47fc6a24d (diff) |
more nice refactoring
Diffstat (limited to 'Assistant/Threads/XMPPClient.hs')
-rw-r--r-- | Assistant/Threads/XMPPClient.hs | 22 |
1 files changed, 3 insertions, 19 deletions
diff --git a/Assistant/Threads/XMPPClient.hs b/Assistant/Threads/XMPPClient.hs index 3b2632c76..5a1323770 100644 --- a/Assistant/Threads/XMPPClient.hs +++ b/Assistant/Threads/XMPPClient.hs @@ -134,19 +134,7 @@ decodeStanza selfjid s@(ReceivedMessage m) | messageFrom m == Nothing = [Ignorable s] | messageFrom m == Just selfjid = [Ignorable s] | messageType m == MessageError = [ProtocolError s] - | otherwise = [fromMaybe (Unknown s) $ decode =<< gitAnnexTagInfo m] - where - decode i = GotNetMessage <$> - ((\d -> d m i) =<< M.lookup (tagAttr i) decoders) - decoders = M.fromList - [ (pairAttr, decodePairingNotification) - , (canPushAttr, decodeCanPush) - , (pushRequestAttr, decodePushRequest) - , (startingPushAttr, decodeStartingPush) - , (receivePackAttr, decodeReceivePackOutput) - , (sendPackAttr, decodeSendPackOutput) - , (receivePackDoneAttr, decodeReceivePackDone) - ] + | otherwise = [fromMaybe (Unknown s) (GotNetMessage <$> decodeMessage m)] decodeStanza _ s = [Unknown s] {- Waits for a NetMessager message to be sent, and relays it to XMPP. -} @@ -158,12 +146,8 @@ relayNetMessage selfjid = convert =<< waitNetMessage convert (PairingNotification stage c u) = withclient c $ \tojid -> do changeBuddyPairing tojid True return $ putStanza $ pairingNotification stage u tojid selfjid - convert (Pushing c CanPush) = sendclient c canPush - convert (Pushing c PushRequest) = sendclient c pushRequest - convert (Pushing c StartingPush) = sendclient c startingPush - convert (Pushing c (ReceivePackOutput b)) = sendclient c $ receivePackOutput b - convert (Pushing c (SendPackOutput b)) = sendclient c $ sendPackOutput b - convert (Pushing c (ReceivePackDone code)) = sendclient c $ receivePackDone code + convert (Pushing c pushstage) = sendclient c $ + gitAnnexMessage $ encodePushStage pushstage sendclient c construct = withclient c $ \tojid -> return $ putStanza $ construct tojid selfjid |