/** * infinoted_startup_free: * @startup: A #InfinotedStartup. * * Frees all ressources allocated by @startup. */ void infinoted_startup_free(InfinotedStartup* startup) { guint i; if(startup->credentials != NULL) inf_certificate_credentials_unref(startup->credentials); if(startup->certificates != NULL) inf_certificate_chain_unref(startup->certificates); if(startup->private_key != NULL) gnutls_x509_privkey_deinit(startup->private_key); if(startup->log != NULL) g_object_unref(startup->log); if(startup->options != NULL) infinoted_options_free(startup->options); if(startup->sasl_context != NULL) inf_sasl_context_unref(startup->sasl_context); g_slice_free(InfinotedStartup, startup); inf_deinit(); }
/** * infinoted_options_new: * @config_files: A %NULL-terminated error of config filenames. * @argc: Pointer to command line argument count, or %NULL. * @argv: Pointer to command line argument vector, or %NULL. * @error: Location to store error information, if any. * * Creates a new #InfinotedOptions structure that contains options infinoted * is supposed to start with. Command line options always overwrite config * file options. * * The config files are loaded in order, which means that config files at the * back of the array overwrite options of config files in front of the array. * Config files are not required to exist. If a given config file does not * exist, it is simply ignored. * * Returns: A new #InfinotedOptions, or %NULL in case of error. * Free with infinoted_options_free(). */ InfinotedOptions* infinoted_options_new(const gchar* const* config_files, int* argc, char*** argv, GError** error) { InfinotedOptions* options; options = g_slice_new(InfinotedOptions); /* Default options */ options->key_file = NULL; options->certificate_file = NULL; options->certificate_chain_file = NULL; options->create_key = FALSE; options->create_certificate = FALSE; options->port = inf_protocol_get_default_port(); options->security_policy = INF_XMPP_CONNECTION_SECURITY_BOTH_PREFER_TLS; options->root_directory = g_build_filename(g_get_home_dir(), ".infinote", NULL); options->autosave_interval = 0; options->password = NULL; #ifdef LIBINFINITY_HAVE_PAM options->pam_service = NULL; options->pam_allowed_users = NULL; options->pam_allowed_groups = NULL; #endif /* LIBINFINITY_HAVE_PAM */ options->sync_directory = NULL; options->sync_interval = 0; #ifdef LIBINFINITY_HAVE_LIBDAEMON options->daemonize = FALSE; #endif if(!infinoted_options_load(options, config_files, argc, argv, error)) { infinoted_options_free(options); return NULL; } return options; }