diff --git a/modules/csync_owncloud.c b/modules/csync_owncloud.c index 2b940b2970..982f89df84 100644 --- a/modules/csync_owncloud.c +++ b/modules/csync_owncloud.c @@ -1132,94 +1132,6 @@ static int owncloud_rmdir(const char *uri) { return 0; } -static int _stat(const char *uri, csync_vio_file_stat_t *buf) { - /* get props: - * modtime - * creattime - * size - */ - int rc = 0; - csync_vio_file_stat_t *lfs = NULL; - struct listdir_context *fetchCtx = NULL; - - DEBUG_WEBDAV(("__stat__ %s called\n", uri )); - - buf->name = c_basename(uri); - - if (buf->name == NULL) { - csync_vio_file_stat_destroy(buf); - errno = ENOMEM; - return -1; - } - - /* check if the data in the static 'cache' fs is for the same file. - * The cache is filled by readdir which is often called directly before - * stat. If the cache matches, a http call is saved. - */ - if( _fs.name && strcmp( buf->name, _fs.name ) == 0 ) { - buf->fields = CSYNC_VIO_FILE_STAT_FIELDS_NONE; - buf->fields |= CSYNC_VIO_FILE_STAT_FIELDS_TYPE; - buf->fields |= CSYNC_VIO_FILE_STAT_FIELDS_SIZE; - buf->fields |= CSYNC_VIO_FILE_STAT_FIELDS_MTIME; - buf->fields |= CSYNC_VIO_FILE_STAT_FIELDS_PERMISSIONS; - - buf->fields = _fs.fields; - buf->type = _fs.type; - buf->mtime = _fs.mtime; - buf->size = _fs.size; - buf->mode = _stat_perms( _fs.type ); - } else { - // fetch data via a propfind call. - DEBUG_WEBDAV(("I have no stat cache, call propfind.\n")); - - fetchCtx = c_malloc( sizeof( struct listdir_context )); - if( ! fetchCtx ) { - errno = ne_error_to_errno( NE_ERROR ); - csync_vio_file_stat_destroy(buf); - return -1; - } - - fetchCtx->list = NULL; - fetchCtx->target = _cleanPath( uri ); - fetchCtx->include_target = 1; - fetchCtx->currResource = NULL; - - DEBUG_WEBDAV(("fetchCtx good.\n" )); - - rc = fetch_resource_list( uri, NE_DEPTH_ONE, fetchCtx ); - if( rc != NE_OK ) { - errno = ne_error_to_errno( rc ); - SAFE_FREE(fetchCtx); - csync_vio_file_stat_destroy(buf); - return -1; - } - - if( fetchCtx ) { - fetchCtx->currResource = fetchCtx->list; - lfs = resourceToFileStat( fetchCtx->currResource ); - if( lfs ) { - buf->fields = CSYNC_VIO_FILE_STAT_FIELDS_NONE; - buf->fields |= CSYNC_VIO_FILE_STAT_FIELDS_TYPE; - buf->fields |= CSYNC_VIO_FILE_STAT_FIELDS_SIZE; - buf->fields |= CSYNC_VIO_FILE_STAT_FIELDS_MTIME; - buf->fields |= CSYNC_VIO_FILE_STAT_FIELDS_PERMISSIONS; - - buf->fields = lfs->fields; - buf->type = lfs->type; - buf->mtime = lfs->mtime; - buf->size = lfs->size; - buf->mode = _stat_perms( lfs->type ); - - csync_vio_file_stat_destroy( lfs ); - } - SAFE_FREE( fetchCtx ); - } - } - DEBUG_WEBDAV(("STAT result: %s, type=%d\n", buf->name, buf->type )); - - return 0; -} - static int owncloud_rename(const char *olduri, const char *newuri) { char *src = NULL; char *target = NULL;