static int proxy_close(int why) { void *config_root; config_root = config_get_root("eggdrop"); config_unlink_table(proxy_config_vars, config_root, "proxy", 0, NULL); return(0); }
static int dccparty_close(int why) { void *config_root; config_root = config_get_root("eggdrop"); config_unlink_table(dcc_config_vars, config_root, "dccparty", 0, NULL); return(0); }
static int ircparty_close(int why) { void *config_root; config_root = config_get_root("eggdrop"); config_unlink_table(irc_config_vars, config_root, "ircparty", 0, NULL); sockbuf_delete(irc_idx); return(0); }
int config_save(const char *handle, const char *fname) { void *root; root = config_get_root(handle); if (root) bind_check(BT_config_save, NULL, handle, handle); if (!fname) fname = "config.xml"; if (xml_save_file(fname, root, XML_INDENT) == 0) return (0); putlog(LOG_MISC, "*", _("Failed to save config '%s': %s"), fname, xml_last_error()); return (-1); }
static int proxy_init() { void *config_root; memset(&proxy_config, 0, sizeof(proxy_config)); config_root = config_get_root("eggdrop"); config_link_table(proxy_config_vars, config_root, "proxy", 0, NULL); egg_proxy_add(&http_proxy_handler); egg_proxy_add(&socks5_proxy_handler); if (proxy_config.type) egg_proxy_set_default(proxy_config.type); bind_add_simple("config_str", NULL, "proxy.type", on_proxy_set); return(0); }
void logfile_shutdown(void) { void *root, *node; int i; flushlogs(); root = config_get_root("eggdrop"); node = config_lookup_section(root, "eggdrop.logging.logfiles", 0, NULL); for (i = 0; i < nlogfiles; i++) { config_set_str(logfiles[i].filename, node, "logfile", i, "filename", 0, NULL); config_set_str(logfiles[i].chname, node, "logfile", i, "channel", 0, NULL); config_set_str("*", node, "logfile", i, "mask", 0, NULL); } bind_rem_simple("log", NULL, NULL, on_putlog); bind_rem_simple("event", NULL, "minutely", logfile_minutely); bind_rem_simple("event", NULL, "5minutely", logfile_5minutely); script_delete_commands(log_script_cmds); }
static gboolean _gui_check_account_initialization(Config *config) { Section *root; Section *section; Value *value; gboolean result = FALSE; root = config_get_root(config); if((section = section_find_first_child(root, "Global"))) { if((value = section_find_first_value(section, "first-account-initialized")) && VALUE_IS_BOOLEAN(value)) { result = value_get_bool(value); } } return result; }
void logfile_init(void) { void *root, *node; char *filename, *chname, *mask; int i; script_create_commands(log_script_cmds); bind_add_simple("log", NULL, NULL, on_putlog); bind_add_simple("event", NULL, "minutely", logfile_minutely); bind_add_simple("event", NULL, "5minutely", logfile_5minutely); root = config_get_root("eggdrop"); node = config_lookup_section(root, "eggdrop.logging.logfiles", 0, NULL); for (i = 0; ; i++) { config_get_str(&filename, node, "logfile", i, "filename", 0, NULL); config_get_str(&chname, node, "logfile", i, "channel", 0, NULL); config_get_str(&mask, node, "logfile", i, "mask", 0, NULL); if (!filename || !chname || !mask) break; logfile_add(mask, chname, filename); } }
static void _gui_enable_account_initialization(Config *config) { Section *root; Section *section; Value *value; root = config_get_root(config); if(!(section = section_find_first_child(root, "Global"))) { section = section_append_child(root, "Global"); } if(!(value = section_find_first_value(section, "first-account-initialized"))) { value = section_append_value(section, "first-account-initialization", VALUE_DATATYPE_BOOLEAN); } value_set_bool(value, TRUE); }
int ircparty_LTX_start(egg_module_t *modinfo) { void *config_root; irc_generic_owner.module = irc_sock_owner.module = irc_pm_owner.module = modinfo; modinfo->name = "ircparty"; modinfo->author = "eggdev"; modinfo->version = "1.0.0"; modinfo->description = "irc client support for the partyline"; modinfo->close_func = ircparty_close; /* Set defaults. */ memset(&irc_config, 0, sizeof(irc_config)); /* Link our vars in. */ config_root = config_get_root("eggdrop"); config_link_table(irc_config_vars, config_root, "ircparty", 0, NULL); config_update_table(irc_config_vars, config_root, "ircparty", 0, NULL); irc_init(); return(0); }
/* * helpers: */ static gboolean _gui_get_first_account(Config *config, gchar **username, gchar **key, gchar **secret) { Section *section; Section *child; Value *value; gint count; gint result = 0; gboolean success = FALSE; g_debug("Getting account data from configuration..."); *username = NULL; *key = NULL; *secret = NULL; /* get root section from configuration */ section = config_get_root(config); /* find "Accounts" section */ if((section = section_find_first_child(section, "Twitter")) && (section = section_find_first_child(section, "Accounts"))) { count = section_n_children(section); /* set account data */ for(gint i = 0; i < count && !success; ++i) { child = section_nth_child(section, i); if(!g_ascii_strcasecmp(section_get_name(child), "Account")) { ++result; if((value = section_find_first_value(child, "username")) && VALUE_IS_STRING(value)) { *username = g_strdup(value_get_string(value)); g_debug("Found username: \"%s\"", *username); } if((value = section_find_first_value(child, "oauth_access_key")) && VALUE_IS_STRING(value)) { *key = g_strdup(value_get_string(value)); g_debug("Found username: \"%s\"", *key); } if((value = section_find_first_value(child, "oauth_access_secret")) && VALUE_IS_STRING(value)) { *secret = g_strdup(value_get_string(value)); g_debug("Found username: \"%s\"", *secret); } } if(*username && *key && *secret) { success = TRUE; } } } if(!success) { g_free(*username); g_free(*key); g_free(*secret); } return success; }