int SeafileRpcClient::checkPathForClone(const QString& path, QString *err_msg) { GError *error = NULL; int ret = searpc_client_call__int (seafile_rpc_client_, "seafile_check_path_for_clone", &error, 1, "string", toCStr(path)); if (ret == 0) { return 0; } QString err; const char *msg = error->message; if (g_strcmp0(msg, "Worktree conflicts system path") == 0) { err = tr("The path \"%1\" conflicts with system path").arg(path); } else if (g_strcmp0(msg, "Worktree conflicts existing repo") == 0) { err = tr("The path \"%1\" conflicts with an existing library").arg(path); } else { err = QString::fromUtf8(msg); } g_error_free(error); if (err_msg) { *err_msg = err; } return -1; }
int ccnet_update_peer_address (SearpcClient *client, const char *peer_id, const char *addr, int port) { return searpc_client_call__int ( client, "update_peer_address", NULL, 3, "string", peer_id, "string", addr, "int", port); }
void ccnet_login_to_relay (SearpcClient *client, const char *relay_id, const char *username, const char *passwd) { searpc_client_call__int (client, "login_relay", NULL, 3, "string", relay_id, "string", username, "string", passwd); }
void SeafileRpcClient::syncRepoImmediately(const QString& repo_id) { searpc_client_call__int (seafile_rpc_client_, "seafile_sync", NULL, 2, "string", toCStr(repo_id), "string", NULL); }
int SeafileRpcClient::setAutoSync(bool autoSync) { GError *error = NULL; if (autoSync) { int ret = searpc_client_call__int (seafile_rpc_client_, "seafile_enable_auto_sync", &error, 0); return ret; } else { int ret = searpc_client_call__int (seafile_rpc_client_, "seafile_disable_auto_sync", &error, 0); return ret; } return 0; }
int SeafileRpcClient::unsync(const QString& repo_id) { GError *error = NULL; return searpc_client_call__int(seafile_rpc_client_, "seafile_destroy_repo", &error, 1, "string", toCStr(repo_id)); }
int seafile_check_quota (SearpcClient *client, const char *repo_id, GError **error) { return searpc_client_call__int (client, "check_quota", error, 1, "string", repo_id); }
int seafile_set_user_quota (SearpcClient *client, const char *user, gint64 quota, GError **error) { return searpc_client_call__int (client, "set_user_quota", error, 2, "string", user, "int64", "a); }
int seafile_set_org_quota (SearpcClient *client, int org_id, gint64 quota, GError **error) { return searpc_client_call__int (client, "set_org_quota", error, 2, "int", org_id, "int64", "a); }
void SeafileRpcClient::setRepoAutoSync(const QString& repo_id, bool auto_sync) { GError *error = NULL; searpc_client_call__int(seafile_rpc_client_, "seafile_set_repo_property", &error, 3, "string", toCStr(repo_id), "string", "auto-sync", "string", auto_sync ? "true" : "false"); }
int seafile_set_config (SearpcClient *client, const char *key, const char *value) { if (!key || !value) return -1; return searpc_client_call__int ( client, "seafile_set_config", NULL, 2, "string", key, "string", value); }
int seafile_destroy_repo (SearpcClient *client, const char *repo_id, GError **error) { g_return_val_if_fail (client && repo_id, -1); return searpc_client_call__int ( client, "seafile_destroy_repo", error, 1, "string", repo_id); }
int SeafileRpcClient::seafileGetConfigInt(const QString &key, int *value) { GError *error = NULL; *value = searpc_client_call__int (seafile_rpc_client_, "seafile_get_config_int", &error, 1, "string", toCStr(key)); if (error) { return -1; } return 0; }
int seafile_set_monitor (SearpcClient *client, const char *peer_id, GError **error) { if (!peer_id) return -1; return searpc_client_call__int ( client, "seafile_set_monitor", error, 1, "string", peer_id); }
int seafile_del_chunk_server (SearpcClient *client, const char *server_id, GError **error) { if (!server_id) return -1; return searpc_client_call__int ( client, "seafile_del_chunk_server", error, 1, "string", server_id); }
int SeafileRpcClient::seafileSetConfigInt(const QString &key, int value) { GError *error = NULL; searpc_client_call__int (seafile_rpc_client_, "seafile_set_config", &error, 2, "string", toCStr(key), "int", value); if (error) { return -1; } return 0; }
int SeafileRpcClient::setRateLimit(bool upload, int limit) { GError *error = NULL; const char *rpc = upload ? "seafile_set_upload_rate_limit" : "seafile_set_download_rate_limit"; searpc_client_call__int (seafile_rpc_client_, rpc, &error, 1, "int", limit); if (error) { return -1; } return 0; }
int seafile_set_repo_token (SearpcClient *client, const char *repo_id, const char *token, GError **error) { g_return_val_if_fail (client && repo_id && token, -1); return searpc_client_call__int ( client, "seafile_set_repo_token", error, 2, "string", repo_id, "string", token); }
int SeafileRpcClient::setAutoSync(bool autoSync) { GError *error = NULL; int ret; if (autoSync) { ret = searpc_client_call__int (seafile_rpc_client_, "seafile_enable_auto_sync", &error, 0); } else { ret = searpc_client_call__int (seafile_rpc_client_, "seafile_disable_auto_sync", &error, 0); } if (error) { qWarning("failed to set auto_sync: %s\n", error->message); g_error_free(error); } return ret; }
int SeafileRpcClient::ccnetSetConfig(const QString &key, const QString &value) { GError *error = NULL; searpc_client_call__int (ccnet_rpc_client_, "set_config", &error, 2, "string", toCStr(key), "string", toCStr(value)); if (error) { return -1; } return 0; }
int SeafileRpcClient::seafileGetConfigInt(const QString &key, int *value) { GError *error = NULL; *value = searpc_client_call__int (seafile_rpc_client_, "seafile_get_config_int", &error, 1, "string", toCStr(key)); if (error) { qWarning("Unable to get config (int) value %s", key.toUtf8().data()); g_error_free(error); return -1; } return 0; }
int seafile_set_repo_property (SearpcClient *client, const char *repo_id, const char *key, const char *value, GError **error) { g_return_val_if_fail (client && repo_id && key, -1); return searpc_client_call__int ( client, "seafile_set_repo_property", error, 3, "string", repo_id, "string", key, "string", value); }
int ccnet_verify_message (SearpcClient *client, const char *message, const char *sig_base64, const char *peer_id) { if (!message || !sig_base64 || !peer_id) return -1; return searpc_client_call__int ( client, "verify_message", NULL, 3, "string", message, "string", sig_base64, "string", peer_id); }
int SeafileRpcClient::unsync(const QString& repo_id) { GError *error = NULL; int ret = searpc_client_call__int(seafile_rpc_client_, "seafile_destroy_repo", &error, 1, "string", toCStr(repo_id)); if (error) { g_error_free(error); } return ret; }
int SeafileRpcClient::getUploadRate(int *rate) { GError *error = NULL; int ret = searpc_client_call__int (seafile_rpc_client_, "seafile_get_upload_rate", &error, 0); if (error) { return -1; } *rate = ret; return 0; }
int SeafileRpcClient::seafileSetConfig(const QString &key, const QString &value) { GError *error = NULL; searpc_client_call__int (seafile_rpc_client_, "seafile_set_config", &error, 2, "string", toCStr(key), "string", toCStr(value)); if (error) { qWarning("Unable to set config value %s", key.toUtf8().data()); g_error_free(error); return -1; } return 0; }
int SeafileRpcClient::seafileSetConfigInt(const QString &key, int value) { // printf ("set config: %s = %d\n", toCStr(key), value); GError *error = NULL; searpc_client_call__int (seafile_rpc_client_, "seafile_set_config_int", &error, 2, "string", toCStr(key), "int", value); if (error) { g_error_free(error); return -1; } return 0; }
int seafile_post_multi_files (SearpcClient *client, const char *repo_id, const char *parent_dir, const char *filenames_json, const char *paths_json, const char *user, GError **error) { return searpc_client_call__int (client, "seafile_post_multi_files", error, 5, "string", repo_id, "string", parent_dir, "string", filenames_json, "string", paths_json, "string", user); }
int seafile_post_file (SearpcClient *client, const char *repo_id, const char *file_path, const char *parent_dir, const char *file_name, const char *user, GError **error) { return searpc_client_call__int (client, "seafile_post_file", error, 5, "string", repo_id, "string", file_path, "string", parent_dir, "string", file_name, "string", user); }
int SeafileRpcClient::removeCloneTask(const QString& repo_id, QString *err) { GError *error = NULL; int ret = searpc_client_call__int (seafile_rpc_client_, "seafile_remove_clone_task", &error, 1, "string", toCStr(repo_id)); if (ret < 0) { if (err) { *err = error ? error->message : tr("Unknown error"); } } return ret; }