From add53662c9c4f956855963e1465775c2f1b0b608 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sat, 10 Nov 2012 02:35:54 -0400 Subject: refactor --- Assistant/Threads/XMPPClient.hs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'Assistant/Threads/XMPPClient.hs') diff --git a/Assistant/Threads/XMPPClient.hs b/Assistant/Threads/XMPPClient.hs index d1cd375ed..6b6c14ea5 100644 --- a/Assistant/Threads/XMPPClient.hs +++ b/Assistant/Threads/XMPPClient.hs @@ -120,12 +120,12 @@ decodeStanza selfjid s@(ReceivedPresence p) | presenceType p == PresenceError = [ProtocolError s] | presenceFrom p == Nothing = [Ignorable s] | presenceFrom p == Just selfjid = [Ignorable s] - | otherwise = maybe [PresenceMessage p] decode (getGitAnnexAttrValue p) + | otherwise = maybe [PresenceMessage p] decode (gitAnnexTagInfo p) where - decode (attr, (val, _tag)) - | attr == pushAttr = impliedp $ GotNetMessage $ NotifyPush $ - decodePushNotification val - | attr == queryAttr = impliedp $ GotNetMessage QueryPresence + decode i + | tagAttr i == pushAttr = impliedp $ GotNetMessage $ NotifyPush $ + decodePushNotification (tagValue i) + | tagAttr i == queryAttr = impliedp $ GotNetMessage QueryPresence | otherwise = [Unknown s] {- Things sent via presence imply a presence message, - along with their real meaning. -} @@ -134,10 +134,10 @@ 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 =<< getGitAnnexAttrValue m] + | otherwise = [fromMaybe (Unknown s) $ decode =<< gitAnnexTagInfo m] where - decode (attr, (val, tag)) = GotNetMessage <$> - ((\d -> d m val tag) =<< M.lookup attr decoders) + decode i = GotNetMessage <$> + ((\d -> d m i) =<< M.lookup (tagAttr i) decoders) decoders = M.fromList [ (pairAttr, decodePairingNotification) , (canPushAttr, decodeCanPush) -- cgit v1.2.3