diff options
author | Joey Hess <joey@kitenet.net> | 2012-11-03 14:25:06 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2012-11-03 14:25:06 -0400 |
commit | 414fb6e1dc03201cb237041be97670c12be90f9f (patch) | |
tree | a0d442d2e99bc8fd8647d810f1856bbd22356b74 | |
parent | 1279d72b4e4fe77abb983954dc937021559d4169 (diff) |
send a presence query when the buddy list is displayed
This ensures that clients that have not sent presence in a while will show
up in the list.
-rw-r--r-- | Assistant/Threads/XMPPClient.hs | 4 | ||||
-rw-r--r-- | Assistant/Types/NetMessager.hs | 6 | ||||
-rw-r--r-- | Assistant/XMPP.hs | 3 |
3 files changed, 10 insertions, 3 deletions
diff --git a/Assistant/Threads/XMPPClient.hs b/Assistant/Threads/XMPPClient.hs index 7fb3cc874..9ecceabe5 100644 --- a/Assistant/Threads/XMPPClient.hs +++ b/Assistant/Threads/XMPPClient.hs @@ -88,8 +88,8 @@ xmppClientThread = NamedThread "XMPPClient" $ do relayNetMessage :: Assistant (XMPP ()) relayNetMessage = convert <$> waitNetMessage where - convert (NotifyPush us) = - putStanza $ gitAnnexPresence $ encodePushNotification us + convert (NotifyPush us) = putStanza $ pushNotification us + convert QueryPresence = putStanza presenceQuery data DecodedStanza = PresenceMessage Presence diff --git a/Assistant/Types/NetMessager.hs b/Assistant/Types/NetMessager.hs index fea88a53a..6bc9ec34a 100644 --- a/Assistant/Types/NetMessager.hs +++ b/Assistant/Types/NetMessager.hs @@ -13,7 +13,11 @@ import Control.Concurrent.STM import Control.Concurrent.MSampleVar {- Messages that can be sent out of band by a network messager. -} -data NetMessage = NotifyPush [UUID] +data NetMessage + -- indicate that pushes have been made to the repos with these uuids + = NotifyPush [UUID] + -- requests other clients to inform us of their presence + | QueryPresence {- Controls for the XMPP client. - diff --git a/Assistant/XMPP.hs b/Assistant/XMPP.hs index 05bc94fa3..834055fbc 100644 --- a/Assistant/XMPP.hs +++ b/Assistant/XMPP.hs @@ -84,6 +84,9 @@ decodePushNotification (Element name attrs _nodes) fromContent (ContentText t) = t fromContent (ContentEntity t) = t +pushNotification :: [UUID] -> Presence +pushNotification = gitAnnexPresence . encodePushNotification + {- A request for other git-annex clients to send presence. -} presenceQuery :: Presence presenceQuery = gitAnnexPresence $ Element gitAnnexTagName |