diff options
author | Joey Hess <joey@kitenet.net> | 2013-03-24 18:55:19 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2013-03-24 18:55:19 -0400 |
commit | 98e460ec24073856f0a8ace7f4d1b28761e0be76 (patch) | |
tree | 5fd332e96442bc4b557a591ec5dc6e3d1f5ecb0c /Assistant/XMPP | |
parent | 9ad09558eb6c9f7ed651168a030e26bc5698c1b8 (diff) |
fix build with xmpp and w/o webapp
Diffstat (limited to 'Assistant/XMPP')
-rw-r--r-- | Assistant/XMPP/Git.hs | 30 |
1 files changed, 8 insertions, 22 deletions
diff --git a/Assistant/XMPP/Git.hs b/Assistant/XMPP/Git.hs index 135c68fbc..f90af4080 100644 --- a/Assistant/XMPP/Git.hs +++ b/Assistant/XMPP/Git.hs @@ -31,10 +31,6 @@ import qualified Remote as Remote import Remote.List import Utility.FileMode import Utility.Shell -#ifdef WITH_WEBAPP -import Assistant.WebApp (UrlRenderer) -import Assistant.WebApp.Configurators.XMPP -#endif import Network.Protocol.XMPP import qualified Data.Text as T @@ -256,11 +252,11 @@ xmppRemotes cid = case baseJID <$> parseJID cid of where matching loc r = repoIsUrl r && repoLocation r == loc -handlePushInitiation :: UrlRenderer -> NetMessage -> Assistant () +handlePushInitiation :: (Remote -> Assistant ()) -> NetMessage -> Assistant () handlePushInitiation _ (Pushing cid CanPush) = unlessM (null <$> xmppRemotes cid) $ sendNetMessage $ Pushing cid PushRequest -handlePushInitiation urlrenderer (Pushing cid PushRequest) = +handlePushInitiation checkcloudrepos (Pushing cid PushRequest) = go =<< liftAnnex (inRepo Git.Branch.current) where go Nothing = noop @@ -276,29 +272,19 @@ handlePushInitiation urlrenderer (Pushing cid PushRequest) = void $ alertWhile (syncAlert [r]) $ xmppPush cid (taggedPush u selfjid branch r) - (handleDeferred urlrenderer) - checkCloudRepos urlrenderer r -handlePushInitiation urlrenderer (Pushing cid StartingPush) = do + (handleDeferred checkcloudrepos) + checkcloudrepos r +handlePushInitiation checkcloudrepos (Pushing cid StartingPush) = do rs <- xmppRemotes cid unless (null rs) $ do void $ alertWhile (syncAlert rs) $ - xmppReceivePack cid (handleDeferred urlrenderer) - mapM_ (checkCloudRepos urlrenderer) rs + xmppReceivePack cid (handleDeferred checkcloudrepos) + mapM_ checkcloudrepos rs handlePushInitiation _ _ = noop -handleDeferred :: UrlRenderer -> NetMessage -> Assistant () +handleDeferred :: (Remote -> Assistant ()) -> NetMessage -> Assistant () handleDeferred = handlePushInitiation -checkCloudRepos :: UrlRenderer -> Remote -> Assistant () --- TODO only display if needed -checkCloudRepos urlrenderer r = -#ifdef WITH_WEBAPP - unlessM (syncingToCloudRemote <$> getDaemonStatus) $ - cloudRepoNeeded urlrenderer (Remote.uuid r) -#else - noop -#endif - writeChunk :: Handle -> B.ByteString -> IO () writeChunk h b = do B.hPut h b |