diff options
author | Timo Sirainen <cras@irssi.org> | 2000-05-15 08:25:45 +0000 |
---|---|---|
committer | cras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564> | 2000-05-15 08:25:45 +0000 |
commit | cbdaf7d06d021a1072363f1a80ff73c7423c7bd8 (patch) | |
tree | 067c27c2823ed2825e7fb432b35318659e63e806 /src/core/settings.c | |
parent | 969cfe8abcdff1047696c22e13c79c1f4c239137 (diff) | |
download | irssi-cbdaf7d06d021a1072363f1a80ff73c7423c7bd8.zip |
Lots of changes again. Biggest ones:
- window's text buffer should work better
- themes are almost working, you can change the text formats with /format
- automatically try to rejoin the channel after 5 minutes if the join there
failed because it was "temporarily unavailable" (netsplits)
- generally cleaning code..
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@216 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'src/core/settings.c')
-rw-r--r-- | src/core/settings.c | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/src/core/settings.c b/src/core/settings.c index a7e27a63..5133dd6b 100644 --- a/src/core/settings.c +++ b/src/core/settings.c @@ -21,6 +21,7 @@ #include "module.h" #include "signals.h" #include "commands.h" +#include "misc.h" #include "lib-config/iconfig.h" #include "settings.h" @@ -278,15 +279,16 @@ static void init_configfile(void) signal(SIGTERM, sig_term); } -static void cmd_rehash(const char *data) +void settings_reread(const char *fname) { CONFIG_REC *tempconfig; - char *str, *fname; + char *str; - fname = *data != '\0' ? g_strdup(data) : - g_strdup_printf("%s/.irssi/config", g_get_home_dir()); - tempconfig = parse_configfile(fname); - g_free(fname); + if (fname == NULL) fname = "~/.irssi/config"; + + str = convert_home(fname); + tempconfig = parse_configfile(str); + g_free(str); if (tempconfig == NULL) { signal_emit("gui dialog", 2, "error", g_strerror(errno)); @@ -310,11 +312,11 @@ static void cmd_rehash(const char *data) signal_emit("setup reread", 0); } -static void cmd_save(const char *data) +void settings_save(const char *fname) { char *str; - if (config_write(mainconfig, *data == '\0' ? NULL : data, 0660) == 0) + if (config_write(mainconfig, fname, 0660) == 0) return; /* error */ @@ -329,8 +331,6 @@ void settings_init(void) settings = g_hash_table_new((GHashFunc) g_str_hash, (GCompareFunc) g_str_equal); init_configfile(); - command_bind("rehash", NULL, (SIGNAL_FUNC) cmd_rehash); - command_bind("save", NULL, (SIGNAL_FUNC) cmd_save); } static void settings_hash_free(const char *key, SETTINGS_REC *rec) @@ -340,9 +340,6 @@ static void settings_hash_free(const char *key, SETTINGS_REC *rec) void settings_deinit(void) { - command_unbind("rehash", (SIGNAL_FUNC) cmd_rehash); - command_unbind("save", (SIGNAL_FUNC) cmd_save); - g_free_not_null(last_error_msg); g_hash_table_foreach(settings, (GHFunc) settings_hash_free, NULL); g_hash_table_destroy(settings); |