summaryrefslogtreecommitdiff
path: root/Remote/External.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2014-12-08 13:57:13 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2014-12-08 13:57:13 -0400
commit28764ce2dc29d1d93989b4061b5b12bac10902de (patch)
tree3b052b0785d387a86dfd9a14d8fd885f2d78d809 /Remote/External.hs
parent335024d92294bd9504e9e9cd42ec0a4addfc4d69 (diff)
implement CLAIMURL for external special remote
Diffstat (limited to 'Remote/External.hs')
-rw-r--r--Remote/External.hs11
1 files changed, 10 insertions, 1 deletions
diff --git a/Remote/External.hs b/Remote/External.hs
index a8526566f..97aa247ba 100644
--- a/Remote/External.hs
+++ b/Remote/External.hs
@@ -70,7 +70,7 @@ gen r u c gc = do
mkUnavailable = gen r u c $
gc { remoteAnnexExternalType = Just "!dne!" },
getInfo = return [("externaltype", externaltype)],
- claimUrl = Nothing
+ claimUrl = Just (claimurl external)
}
where
externaltype = fromMaybe (error "missing externaltype") (remoteAnnexExternalType gc)
@@ -416,3 +416,12 @@ getAvailability external r gc = maybe query return (remoteAnnexAvailability gc)
_ -> Nothing
setRemoteAvailability r avail
return avail
+
+claimurl :: External -> URLString -> Annex Bool
+claimurl external url =
+ handleRequest external (CLAIMURL url) Nothing $ \req -> case req of
+ CLAIMURL_SUCCESS -> Just $ return True
+ CLAIMURL_FAILURE -> Just $ return False
+ UNSUPPORTED_REQUEST -> Just $ return False
+ _ -> Nothing
+