summaryrefslogtreecommitdiff
path: root/Assistant/Threads/XMPPClient.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2012-11-10 02:35:54 -0400
committerGravatar Joey Hess <joey@kitenet.net>2012-11-10 02:35:54 -0400
commitadd53662c9c4f956855963e1465775c2f1b0b608 (patch)
treeee0b8fb86135b8e854d688e65ca47583c0148927 /Assistant/Threads/XMPPClient.hs
parentbce81d8cc7551cd790e7ff3c5adb80593a7c88ee (diff)
refactor
Diffstat (limited to 'Assistant/Threads/XMPPClient.hs')
-rw-r--r--Assistant/Threads/XMPPClient.hs16
1 files changed, 8 insertions, 8 deletions
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)