mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-27 09:30:13 +03:00
Added experimental function to check if a file is known locally.
This commit is contained in:
parent
2206c4a4d1
commit
e183854b58
2 changed files with 26 additions and 0 deletions
22
src/csync.c
22
src/csync.c
|
@ -41,6 +41,7 @@
|
|||
#include "csync_time.h"
|
||||
#include "csync_util.h"
|
||||
#include "csync_misc.h"
|
||||
#include "c_jhash.h"
|
||||
|
||||
#include "csync_update.h"
|
||||
#include "csync_reconcile.h"
|
||||
|
@ -963,6 +964,27 @@ CSYNC_ERROR_CODE csync_get_error(CSYNC *ctx) {
|
|||
return ctx->error_code;
|
||||
}
|
||||
|
||||
bool csync_file_known( char *statedb_file, const char* url ) {
|
||||
int len;
|
||||
uint64_t h;
|
||||
csync_file_stat_t *sb;
|
||||
|
||||
if( ! url ) return false;
|
||||
|
||||
CSYNC *ctx = c_malloc(sizeof(CSYNC));
|
||||
|
||||
ctx->statedb.file = statedb_file;
|
||||
|
||||
len = strlen(statedb_file);
|
||||
h = c_jhash64((uint8_t *) url, len, 0);
|
||||
|
||||
sb = csync_statedb_get_stat_by_hash(ctx, h);
|
||||
|
||||
free(ctx);
|
||||
|
||||
return( sb != NULL );
|
||||
}
|
||||
|
||||
#ifdef LOG_TO_CALLBACK
|
||||
static csync_log_callback log_cb = 0;
|
||||
|
||||
|
|
|
@ -422,6 +422,7 @@ int csync_walk_remote_tree(CSYNC *ctx, csync_treewalk_visit_func *visitor, int f
|
|||
*/
|
||||
CSYNC_ERROR_CODE csync_get_error(CSYNC *ctx);
|
||||
|
||||
|
||||
#ifdef LOG_TO_CALLBACK
|
||||
|
||||
typedef void (*csync_log_callback)(const char *msg);
|
||||
|
@ -432,6 +433,9 @@ void csync_log_cb(char *catName, int a_priority,
|
|||
const char* a_format,...);
|
||||
#endif
|
||||
|
||||
/* dirty stuff from here on - EXPERIMENTAL */
|
||||
/* read the information if a file is known to csync ie. if it has an entry in the database */
|
||||
bool csync_file_known( char *statedb_file, const char* url );
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue