summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorTimo Sirainen <cras@irssi.org>2002-12-28 17:54:13 +0000
committercras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564>2002-12-28 17:54:13 +0000
commitbd6fe052bce57849a7a850c0c5bee0ad896b9460 (patch)
tree95f3cb743874913a6dc1ff1314264b88989a4b60 /src/core
parent9c18cb00e7d096e46f5853f802724da4c59c2857 (diff)
downloadirssi-bd6fe052bce57849a7a850c0c5bee0ad896b9460.zip
Added time, size and level setting types. Breaks some settings - I'll add
automatic converter to these settings later. Meanwhile you CVS users can fix your config files yourself :) Time settings allow using "days", "hours", "minutes", "seconds" and "milliseconds" or several of their abbreviations. For example "5d 4h 5msecs". Size settings allow using "gbytes", "mbytes", "kbytes" and "bytes" or their abbrevations. For example "5MB". Level settings are currently handled pretty much the way they were before. git-svn-id: http://svn.irssi.org/repos/irssi/trunk@3080 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'src/core')
-rw-r--r--src/core/commands.h3
-rw-r--r--src/core/log-away.c11
-rw-r--r--src/core/misc.c114
-rw-r--r--src/core/misc.h4
-rw-r--r--src/core/servers-reconnect.c8
-rw-r--r--src/core/settings.c264
-rw-r--r--src/core/settings.h44
-rw-r--r--src/core/write-buffer.c15
8 files changed, 360 insertions, 103 deletions
diff --git a/src/core/commands.h b/src/core/commands.h
index 0b599f54..bdc8755d 100644
--- a/src/core/commands.h
+++ b/src/core/commands.h
@@ -37,7 +37,8 @@ enum {
CMDERR_CHAN_NOT_FOUND, /* channel not found */
CMDERR_CHAN_NOT_SYNCED, /* channel not fully synchronized yet */
CMDERR_ILLEGAL_PROTO, /* requires different chat protocol than the active server */
- CMDERR_NOT_GOOD_IDEA /* not good idea to do, -yes overrides this */
+ CMDERR_NOT_GOOD_IDEA, /* not good idea to do, -yes overrides this */
+ CMDERR_INVALID_TIME /* invalid time specification */
};
/* Return the full command for `alias' */
diff --git a/src/core/log-away.c b/src/core/log-away.c
index 724e4b4a..586d17d4 100644
--- a/src/core/log-away.c
+++ b/src/core/log-away.c
@@ -38,16 +38,13 @@ static void sig_log_written(LOG_REC *log)
static void awaylog_open(void)
{
- const char *fname, *levelstr;
+ const char *fname;
LOG_REC *log;
int level;
fname = settings_get_str("awaylog_file");
- levelstr = settings_get_str("awaylog_level");
- if (*fname == '\0' || *levelstr == '\0') return;
-
- level = level2bits(levelstr);
- if (level == 0) return;
+ level = settings_get_level("awaylog_level");
+ if (*fname == '\0' || level == 0) return;
log = log_find(fname);
if (log != NULL && log->handle != -1)
@@ -106,7 +103,7 @@ void log_away_init(void)
away_msgs = 0;
settings_add_str("log", "awaylog_file", IRSSI_DIR_SHORT"/away.log");
- settings_add_str("log", "awaylog_level", "msgs hilight");
+ settings_add_level("log", "awaylog_level", "msgs hilight");
signal_add("log written", (SIGNAL_FUNC) sig_log_written);
signal_add("away mode changed", (SIGNAL_FUNC) sig_away_changed);
diff --git a/src/core/misc.c b/src/core/misc.c
index 89f564d3..46720d62 100644
--- a/src/core/misc.c
+++ b/src/core/misc.c
@@ -816,3 +816,117 @@ int nearest_power(int num)
while (n < num) n <<= 1;
return n;
}
+
+int parse_time_interval(const char *time, int *msecs)
+{
+ const char *desc;
+ int number, len;
+
+ *msecs = 0;
+
+ /* max. return value is about 1.6 years */
+ number = 0;
+ for (;;) {
+ if (i_isdigit(*time)) {
+ number = number*10 + (*time - '0');
+ time++;
+ continue;
+ }
+
+ /* skip punctuation */
+ while (*time != '\0' && i_ispunct(*time))
+ time++;
+
+ /* get description */
+ for (len = 0, desc = time; i_isalpha(*time); time++)
+ len++;
+
+ if (len == 0) {
+ if (number == 0) {
+ /* "0" - allow it */
+ return TRUE;
+ }
+
+ *msecs += number; /* assume seconds */
+ return FALSE;
+ }
+
+ if (g_strncasecmp(desc, "weeks", len) == 0)
+ *msecs += number * 1000*3600*7;
+ if (g_strncasecmp(desc, "days", len) == 0)
+ *msecs += number * 1000*3600;
+ else if (g_strncasecmp(desc, "minutes", len) == 0 ||
+ g_strncasecmp(desc, "mins", len) == 0)
+ *msecs += number * 1000*60;
+ else if (g_strncasecmp(desc, "seconds", len) == 0 ||
+ g_strncasecmp(desc, "secs", len) == 0)
+ *msecs += number * 1000;
+ else if (g_strncasecmp(desc, "milliseconds", len) == 0 ||
+ g_strncasecmp(desc, "millisecs", len) == 0 ||
+ g_strncasecmp(desc, "mseconds", len) == 0 ||
+ g_strncasecmp(desc, "msecs", len) == 0)
+ *msecs += number;
+
+ /* skip punctuation */
+ while (*time != '\0' && i_ispunct(*time))
+ time++;
+
+ if (*time == '\0')
+ break;
+
+ number = 0;
+ }
+
+ return TRUE;
+}
+
+int parse_size(const char *size, int *bytes)
+{
+ const char *desc;
+ int number, len;
+
+ *bytes = 0;
+
+ /* max. return value is about 1.6 years */
+ number = 0;
+ while (*size != '\0') {
+ if (i_isdigit(*size)) {
+ number = number*10 + (*size - '0');
+ size++;
+ continue;
+ }
+
+ /* skip punctuation */
+ while (*size != '\0' && i_ispunct(*size))
+ size++;
+
+ /* get description */
+ for (len = 0, desc = size; i_isalpha(*size); size++)
+ len++;
+
+ if (len == 0) {
+ if (number == 0) {
+ /* "0" - allow it */
+ return TRUE;
+ }
+
+ *bytes += number*1024; /* assume kilobytes */
+ return FALSE;
+ }
+
+ if (g_strncasecmp(desc, "gbytes", len) == 0)
+ *bytes += number * 1024*1024*1024;
+ if (g_strncasecmp(desc, "mbytes", len) == 0)
+ *bytes += number * 1024*1024;
+ if (g_strncasecmp(desc, "kbytes", len) == 0)
+ *bytes += number * 1024;
+ if (g_strncasecmp(desc, "bytes", len) == 0)
+ *bytes += number;
+
+ /* skip punctuation */
+ while (*size != '\0' && i_ispunct(*size))
+ size++;
+ }
+
+ return TRUE;
+}
diff --git a/src/core/misc.h b/src/core/misc.h
index 46f91bb8..7eee01a2 100644
--- a/src/core/misc.h
+++ b/src/core/misc.h
@@ -105,4 +105,8 @@ char *escape_string(const char *str);
int nearest_power(int num);
+/* Returns TRUE / FALSE */
+int parse_time_interval(const char *time, int *msecs);
+int parse_size(const char *size, int *bytes);
+
#endif
diff --git a/src/core/servers-reconnect.c b/src/core/servers-reconnect.c
index c7b5dd45..beeddc94 100644
--- a/src/core/servers-reconnect.c
+++ b/src/core/servers-reconnect.c
@@ -461,14 +461,14 @@ static void sig_chat_protocol_deinit(CHAT_PROTOCOL_REC *proto)
static void read_settings(void)
{
- reconnect_time = settings_get_int("server_reconnect_time");
- connect_timeout = settings_get_int("server_connect_timeout");
+ reconnect_time = settings_get_time("server_reconnect_time")/1000;
+ connect_timeout = settings_get_time("server_connect_timeout")/1000;
}
void servers_reconnect_init(void)
{
- settings_add_int("server", "server_reconnect_time", 300);
- settings_add_int("server", "server_connect_timeout", 300);
+ settings_add_time("server", "server_reconnect_time", "5min");
+ settings_add_time("server", "server_connect_timeout", "5min");
reconnects = NULL;
last_reconnect_tag = 0;
diff --git a/src/core/settings.c b/src/core/settings.c
index d99757e0..c93a11d6 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 "levels.h"
#include "misc.h"
#include "lib-config/iconfig.h"
@@ -29,6 +30,8 @@
#include <signal.h>
+#define SETTINGS_AUTOSAVE_TIMEOUT (1000*60*60) /* 1 hour */
+
CONFIG_REC *mainconfig;
static GString *last_errors;
@@ -60,83 +63,107 @@ static SETTINGS_REC *settings_find(const char *key)
return rec;
}
-const char *settings_get_str(const char *key)
+static SETTINGS_REC *settings_get(const char *key, SettingType type)
{
SETTINGS_REC *rec;
- CONFIG_NODE *setnode, *node;
rec = settings_find(key);
- g_return_val_if_fail(rec != NULL, NULL);
+ if (rec == NULL) {
+ g_warning("settings_get(%s) : not found", key);
+ return 0;
+ }
+ if (type != -1 && rec->type != type) {
+ g_warning("settings_get(%s) : invalid type", key);
+ return 0;
+ }
+
+ return rec;
+}
+
+static const char *
+settings_get_str_type(const char *key, SettingType type)
+{
+ SETTINGS_REC *rec;
+ CONFIG_NODE *node;
- setnode = iconfig_node_traverse("settings", FALSE);
- if (setnode == NULL)
- return rec->def;
+ rec = settings_get(key, type);
+ if (rec == NULL) return NULL;
- node = config_node_section(setnode, rec->module, -1);
- return node == NULL ? rec->def :
- config_node_get_str(node, key, rec->def);
+ node = iconfig_node_traverse("settings", FALSE);
+ node = node == NULL ? NULL : config_node_section(node, rec->module, -1);
+
+ return node == NULL ? rec->default_value.v_string :
+ config_node_get_str(node, key, rec->default_value.v_string);
+}
+
+const char *settings_get_str(const char *key)
+{
+ return settings_get_str_type(key, -1);
}
int settings_get_int(const char *key)
{
SETTINGS_REC *rec;
- CONFIG_NODE *setnode, *node;
- int def;
+ CONFIG_NODE *node;
- rec = settings_find(key);
- g_return_val_if_fail(rec != NULL, 0);
- def = GPOINTER_TO_INT(rec->def);
+ rec = settings_get(key, SETTING_TYPE_INT);
+ if (rec == NULL) return 0;
- setnode = iconfig_node_traverse("settings", FALSE);
- if (setnode == NULL)
- return def;
+ node = iconfig_node_traverse("settings", FALSE);
+ node = node == NULL ? NULL : config_node_section(node, rec->module, -1);
- node = config_node_section(setnode, rec->module, -1);
- return node == NULL ? def :
- config_node_get_int(node, key, def);
+ return node == NULL ? rec->default_value.v_int :
+ config_node_get_int(node, key, rec->default_value.v_int);
}
int settings_get_bool(const char *key)
{
SETTINGS_REC *rec;
- CONFIG_NODE *setnode, *node;
- int def;
+ CONFIG_NODE *node;
- rec = settings_find(key);
- g_return_val_if_fail(rec != NULL, 0);
- def = GPOINTER_TO_INT(rec->def);
+ rec = settings_get(key, SETTING_TYPE_BOOLEAN);
+ if (rec == NULL) return FALSE;
- setnode = iconfig_node_traverse("settings", FALSE);
- if (setnode == NULL)
- return def;
+ node = iconfig_node_traverse("settings", FALSE);
+ node = node == NULL ? NULL : config_node_section(node, rec->module, -1);
- node = config_node_section(setnode, rec->module, -1);
- return node == NULL ? def :
- config_node_get_bool(node, key, def);
+ return node == NULL ? rec->default_value.v_bool :
+ config_node_get_bool(node, key, rec->default_value.v_bool);
}
-void settings_add_str_module(const char *module, const char *section,
- const char *key, const char *def)
+int settings_get_time(const char *key)
{
- SETTINGS_REC *rec;
+ const char *str;
+ int msecs;
- g_return_if_fail(key != NULL);
- g_return_if_fail(section != NULL);
+ str = settings_get_str_type(key, SETTING_TYPE_TIME);
+ if (str != NULL && !parse_time_interval(str, &msecs))
+ g_warning("settings_get_size(%s) : Invalid time '%s'", key, str);
+ return str == NULL ? 0 : msecs;
+}
- rec = g_hash_table_lookup(settings, key);
- g_return_if_fail(rec == NULL);
+int settings_get_level(const char *key)
+{
+ const char *str;
+
+ str = settings_get_str_type(key, SETTING_TYPE_LEVEL);
+ return str == NULL ? 0 : level2bits(str);
+}
- rec = g_new0(SETTINGS_REC, 1);
- rec->module = g_strdup(module);
- rec->key = g_strdup(key);
- rec->section = g_strdup(section);
- rec->def = def == NULL ? NULL : g_strdup(def);
+int settings_get_size(const char *key)
+{
+ const char *str;
+ int bytes;
- g_hash_table_insert(settings, rec->key, rec);
+ str = settings_get_str_type(key, SETTING_TYPE_SIZE);
+ if (str != NULL && !parse_size(str, &bytes))
+ g_warning("settings_get_size(%s) : Invalid size '%s'", key, str);
+ return str == NULL ? 0 : bytes;
}
-void settings_add_int_module(const char *module, const char *section,
- const char *key, int def)
+static void settings_add(const char *module, const char *section,
+ const char *key, SettingType type,
+ SettingValue *default_value)
{
SETTINGS_REC *rec;
@@ -144,49 +171,106 @@ void settings_add_int_module(const char *module, const char *section,
g_return_if_fail(section != NULL);
rec = g_hash_table_lookup(settings, key);
- g_return_if_fail(rec == NULL);
+ if (rec != NULL) {
+ /* Already exists, make sure it's correct type */
+ if (rec->type != type) {
+ g_warning("Trying to add already existing "
+ "setting '%s' with different type.", key);
+ return;
+ }
+ } else {
+ rec = g_new(SETTINGS_REC, 1);
+ rec->module = g_strdup(module);
+ rec->key = g_strdup(key);
+ rec->section = g_strdup(section);
+ rec->type = type;
+
+ rec->default_value = *default_value;
+ if (type != SETTING_TYPE_INT &&
+ type != SETTING_TYPE_BOOLEAN) {
+ rec->default_value.v_string =
+ g_strdup(default_value->v_string);
+ }
- rec = g_new0(SETTINGS_REC, 1);
- rec->module = g_strdup(module);
- rec->type = SETTING_TYPE_INT;
- rec->key = g_strdup(key);
- rec->section = g_strdup(section);
- rec->def = GINT_TO_POINTER(def);
+ g_hash_table_insert(settings, rec->key, rec);
+ }
- g_hash_table_insert(settings, rec->key, rec);
+ rec->refcount++;
+}
+
+void settings_add_str_module(const char *module, const char *section,
+ const char *key, const char *def)
+{
+ SettingValue default_value;
+
+ default_value.v_string = (char *) def;
+ settings_add(module, section, key, SETTING_TYPE_STRING, &default_value);
+}
+
+void settings_add_int_module(const char *module, const char *section,
+ const char *key, int def)
+{
+ SettingValue default_value;
+
+ default_value.v_int = def;
+ settings_add(module, section, key, SETTING_TYPE_INT, &default_value);
}
void settings_add_bool_module(const char *module, const char *section,
const char *key, int def)
{
- SETTINGS_REC *rec;
+ SettingValue default_value;
- g_return_if_fail(key != NULL);
- g_return_if_fail(section != NULL);
+ default_value.v_bool = def;
+ settings_add(module, section, key, SETTING_TYPE_BOOLEAN,
+ &default_value);
+}
- rec = g_hash_table_lookup(settings, key);
- g_return_if_fail(rec == NULL);
+void settings_add_time_module(const char *module, const char *section,
+ const char *key, const char *def)
+{
+ SettingValue default_value;
- rec = g_new0(SETTINGS_REC, 1);
- rec->module = g_strdup(module);
- rec->type = SETTING_TYPE_BOOLEAN;
- rec->key = g_strdup(key);
- rec->section = g_strdup(section);
- rec->def = GINT_TO_POINTER(def);
+ default_value.v_string = (char *) def;
+ settings_add(module, section, key, SETTING_TYPE_TIME, &default_value);
+}
- g_hash_table_insert(settings, rec->key, rec);
+void settings_add_level_module(const char *module, const char *section,
+ const char *key, const char *def)
+{
+ SettingValue default_value;
+
+ default_value.v_string = (char *) def;
+ settings_add(module, section, key, SETTING_TYPE_LEVEL, &default_value);
+}
+
+void settings_add_size_module(const char *module, const char *section,
+ const char *key, const char *def)
+{
+ SettingValue default_value;
+
+ default_value.v_string = (char *) def;
+ settings_add(module, section, key, SETTING_TYPE_SIZE, &default_value);
}
static void settings_destroy(SETTINGS_REC *rec)
{
if (rec->type == SETTING_TYPE_STRING)
- g_free_not_null(rec->def);
+ g_free(rec->default_value.v_string);
g_free(rec->module);
g_free(rec->section);
g_free(rec->key);
g_free(rec);
}
+static void settings_unref(SETTINGS_REC *rec)
+{
+ if (--rec->refcount == 0) {
+ g_hash_table_remove(settings, rec->key);
+ settings_destroy(rec);
+ }
+}
+
void settings_remove(const char *key)
{
SETTINGS_REC *rec;
@@ -194,17 +278,15 @@ void settings_remove(const char *key)
g_return_if_fail(key != NULL);
rec = g_hash_table_lookup(settings, key);
- if (rec == NULL) return;
-
- g_hash_table_remove(settings, key);
- settings_destroy(rec);
+ if (rec != NULL)
+ settings_unref(rec);
}
static int settings_remove_hash(const char *key, SETTINGS_REC *rec,
const char *module)
{
if (strcmp(rec->module, module) == 0) {
- settings_destroy(rec);
+ settings_unref(rec);
return TRUE;
}
@@ -226,7 +308,10 @@ static CONFIG_NODE *settings_get_node(const char *key)
g_return_val_if_fail(key != NULL, NULL);
rec = g_hash_table_lookup(settings, key);
- g_return_val_if_fail(rec != NULL, NULL);
+ if (rec == NULL) {
+ g_warning("Changing unknown setting '%s'", key);
+ return NULL;
+ }
node = iconfig_node_traverse("settings", TRUE);
return config_node_section(node, rec->module, NODE_TYPE_BLOCK);
@@ -247,7 +332,35 @@ void settings_set_bool(const char *key, int value)
iconfig_node_set_bool(settings_get_node(key), key, value);
}
-int settings_get_type(const char *key)
+int settings_set_time(const char *key, const char *value)
+{
+ int msecs;
+
+ if (!parse_time_interval(value, &msecs))
+ return FALSE;
+
+ iconfig_node_set_str(settings_get_node(key), key, value);
+ return TRUE;
+}
+
+int settings_set_level(const char *key, const char *value)
+{
+ iconfig_node_set_str(settings_get_node(key), key, value);
+ return TRUE;
+}
+
+int settings_set_size(const char *key, const char *value)
+{
+ int size;
+
+ if (!parse_size(value, &size))
+ return FALSE;
+
+ iconfig_node_set_str(settings_get_node(key), key, value);
+ return TRUE;
+}
+
+SettingType settings_get_type(const char *key)
{
SETTINGS_REC *rec;
@@ -621,7 +734,8 @@ void settings_init(void)
init_configfile();
settings_add_bool("misc", "settings_autosave", TRUE);
- timeout_tag = g_timeout_add(1000*60*60, (GSourceFunc) sig_autosave, NULL);
+ timeout_tag = g_timeout_add(SETTINGS_AUTOSAVE_TIMEOUT,
+ (GSourceFunc) sig_autosave, NULL);
signal_add("irssi init finished", (SIGNAL_FUNC) sig_init_finished);
signal_add("gui exit", (SIGNAL_FUNC) sig_autosave);
}
diff --git a/src/core/settings.h b/src/core/settings.h
index fdff3801..df4a95ab 100644
--- a/src/core/settings.h
+++ b/src/core/settings.h
@@ -1,18 +1,30 @@
#ifndef __SETTINGS_H
#define __SETTINGS_H
-enum {
+typedef enum {
SETTING_TYPE_STRING,
SETTING_TYPE_INT,
- SETTING_TYPE_BOOLEAN
-};
+ SETTING_TYPE_BOOLEAN,
+ SETTING_TYPE_TIME,
+ SETTING_TYPE_LEVEL,
+ SETTING_TYPE_SIZE
+} SettingType;
+
+typedef union {
+ char *v_string;
+ int v_int;
+ unsigned int v_bool:1;
+} SettingValue;
typedef struct {
- char *module;
- int type;
+ int refcount;
+
+ char *module;
char *key;
char *section;
- void *def;
+
+ SettingType type;
+ SettingValue default_value;
} SETTINGS_REC;
/* macros for handling the default Irssi configuration */
@@ -40,6 +52,9 @@ extern const char *default_config;
const char *settings_get_str(const char *key);
int settings_get_int(const char *key);
int settings_get_bool(const char *key);
+int settings_get_time(const char *key); /* as milliseconds */
+int settings_get_level(const char *key);
+int settings_get_size(const char *key); /* as bytes */
/* Functions to add/remove settings */
void settings_add_str_module(const char *module, const char *section,
@@ -48,6 +63,12 @@ void settings_add_int_module(const char *module, const char *section,
const char *key, int def);
void settings_add_bool_module(const char *module, const char *section,
const char *key, int def);
+void settings_add_time_module(const char *module, const char *section,
+ const char *key, const char *def);
+void settings_add_level_module(const char *module, const char *section,
+ const char *key, const char *def);
+void settings_add_size_module(const char *module, const char *section,
+ const char *key, const char *def);
void settings_remove(const char *key);
void settings_remove_module(const char *module);
@@ -57,13 +78,22 @@ void settings_remove_module(const char *module);
settings_add_int_module(MODULE_NAME, section, key, def)
#define settings_add_bool(section, key, def) \
settings_add_bool_module(MODULE_NAME, section, key, def)
+#define settings_add_time(section, key, def) \
+ settings_add_time_module(MODULE_NAME, section, key, def)
+#define settings_add_level(section, key, def) \
+ settings_add_level_module(MODULE_NAME, section, key, def)
+#define settings_add_size(section, key, def) \
+ settings_add_size_module(MODULE_NAME, section, key, def)
void settings_set_str(const char *key, const char *value);
void settings_set_int(const char *key, int value);
void settings_set_bool(const char *key, int value);
+int settings_set_time(const char *key, const char *value);
+int settings_set_level(const char *key, const char *value);
+int settings_set_size(const char *key, const char *value);
/* Get the type (SETTING_TYPE_xxx) of `key' */
-int settings_get_type(const char *key);
+SettingType settings_get_type(const char *key);
/* Get all settings sorted by section. Free the result with g_slist_free() */
GSList *settings_get_sorted(void);
/* Get the record of the setting */
diff --git a/src/core/write-buffer.c b/src/core/write-buffer.c
index 1c3eef82..eec306ae 100644
--- a/src/core/write-buffer.c
+++ b/src/core/write-buffer.c
@@ -134,17 +134,14 @@ static int flush_timeout(void)
static void read_settings(void)
{
- int msecs;
-
write_buffer_flush();
- write_buffer_max_blocks = settings_get_int("write_buffer_kb") *
- 1024/BUFFER_BLOCK_SIZE;
+ write_buffer_max_blocks =
+ settings_get_size("write_buffer_size") / BUFFER_BLOCK_SIZE;
- if (settings_get_int("write_buffer_mins") > 0) {
- msecs = settings_get_int("write_buffer_mins")*60*1000;
+ if (settings_get_time("write_buffer_timeout") > 0) {
if (timeout_tag == -1) {
- timeout_tag = g_timeout_add(msecs,
+ timeout_tag = g_timeout_add(settings_get_time("write_buffer_timeout"),
(GSourceFunc) flush_timeout,
NULL);
}
@@ -161,8 +158,8 @@ static void cmd_flushbuffer(void)
void write_buffer_init(void)
{
- settings_add_int("misc", "write_buffer_mins", 0);
- settings_add_int("misc", "write_buffer_kb", 0);
+ settings_add_time("misc", "write_buffer_timeout", "0");
+ settings_add_size("misc", "write_buffer_size", "0");
buffers = g_hash_table_new((GHashFunc) g_direct_hash,
(GCompareFunc) g_direct_equal);