diff options
author | Joey Hess <joey@kitenet.net> | 2013-03-07 02:38:57 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2013-03-07 02:38:57 -0400 |
commit | b5c8f21f25779addb634456425fd55b9321f2de6 (patch) | |
tree | 90ffb620fe75e1f6a278440b75a34b39bcc1c307 /Assistant/XMPP | |
parent | 406b650a1ca2b0f097366ebcede42c8a646df8df (diff) |
add alerts while performing xmpp git push/pull
Diffstat (limited to 'Assistant/XMPP')
-rw-r--r-- | Assistant/XMPP/Git.hs | 17 |
1 files changed, 8 insertions, 9 deletions
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 () |