summaryrefslogtreecommitdiff
path: root/Assistant/Threads/PairListener.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2012-09-09 16:24:34 -0400
committerGravatar Joey Hess <joey@kitenet.net>2012-09-09 16:24:34 -0400
commit16cefae7f276e12c20e203729aad23cfd90f0ec3 (patch)
tree24291391d3a9affc1f987f7b200c3c8fb0a49961 /Assistant/Threads/PairListener.hs
parentded85175455bf355753ea26263898487c2162ab5 (diff)
add an alert while a locally initiated pairing request is in progress
Has a button to cancel the request.
Diffstat (limited to 'Assistant/Threads/PairListener.hs')
-rw-r--r--Assistant/Threads/PairListener.hs12
1 files changed, 7 insertions, 5 deletions
diff --git a/Assistant/Threads/PairListener.hs b/Assistant/Threads/PairListener.hs
index 3dc1a331f..e7104dc28 100644
--- a/Assistant/Threads/PairListener.hs
+++ b/Assistant/Threads/PairListener.hs
@@ -56,7 +56,7 @@ pairListenerThread st dstatus urlrenderer = thread $ withSocketsDo $ do
pairReqAlert :: DaemonStatusHandle -> UrlRenderer -> PairMsg -> IO ()
pairReqAlert dstatus urlrenderer msg = unlessM myreq $ do
url <- renderUrl urlrenderer (FinishPairR msg) []
- void $ addAlert dstatus $ pairRequestAlert repo
+ void $ addAlert dstatus $ pairRequestReceivedAlert repo
(repo ++ " is sending a pair request.") $
AlertButton
{ buttonUrl = url
@@ -74,16 +74,18 @@ pairReqAlert dstatus urlrenderer msg = unlessM myreq $ do
, ":"
, (remoteDirectory pairdata)
]
- {- Filter out our own pair requests, by checking if we
- - can verify using the secrets of any of them. -}
- myreq = any (verified v . inProgressSecret) . pairingInProgress
- <$> getDaemonStatus dstatus
+ {- Filter out our own pair request, by checking if we
+ - can verify using its secret. -}
+ myreq = maybe False (verified v . inProgressSecret)
+ . pairingInProgress
+ <$> getDaemonStatus dstatus
{- Remove the button when it's clicked, and change the
- alert to be in progress. This alert cannot be entirely
- removed since more pair request messages are coming in
- and would re-add it. -}
onclick i = updateAlert dstatus i $ \alert -> Just $ alert
{ alertButton = Nothing
+ , alertClass = Activity
, alertIcon = Just ActivityIcon
, alertData = [UnTensed $ T.pack $ "pair request with " ++ repo ++ " in progress"]
}