mirror of
https://github.com/nextcloud/desktop.git
synced 2024-10-24 21:35:47 +03:00
Added a module commit function.
This commit is contained in:
parent
19f6b919af
commit
4bdabb7f46
5 changed files with 32 additions and 5 deletions
|
@ -1988,6 +1988,22 @@ static char *owncloud_error_string()
|
|||
return dav_session.error_string;
|
||||
}
|
||||
|
||||
static void owncloud_commit() {
|
||||
SAFE_FREE( _lastDir );
|
||||
|
||||
clean_caches();
|
||||
|
||||
if( dav_session.ctx )
|
||||
ne_session_destroy( dav_session.ctx );
|
||||
/* DEBUG_WEBDAV( "********** vio_module_shutdown" ); */
|
||||
|
||||
ne_sock_exit();
|
||||
_connected = 0; /* triggers dav_connect to go through the whole neon setup */
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
static int owncloud_utimes(const char *uri, const struct timeval *times) {
|
||||
|
||||
ne_proppatch_operation ops[2];
|
||||
|
@ -2099,7 +2115,9 @@ csync_vio_method_t _method = {
|
|||
.chown = owncloud_chown,
|
||||
.utimes = owncloud_utimes,
|
||||
.set_property = owncloud_set_property,
|
||||
.get_error_string = owncloud_error_string
|
||||
.get_error_string = owncloud_error_string,
|
||||
.commit = owncloud_commit
|
||||
|
||||
};
|
||||
|
||||
csync_vio_method_t *vio_module_init(const char *method_name, const char *args,
|
||||
|
|
|
@ -750,6 +750,8 @@ int csync_commit(CSYNC *ctx) {
|
|||
/* The other steps happen anyway, what else can we do? */
|
||||
}
|
||||
|
||||
csync_vio_commit(ctx);
|
||||
|
||||
/* destroy the rbtrees */
|
||||
if (c_rbtree_size(ctx->local.tree) > 0) {
|
||||
c_rbtree_destroy(ctx->local.tree, _tree_destructor);
|
||||
|
|
|
@ -653,16 +653,14 @@ int csync_vio_utimes(CSYNC *ctx, const char *uri, const struct timeval *times) {
|
|||
return rc;
|
||||
}
|
||||
|
||||
int csync_vio_set_property(CSYNC* ctx, const char* key, void* data)
|
||||
{
|
||||
int csync_vio_set_property(CSYNC* ctx, const char* key, void* data) {
|
||||
int rc = -1;
|
||||
if(VIO_METHOD_HAS_FUNC(ctx->module.method, set_property))
|
||||
rc = ctx->module.method->set_property(key, data);
|
||||
return rc;
|
||||
}
|
||||
|
||||
char *csync_vio_get_error_string(CSYNC *ctx)
|
||||
{
|
||||
char *csync_vio_get_error_string(CSYNC *ctx) {
|
||||
if(ctx->error_string) {
|
||||
return ctx->error_string;
|
||||
}
|
||||
|
@ -672,3 +670,8 @@ char *csync_vio_get_error_string(CSYNC *ctx)
|
|||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void csync_vio_commit(CSYNC *ctx) {
|
||||
if(VIO_METHOD_HAS_FUNC(ctx->module.method, commit))
|
||||
ctx->module.method->commit();
|
||||
}
|
||||
|
|
|
@ -67,4 +67,6 @@ int csync_vio_set_property(CSYNC *ctx, const char *key, void *data);
|
|||
|
||||
char *csync_vio_get_error_string(CSYNC *ctx);
|
||||
|
||||
void csync_vio_commit(CSYNC *ctx);
|
||||
|
||||
#endif /* _CSYNC_VIO_H */
|
||||
|
|
|
@ -81,6 +81,7 @@ typedef int (*csync_method_utimes_fn)(const char *uri, const struct timeval time
|
|||
typedef int (*csync_method_set_property_fn)(const char *key, void *data);
|
||||
|
||||
typedef char* (*csync_method_get_error_string_fn)();
|
||||
typedef void (*csync_method_commit_fn)();
|
||||
|
||||
struct csync_vio_method_s {
|
||||
size_t method_table_size; /* Used for versioning */
|
||||
|
@ -106,6 +107,7 @@ struct csync_vio_method_s {
|
|||
csync_method_sendfile_fn sendfile;
|
||||
csync_method_set_property_fn set_property;
|
||||
csync_method_get_error_string_fn get_error_string;
|
||||
csync_method_commit_fn commit;
|
||||
};
|
||||
|
||||
#endif /* _CSYNC_VIO_H */
|
||||
|
|
Loading…
Reference in a new issue