diff options
author | Timo Sirainen <cras@irssi.org> | 2000-11-26 10:24:30 +0000 |
---|---|---|
committer | cras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564> | 2000-11-26 10:24:30 +0000 |
commit | 0d8239e40e504cb1a4cce5e8d48cc0c7898c6e31 (patch) | |
tree | b2ad2e439210d1a1e92a406c5e03853cd7b0de45 /src | |
parent | a392b41f2ff5f4d3417d28508ec1a8c8a013fce0 (diff) | |
download | irssi-0d8239e40e504cb1a4cce5e8d48cc0c7898c6e31.zip |
config changes, CONFIG_REC is now required parameter for
config_node_set_int/bool() and config_node_add_list()
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@886 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'src')
-rw-r--r-- | src/core/channels-setup.c | 2 | ||||
-rw-r--r-- | src/core/ignore.c | 8 | ||||
-rw-r--r-- | src/core/log.c | 2 | ||||
-rw-r--r-- | src/core/servers-setup.c | 4 | ||||
-rw-r--r-- | src/core/settings.h | 3 | ||||
-rw-r--r-- | src/fe-common/core/hilight-text.c | 12 | ||||
-rw-r--r-- | src/irc/bot/bot-users.c | 2 | ||||
-rw-r--r-- | src/irc/core/irc-chatnets.c | 12 | ||||
-rw-r--r-- | src/irc/core/irc-servers-setup.c | 4 | ||||
-rw-r--r-- | src/irc/notifylist/notify-setup.c | 6 | ||||
-rw-r--r-- | src/lib-config/iconfig.h | 6 | ||||
-rw-r--r-- | src/lib-config/set.c | 14 |
12 files changed, 39 insertions, 36 deletions
diff --git a/src/core/channels-setup.c b/src/core/channels-setup.c index b56ffb6e..5a445114 100644 --- a/src/core/channels-setup.c +++ b/src/core/channels-setup.c @@ -77,7 +77,7 @@ static void channel_setup_save(CHANNEL_SETUP_REC *channel) iconfig_node_set_str(node, "name", channel->name); iconfig_node_set_str(node, "chatnet", channel->chatnet); if (channel->autojoin) - config_node_set_bool(node, "autojoin", TRUE); + iconfig_node_set_bool(node, "autojoin", TRUE); iconfig_node_set_str(node, "password", channel->password); iconfig_node_set_str(node, "botmasks", channel->botmasks); iconfig_node_set_str(node, "autosendcmd", channel->autosendcmd); diff --git a/src/core/ignore.c b/src/core/ignore.c index 420e91c7..6d432a4c 100644 --- a/src/core/ignore.c +++ b/src/core/ignore.c @@ -220,13 +220,13 @@ static void ignore_set_config(IGNORE_REC *rec) g_free(levelstr); } iconfig_node_set_str(node, "pattern", rec->pattern); - if (rec->regexp) config_node_set_bool(node, "regexp", TRUE); - if (rec->fullword) config_node_set_bool(node, "fullword", TRUE); - if (rec->replies) config_node_set_bool(node, "replies", TRUE); + if (rec->regexp) iconfig_node_set_bool(node, "regexp", TRUE); + if (rec->fullword) iconfig_node_set_bool(node, "fullword", TRUE); + if (rec->replies) iconfig_node_set_bool(node, "replies", TRUE); if (rec->channels != NULL && *rec->channels != NULL) { node = config_node_section(node, "channels", NODE_TYPE_LIST); - config_node_add_list(node, rec->channels); + iconfig_node_add_list(node, rec->channels); } } diff --git a/src/core/log.c b/src/core/log.c index 112e46b6..c9598ba2 100644 --- a/src/core/log.c +++ b/src/core/log.c @@ -319,7 +319,7 @@ static void log_update_config(LOG_REC *log) node = config_node_section(node, log->fname, NODE_TYPE_BLOCK); if (log->autoopen) - config_node_set_bool(node, "auto_open", TRUE); + iconfig_node_set_bool(node, "auto_open", TRUE); else iconfig_node_set_str(node, "auto_open", NULL); diff --git a/src/core/servers-setup.c b/src/core/servers-setup.c index 6a53f183..8a657f8d 100644 --- a/src/core/servers-setup.c +++ b/src/core/servers-setup.c @@ -351,12 +351,12 @@ static void server_setup_save(SERVER_SETUP_REC *rec) iconfig_node_set_str(node, "address", rec->address); iconfig_node_set_str(node, "chatnet", rec->chatnet); - config_node_set_int(node, "port", rec->port); + iconfig_node_set_int(node, "port", rec->port); iconfig_node_set_str(node, "password", rec->password); iconfig_node_set_str(node, "own_host", rec->own_host); if (rec->autoconnect) - config_node_set_bool(node, "autoconnect", TRUE); + iconfig_node_set_bool(node, "autoconnect", TRUE); signal_emit("server setup saved", 2, rec, node); } diff --git a/src/core/settings.h b/src/core/settings.h index b399846d..e56daefc 100644 --- a/src/core/settings.h +++ b/src/core/settings.h @@ -30,9 +30,12 @@ typedef struct { #define iconfig_node_traverse(a, b) config_node_traverse(mainconfig, a, b) #define iconfig_node_set_str(a, b, c) config_node_set_str(mainconfig, a, b, c) +#define iconfig_node_set_int(a, b, c) config_node_set_int(mainconfig, a, b, c) +#define iconfig_node_set_bool(a, b, c) config_node_set_bool(mainconfig, a, b, c) #define iconfig_node_list_remove(a, b) config_node_list_remove(mainconfig, a, b) #define iconfig_node_remove(a, b) config_node_remove(mainconfig, a, b) #define iconfig_node_clear(a) config_node_clear(mainconfig, a) +#define iconfig_node_add_list(a, b) config_node_add_list(mainconfig, a, b) extern CONFIG_REC *mainconfig; diff --git a/src/fe-common/core/hilight-text.c b/src/fe-common/core/hilight-text.c index b74059d1..5af8d9cb 100644 --- a/src/fe-common/core/hilight-text.c +++ b/src/fe-common/core/hilight-text.c @@ -50,16 +50,16 @@ static void hilight_add_config(HILIGHT_REC *rec) node = config_node_section(node, NULL, NODE_TYPE_BLOCK); iconfig_node_set_str(node, "text", rec->text); - if (rec->level > 0) config_node_set_int(node, "level", rec->level); + if (rec->level > 0) iconfig_node_set_int(node, "level", rec->level); if (rec->color) iconfig_node_set_str(node, "color", rec->color); - if (rec->nick) config_node_set_bool(node, "nick", TRUE); - if (rec->nickmask) config_node_set_bool(node, "mask", TRUE); - if (rec->fullword) config_node_set_bool(node, "fullword", TRUE); - if (rec->regexp) config_node_set_bool(node, "regexp", TRUE); + if (rec->nick) iconfig_node_set_bool(node, "nick", TRUE); + if (rec->nickmask) iconfig_node_set_bool(node, "mask", TRUE); + if (rec->fullword) iconfig_node_set_bool(node, "fullword", TRUE); + if (rec->regexp) iconfig_node_set_bool(node, "regexp", TRUE); if (rec->channels != NULL && *rec->channels != NULL) { node = config_node_section(node, "channels", NODE_TYPE_LIST); - config_node_add_list(node, rec->channels); + iconfig_node_add_list(node, rec->channels); } } diff --git a/src/irc/bot/bot-users.c b/src/irc/bot/bot-users.c index 26354188..d8e9b9fc 100644 --- a/src/irc/bot/bot-users.c +++ b/src/irc/bot/bot-users.c @@ -112,7 +112,7 @@ static void botuser_config_save(USER_REC *user) g_free_not_null(str); config_node_set_str(userconfig, node, "password", user->password); - config_node_set_int(node, "last_modify", (int) user->last_modify); + iconfig_node_set_int(node, "last_modify", (int) user->last_modify); /* Save masks */ if (user->masks == NULL) diff --git a/src/irc/core/irc-chatnets.c b/src/irc/core/irc-chatnets.c index 0ccf121c..f5bcaf0f 100644 --- a/src/irc/core/irc-chatnets.c +++ b/src/irc/core/irc-chatnets.c @@ -59,18 +59,18 @@ static void ircnet_save(IRC_CHATNET_REC *rec) node = chatnet_save((CHATNET_REC *) rec, node); if (rec->max_cmds_at_once > 0) - config_node_set_int(node, "cmdmax", rec->max_cmds_at_once); + iconfig_node_set_int(node, "cmdmax", rec->max_cmds_at_once); if (rec->cmd_queue_speed > 0) - config_node_set_int(node, "cmdspeed", rec->cmd_queue_speed); + iconfig_node_set_int(node, "cmdspeed", rec->cmd_queue_speed); if (rec->max_kicks > 0) - config_node_set_int(node, "max_kicks", rec->max_kicks); + iconfig_node_set_int(node, "max_kicks", rec->max_kicks); if (rec->max_msgs > 0) - config_node_set_int(node, "max_msgs", rec->max_msgs); + iconfig_node_set_int(node, "max_msgs", rec->max_msgs); if (rec->max_modes > 0) - config_node_set_int(node, "max_modes", rec->max_modes); + iconfig_node_set_int(node, "max_modes", rec->max_modes); if (rec->max_whois > 0) - config_node_set_int(node, "max_whois", rec->max_whois); + iconfig_node_set_int(node, "max_whois", rec->max_whois); } static void ircnet_remove(IRC_CHATNET_REC *rec) diff --git a/src/irc/core/irc-servers-setup.c b/src/irc/core/irc-servers-setup.c index d23b051b..3bd98d5c 100644 --- a/src/irc/core/irc-servers-setup.c +++ b/src/irc/core/irc-servers-setup.c @@ -166,9 +166,9 @@ static void sig_server_setup_saved(IRC_SERVER_SETUP_REC *rec, return; if (rec->max_cmds_at_once > 0) - config_node_set_int(node, "cmds_max_at_once", rec->max_cmds_at_once); + iconfig_node_set_int(node, "cmds_max_at_once", rec->max_cmds_at_once); if (rec->cmd_queue_speed > 0) - config_node_set_int(node, "cmd_queue_speed", rec->cmd_queue_speed); + iconfig_node_set_int(node, "cmd_queue_speed", rec->cmd_queue_speed); } void irc_servers_setup_init(void) diff --git a/src/irc/notifylist/notify-setup.c b/src/irc/notifylist/notify-setup.c index aba7742a..e2a3195a 100644 --- a/src/irc/notifylist/notify-setup.c +++ b/src/irc/notifylist/notify-setup.c @@ -33,19 +33,19 @@ void notifylist_add_config(NOTIFYLIST_REC *rec) node = config_node_section(node, rec->mask, NODE_TYPE_BLOCK); if (rec->away_check) - config_node_set_bool(node, "away_check", TRUE); + iconfig_node_set_bool(node, "away_check", TRUE); else iconfig_node_set_str(node, "away_check", NULL); if (rec->idle_check_time > 0) - config_node_set_int(node, "idle_check_time", rec->idle_check_time/60); + iconfig_node_set_int(node, "idle_check_time", rec->idle_check_time/60); else iconfig_node_set_str(node, "idle_check_time", NULL); iconfig_node_set_str(node, "ircnets", NULL); if (rec->ircnets != NULL && *rec->ircnets != NULL) { node = config_node_section(node, "ircnets", NODE_TYPE_LIST); - config_node_add_list(node, rec->ircnets); + iconfig_node_add_list(node, rec->ircnets); } } diff --git a/src/lib-config/iconfig.h b/src/lib-config/iconfig.h index c00fdd0c..2718caa9 100644 --- a/src/lib-config/iconfig.h +++ b/src/lib-config/iconfig.h @@ -122,15 +122,15 @@ int config_node_get_keyvalue(CONFIG_NODE *node, const char *key, const char *val /* Return all values from from the list `node' in a g_strsplit() array */ char **config_node_get_list(CONFIG_NODE *node); /* Add all values in `array' to `node' */ -void config_node_add_list(CONFIG_NODE *node, char **array); +void config_node_add_list(CONFIG_REC *rec, CONFIG_NODE *node, char **array); char *config_node_get_str(CONFIG_NODE *parent, const char *key, const char *def); int config_node_get_int(CONFIG_NODE *parent, const char *key, int def); int config_node_get_bool(CONFIG_NODE *parent, const char *key, int def); void config_node_set_str(CONFIG_REC *rec, CONFIG_NODE *parent, const char *key, const char *value); -void config_node_set_int(CONFIG_NODE *parent, const char *key, int value); -void config_node_set_bool(CONFIG_NODE *parent, const char *key, int value); +void config_node_set_int(CONFIG_REC *rec, CONFIG_NODE *parent, const char *key, int value); +void config_node_set_bool(CONFIG_REC *rec, CONFIG_NODE *parent, const char *key, int value); /* Remove one node from block/list. ..set_str() with value = NULL does the same. */ diff --git a/src/lib-config/set.c b/src/lib-config/set.c index e0d3cf08..99b9583e 100644 --- a/src/lib-config/set.c +++ b/src/lib-config/set.c @@ -92,7 +92,7 @@ void config_node_set_str(CONFIG_REC *rec, CONFIG_NODE *parent, const char *key, CONFIG_NODE *node; int no_key; - g_return_if_fail(rec != NULL || value != NULL); + g_return_if_fail(rec != NULL); g_return_if_fail(parent != NULL); no_key = key == NULL; @@ -120,17 +120,17 @@ void config_node_set_str(CONFIG_REC *rec, CONFIG_NODE *parent, const char *key, rec->modifycounter++; } -void config_node_set_int(CONFIG_NODE *parent, const char *key, int value) +void config_node_set_int(CONFIG_REC *rec, CONFIG_NODE *parent, const char *key, int value) { char str[MAX_INT_STRLEN]; g_snprintf(str, sizeof(str), "%d", value); - config_node_set_str(NULL, parent, key, str); + config_node_set_str(rec, parent, key, str); } -void config_node_set_bool(CONFIG_NODE *parent, const char *key, int value) +void config_node_set_bool(CONFIG_REC *rec, CONFIG_NODE *parent, const char *key, int value) { - config_node_set_str(NULL, parent, key, value ? "yes" : "no"); + config_node_set_str(rec, parent, key, value ? "yes" : "no"); } int config_set_str(CONFIG_REC *rec, const char *section, const char *key, const char *value) @@ -160,10 +160,10 @@ int config_set_bool(CONFIG_REC *rec, const char *section, const char *key, int v } /* Add all values in `array' to `node' */ -void config_node_add_list(CONFIG_NODE *node, char **array) +void config_node_add_list(CONFIG_REC *rec, CONFIG_NODE *node, char **array) { char **tmp; for (tmp = array; *tmp != NULL; tmp++) - config_node_set_str(NULL, node, NULL, *tmp); + config_node_set_str(rec, node, NULL, *tmp); } |