summaryrefslogtreecommitdiff
path: root/Assistant
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2013-03-06 22:02:47 -0400
committerGravatar Joey Hess <joey@kitenet.net>2013-03-06 22:02:47 -0400
commit82a9a3bd5c5cc15323e0f7c3a56ed3df46b8d19a (patch)
tree01633ee6bb9b3651dda8528931b6b36bafc540a5 /Assistant
parent4581ce68361c0d318c325af99a961b67de01e958 (diff)
show when not connected to xmpp server
Diffstat (limited to 'Assistant')
-rw-r--r--Assistant/Threads/XMPPClient.hs9
-rw-r--r--Assistant/Types/DaemonStatus.hs3
2 files changed, 8 insertions, 4 deletions
diff --git a/Assistant/Threads/XMPPClient.hs b/Assistant/Threads/XMPPClient.hs
index 0b639cf60..833151e79 100644
--- a/Assistant/Threads/XMPPClient.hs
+++ b/Assistant/Threads/XMPPClient.hs
@@ -47,8 +47,6 @@ restartableClient a = forever $ go =<< liftAnnex getXMPPCreds
where
go Nothing = waitNetMessagerRestart
go (Just creds) = do
- modifyDaemonStatus_ $ \s -> s
- { xmppClientID = Just $ xmppJID creds }
tid <- liftIO $ forkIO $ a creds
waitNetMessagerRestart
liftIO $ killThread tid
@@ -65,6 +63,8 @@ xmppClient urlrenderer d creds =
- trying it again. -}
retry client starttime = do
e <- client
+ liftAssistant $ modifyDaemonStatus_ $ \s -> s
+ { xmppClientID = Nothing }
now <- getCurrentTime
if diffUTCTime now starttime > 300
then do
@@ -79,7 +79,10 @@ xmppClient urlrenderer d creds =
selfjid <- bindJID jid
putStanza gitAnnexSignature
- inAssistant $ debug ["connected", show selfjid]
+ inAssistant $ do
+ modifyDaemonStatus_ $ \s -> s
+ { xmppClientID = Just $ xmppJID creds }
+ debug ["connected", show selfjid]
{- The buddy list starts empty each time
- the client connects, so that stale info
- is not retained. -}
diff --git a/Assistant/Types/DaemonStatus.hs b/Assistant/Types/DaemonStatus.hs
index a22223476..df95b23c0 100644
--- a/Assistant/Types/DaemonStatus.hs
+++ b/Assistant/Types/DaemonStatus.hs
@@ -58,7 +58,8 @@ data DaemonStatus = DaemonStatus
, alertNotifier :: NotificationBroadcaster
-- Broadcasts notifications when the syncRemotes change
, syncRemotesNotifier :: NotificationBroadcaster
- -- When the XMPP client is in use, this will contain its JI.
+ -- When the XMPP client is connected, this will contain the XMPP
+ -- address.
, xmppClientID :: Maybe ClientID
}