void seafile_session_prepare (SeafileSession *session) { /* load config */ session->sync_extra_temp_file = seafile_session_config_get_bool (session, KEY_SYNC_EXTRA_TEMP_FILE); /* Enable http sync by default. */ session->enable_http_sync = TRUE; session->disable_verify_certificate = seafile_session_config_get_bool (session, KEY_DISABLE_VERIFY_CERTIFICATE); session->use_http_proxy = seafile_session_config_get_bool(session, KEY_USE_PROXY); gboolean use_system_proxy = seafile_session_config_get_bool(session, "use_system_proxy"); if (use_system_proxy) { load_system_proxy(session); } else { session->http_proxy_type = seafile_session_config_get_string(session, KEY_PROXY_TYPE); session->http_proxy_addr = seafile_session_config_get_string(session, KEY_PROXY_ADDR); session->http_proxy_port = seafile_session_config_get_int(session, KEY_PROXY_PORT, NULL); session->http_proxy_username = seafile_session_config_get_string(session, KEY_PROXY_USERNAME); session->http_proxy_password = seafile_session_config_get_string(session, KEY_PROXY_PASSWORD); } /* Start mq manager earlier, so that we can send notifications * when start repo manager. */ seaf_mq_manager_init (session->mq_mgr); seaf_commit_manager_init (session->commit_mgr); seaf_fs_manager_init (session->fs_mgr); seaf_branch_manager_init (session->branch_mgr); seaf_filelock_manager_init (session->filelock_mgr); seaf_repo_manager_init (session->repo_mgr); seaf_clone_manager_init (session->clone_mgr); #ifndef SEAF_TOOL seaf_sync_manager_init (session->sync_mgr); #endif seaf_mq_manager_set_heartbeat_name (session->mq_mgr, "seafile.heartbeat"); }
/* Check the notify setting by user. */ static gboolean need_notify_sync (SeafRepo *repo) { char *notify_setting = seafile_session_config_get_string(seaf, "notify_sync"); gboolean result = (g_strcmp0(notify_setting, "on") == 0); g_free (notify_setting); return result; }
static void load_monitor_id (SeafileSession *session) { char *monitor_id; monitor_id = seafile_session_config_get_string (session, KEY_MONITOR_ID); if (monitor_id) { session->monitor_id = monitor_id; } else { /* Set monitor to myself if not set by user. */ session->monitor_id = g_strdup(session->session->base.id); } }
gboolean seafile_session_config_get_allow_repo_not_found_on_server(SeafileSession *session) { return g_strcmp0(seafile_session_config_get_string(session, \ KEY_ALLOW_REPO_NOT_FOUND_ON_SERVER), "true") == 0; }
gboolean seafile_session_config_get_allow_invalid_worktree(SeafileSession *session) { return g_strcmp0(seafile_session_config_get_string(session, \ KEY_ALLOW_INVALID_WORKTREE), "true") == 0; }