summaryrefslogtreecommitdiff
path: root/Assistant/XMPP
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2012-11-03 16:00:38 -0400
committerGravatar Joey Hess <joey@kitenet.net>2012-11-03 16:01:09 -0400
commitefa88a0f1589a82a91a06ed3a3cbd5f4106aabb4 (patch)
tree013133783caef5e5f693b2734024935fd494551b /Assistant/XMPP
parent2798e659c701a3c6122930ece994411b3ec8b266 (diff)
XMPP pairing notifications are now sent
Rest of pairing process still to do.
Diffstat (limited to 'Assistant/XMPP')
-rw-r--r--Assistant/XMPP/Buddies.hs6
1 files changed, 4 insertions, 2 deletions
diff --git a/Assistant/XMPP/Buddies.hs b/Assistant/XMPP/Buddies.hs
index 217870dc6..d784f316d 100644
--- a/Assistant/XMPP/Buddies.hs
+++ b/Assistant/XMPP/Buddies.hs
@@ -23,15 +23,17 @@ genBuddyID j = BuddyID $ formatJID j
genKey :: JID -> BuddyKey
genKey j = BuddyKey $ formatJID $ JID (jidNode j) (jidDomain j) Nothing
+buddyName :: JID -> Text
+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, BuddyID)
buddySummary b = case clients of
- ((Client j):_) -> Just (buddyname j, away, canpair, genBuddyID j)
+ ((Client j):_) -> Just (buddyName j, away, canpair, genBuddyID j)
[] -> Nothing
where
- buddyname j = maybe (T.pack "") strNode (jidNode j)
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