From b5c8f21f25779addb634456425fd55b9321f2de6 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Thu, 7 Mar 2013 02:38:57 -0400 Subject: add alerts while performing xmpp git push/pull --- Assistant/XMPP/Git.hs | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'Assistant') diff --git a/Assistant/XMPP/Git.hs b/Assistant/XMPP/Git.hs index 0a452154b..a088f459e 100644 --- a/Assistant/XMPP/Git.hs +++ b/Assistant/XMPP/Git.hs @@ -250,12 +250,9 @@ xmppRemotes cid = case baseJID <$> parseJID cid of where matching loc r = repoIsUrl r && repoLocation r == loc -whenXMPPRemote :: ClientID -> Assistant () -> Assistant () -whenXMPPRemote cid = unlessM (null <$> xmppRemotes cid) - handlePushInitiation :: NetMessage -> Assistant () handlePushInitiation (Pushing cid CanPush) = - whenXMPPRemote cid $ + unlessM (null <$> xmppRemotes cid) $ sendNetMessage $ Pushing cid PushRequest handlePushInitiation (Pushing cid PushRequest) = go =<< liftAnnex (inRepo Git.Branch.current) @@ -268,12 +265,14 @@ handlePushInitiation (Pushing cid PushRequest) = <$> gitRepo <*> getUUID liftIO $ Command.Sync.updateBranch (Command.Sync.syncBranch branch) g - debug ["pushing to", show rs] selfjid <- ((T.unpack <$>) . xmppClientID) <$> getDaemonStatus - forM_ rs $ \r -> xmppPush cid $ taggedPush u selfjid branch r -handlePushInitiation (Pushing cid StartingPush) = - whenXMPPRemote cid $ - void $ xmppReceivePack cid + forM_ rs $ \r -> alertWhile (syncAlert [r]) $ + xmppPush cid $ taggedPush u selfjid branch r +handlePushInitiation (Pushing cid StartingPush) = do + rs <- xmppRemotes cid + unless (null rs) $ + void $ alertWhile (syncAlert rs) $ + xmppReceivePack cid handlePushInitiation _ = noop handleDeferred :: NetMessage -> Assistant () -- cgit v1.2.3