aboutsummaryrefslogtreecommitdiff
path: root/Assistant/XMPP
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2012-11-10 16:35:09 -0400
committerGravatar Joey Hess <joey@kitenet.net>2012-11-10 16:36:21 -0400
commitd55ec6c25e8843910930a8e760db9793aad637ec (patch)
tree9f33b37d51379765399c6a17e1f5fd257c41f9b7 /Assistant/XMPP
parentc629bc1a599da582be71d497f59dabc1961735d3 (diff)
show when a buddy is already paired
Diffstat (limited to 'Assistant/XMPP')
-rw-r--r--Assistant/XMPP/Buddies.hs7
1 files changed, 4 insertions, 3 deletions
diff --git a/Assistant/XMPP/Buddies.hs b/Assistant/XMPP/Buddies.hs
index fdc307972..7383c38d9 100644
--- a/Assistant/XMPP/Buddies.hs
+++ b/Assistant/XMPP/Buddies.hs
@@ -26,14 +26,15 @@ buddyName j = maybe (T.pack "") strNode (jidNode j)
{- Summary of info about a buddy.
-
- If the buddy has no clients at all anymore, returns Nothing. -}
-buddySummary :: Buddy -> Maybe (Text, Bool, Bool, BuddyKey)
-buddySummary b = case clients of
- ((Client j):_) -> Just (buddyName j, away, canpair, genBuddyKey j)
+buddySummary :: [JID] -> Buddy -> Maybe (Text, Bool, Bool, Bool, BuddyKey)
+buddySummary pairedwith b = case clients of
+ ((Client j):_) -> Just (buddyName j, away, canpair, alreadypaired j, genBuddyKey j)
[] -> Nothing
where
away = S.null (buddyPresent b) && S.null (buddyAssistants b)
canpair = not $ S.null (buddyAssistants b)
clients = S.toList $ buddyPresent b `S.union` buddyAway b `S.union` buddyAssistants b
+ alreadypaired j = baseJID j `elem` pairedwith
{- Updates the buddies with XMPP presence info. -}
updateBuddies :: Presence -> Buddies -> Buddies