also show signal icon next to connected xmpp remotes

This commit is contained in:
Joey Hess 2014-04-09 15:51:00 -04:00
parent 33b8cff433
commit 14349fb752
2 changed files with 14 additions and 8 deletions

View file

@ -42,17 +42,20 @@ xmppClientThread urlrenderer = namedThread "XMPPClient" $
restartableClient . xmppClient urlrenderer =<< getAssistant id restartableClient . xmppClient urlrenderer =<< getAssistant id
{- Runs the client, handing restart events. -} {- Runs the client, handing restart events. -}
restartableClient :: (XMPPCreds -> IO ()) -> Assistant () restartableClient :: (XMPPCreds -> UUID -> IO ()) -> Assistant ()
restartableClient a = forever $ go =<< liftAnnex getXMPPCreds restartableClient a = forever $ go =<< liftAnnex getXMPPCreds
where where
go Nothing = waitNetMessagerRestart go Nothing = waitNetMessagerRestart
go (Just creds) = do 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 waitNetMessagerRestart
liftIO $ killThread tid liftIO $ killThread tid
xmppClient :: UrlRenderer -> AssistantData -> XMPPCreds -> IO () xmppClient :: UrlRenderer -> AssistantData -> XMPPCreds -> UUID -> IO ()
xmppClient urlrenderer d creds = xmppClient urlrenderer d creds xmppuuid =
retry (runclient creds) =<< getCurrentTime retry (runclient creds) =<< getCurrentTime
where where
liftAssistant = runAssistant d liftAssistant = runAssistant d
@ -67,10 +70,12 @@ xmppClient urlrenderer d creds =
- is not retained. -} - is not retained. -}
liftAssistant $ liftAssistant $
updateBuddyList (const noBuddies) <<~ buddyList updateBuddyList (const noBuddies) <<~ buddyList
liftAssistant $
void client void client
liftAssistant $ modifyDaemonStatus_ $ \s -> s liftAssistant $ do
{ xmppClientID = Nothing } modifyDaemonStatus_ $ \s -> s
{ xmppClientID = Nothing }
changeCurrentlyConnected $ S.delete xmppuuid
now <- getCurrentTime now <- getCurrentTime
if diffUTCTime now starttime > 300 if diffUTCTime now starttime > 300
then do then do
@ -88,6 +93,7 @@ xmppClient urlrenderer d creds =
inAssistant $ do inAssistant $ do
modifyDaemonStatus_ $ \s -> s modifyDaemonStatus_ $ \s -> s
{ xmppClientID = Just $ xmppJID creds } { xmppClientID = Just $ xmppJID creds }
changeCurrentlyConnected $ S.insert xmppuuid
debug ["connected", logJid selfjid] debug ["connected", logJid selfjid]
lasttraffic <- liftIO $ atomically . newTMVar =<< getCurrentTime lasttraffic <- liftIO $ atomically . newTMVar =<< getCurrentTime

2
debian/changelog vendored
View file

@ -6,7 +6,7 @@ git-annex (5.20140406) UNRELEASED; urgency=medium
changes to a ssh remote, and pulls. changes to a ssh remote, and pulls.
XMPP is no longer needed in this configuration! XMPP is no longer needed in this configuration!
Requires the remote server have git-annex-shell with notifychanges support. 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. it's currently connected with.
-- Joey Hess <joeyh@debian.org> Mon, 07 Apr 2014 16:22:02 -0400 -- Joey Hess <joeyh@debian.org> Mon, 07 Apr 2014 16:22:02 -0400