summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2014-04-09 15:51:00 -0400
committerGravatar Joey Hess <joey@kitenet.net>2014-04-09 15:51:00 -0400
commitdd4916514507cc59a2fc59a87758ea50e43ae536 (patch)
treef2be5528e0b1bab07478f1c2d03513a0c0293b60
parentb7feceff3dfd4ed7c8889036cd43f06642a449da (diff)
also show signal icon next to connected xmpp remotes
-rw-r--r--Assistant/Threads/XMPPClient.hs20
-rw-r--r--debian/changelog2
2 files changed, 14 insertions, 8 deletions
diff --git a/Assistant/Threads/XMPPClient.hs b/Assistant/Threads/XMPPClient.hs
index d23f695f6..39b0459b7 100644
--- a/Assistant/Threads/XMPPClient.hs
+++ b/Assistant/Threads/XMPPClient.hs
@@ -42,17 +42,20 @@ xmppClientThread urlrenderer = namedThread "XMPPClient" $
restartableClient . xmppClient urlrenderer =<< getAssistant id
{- Runs the client, handing restart events. -}
-restartableClient :: (XMPPCreds -> IO ()) -> Assistant ()
+restartableClient :: (XMPPCreds -> UUID -> IO ()) -> Assistant ()
restartableClient a = forever $ go =<< liftAnnex getXMPPCreds
where
go Nothing = waitNetMessagerRestart
go (Just creds) = do
- tid <- liftIO $ forkIO $ a creds
+ xmppuuid <- maybe NoUUID Remote.uuid . headMaybe
+ . filter Remote.isXMPPRemote . syncRemotes
+ <$> getDaemonStatus
+ tid <- liftIO $ forkIO $ a creds xmppuuid
waitNetMessagerRestart
liftIO $ killThread tid
-xmppClient :: UrlRenderer -> AssistantData -> XMPPCreds -> IO ()
-xmppClient urlrenderer d creds =
+xmppClient :: UrlRenderer -> AssistantData -> XMPPCreds -> UUID -> IO ()
+xmppClient urlrenderer d creds xmppuuid =
retry (runclient creds) =<< getCurrentTime
where
liftAssistant = runAssistant d
@@ -67,10 +70,12 @@ xmppClient urlrenderer d creds =
- is not retained. -}
liftAssistant $
updateBuddyList (const noBuddies) <<~ buddyList
- liftAssistant $
void client
- liftAssistant $ modifyDaemonStatus_ $ \s -> s
- { xmppClientID = Nothing }
+ liftAssistant $ do
+ modifyDaemonStatus_ $ \s -> s
+ { xmppClientID = Nothing }
+ changeCurrentlyConnected $ S.delete xmppuuid
+
now <- getCurrentTime
if diffUTCTime now starttime > 300
then do
@@ -88,6 +93,7 @@ xmppClient urlrenderer d creds =
inAssistant $ do
modifyDaemonStatus_ $ \s -> s
{ xmppClientID = Just $ xmppJID creds }
+ changeCurrentlyConnected $ S.insert xmppuuid
debug ["connected", logJid selfjid]
lasttraffic <- liftIO $ atomically . newTMVar =<< getCurrentTime
diff --git a/debian/changelog b/debian/changelog
index bd908fa6c..ab632935b 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -6,7 +6,7 @@ git-annex (5.20140406) UNRELEASED; urgency=medium
changes to a ssh remote, and pulls.
XMPP is no longer needed in this configuration!
Requires the remote server have git-annex-shell with notifychanges support.
- * webapp: Show a network signal icon next to ssh remotes that
+ * webapp: Show a network signal icon next to ssh and xmpp remotes that
it's currently connected with.
-- Joey Hess <joeyh@debian.org> Mon, 07 Apr 2014 16:22:02 -0400