show when not connected to xmpp server
This commit is contained in:
parent
15ef899b12
commit
f8c2dc82d8
4 changed files with 14 additions and 6 deletions
|
@ -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. -}
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
@ -83,6 +83,7 @@ buddyListDisplay :: Widget
|
|||
buddyListDisplay = do
|
||||
autoUpdate ident NotifierBuddyListR (10 :: Int) (10 :: Int)
|
||||
#ifdef WITH_XMPP
|
||||
myjid <- lift $ liftAssistant $ xmppClientID <$> getDaemonStatus
|
||||
buddies <- lift $ liftAssistant $ do
|
||||
rs <- filter isXMPPRemote . syncGitRemotes <$> getDaemonStatus
|
||||
let pairedwith = catMaybes $ map (parseJID . getXMPPClientID) rs
|
||||
|
|
|
@ -3,8 +3,11 @@
|
|||
<tbody>
|
||||
$if null buddies
|
||||
<tr>
|
||||
<td>
|
||||
Nobody is currently available.
|
||||
<td>
|
||||
$if isNothing myjid
|
||||
Not connected to the jabber server. Check your network connection ...
|
||||
$else
|
||||
Nobody is currently available.
|
||||
$else
|
||||
$forall (name, away, canpair, paired, buddyid) <- buddies
|
||||
<tr>
|
||||
|
|
Loading…
Add table
Reference in a new issue