mirror of
https://github.com/irssi/irssi.git
synced 2024-12-04 14:46:39 -05:00
Settings are now stored in module-specific blocks. Irssi complains
about all unknown settings that are found inside those blocks. Left backwards compatibility kludge which should be removed in 0.7.98. git-svn-id: http://svn.irssi.org/repos/irssi/trunk@1004 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
parent
78b3fb8d4a
commit
aac80846b8
@ -71,6 +71,7 @@ void core_init(void)
|
|||||||
nicklist_init();
|
nicklist_init();
|
||||||
|
|
||||||
chat_commands_init();
|
chat_commands_init();
|
||||||
|
settings_check();
|
||||||
}
|
}
|
||||||
|
|
||||||
void core_deinit(void)
|
void core_deinit(void)
|
||||||
|
@ -305,6 +305,7 @@ static int module_load_name(const char *path, const char *name)
|
|||||||
modules = g_slist_append(modules, rec);
|
modules = g_slist_append(modules, rec);
|
||||||
|
|
||||||
module_init();
|
module_init();
|
||||||
|
settings_check_module(name);
|
||||||
|
|
||||||
signal_emit("module loaded", 1, rec);
|
signal_emit("module loaded", 1, rec);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -31,8 +31,11 @@
|
|||||||
|
|
||||||
CONFIG_REC *mainconfig;
|
CONFIG_REC *mainconfig;
|
||||||
|
|
||||||
|
static GString *last_errors;
|
||||||
|
static char *last_config_error_msg;
|
||||||
|
static int fe_initialized;
|
||||||
|
|
||||||
static GHashTable *settings;
|
static GHashTable *settings;
|
||||||
static char *last_error_msg;
|
|
||||||
static int timeout_tag;
|
static int timeout_tag;
|
||||||
|
|
||||||
static int config_last_modifycounter;
|
static int config_last_modifycounter;
|
||||||
@ -40,7 +43,7 @@ static time_t config_last_mtime;
|
|||||||
static long config_last_size;
|
static long config_last_size;
|
||||||
static unsigned int config_last_checksum;
|
static unsigned int config_last_checksum;
|
||||||
|
|
||||||
static const char *settings_get_default_str(const char *key)
|
static SETTINGS_REC *settings_find(const char *key)
|
||||||
{
|
{
|
||||||
SETTINGS_REC *rec;
|
SETTINGS_REC *rec;
|
||||||
|
|
||||||
@ -53,39 +56,62 @@ static const char *settings_get_default_str(const char *key)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return rec->def;
|
return rec;
|
||||||
}
|
|
||||||
|
|
||||||
static int settings_get_default_int(const char *key)
|
|
||||||
{
|
|
||||||
SETTINGS_REC *rec;
|
|
||||||
|
|
||||||
g_return_val_if_fail(key != NULL, -1);
|
|
||||||
|
|
||||||
rec = g_hash_table_lookup(settings, key);
|
|
||||||
if (rec == NULL) {
|
|
||||||
g_warning("settings_get_default_int(%s) : "
|
|
||||||
"unknown setting", key);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
return GPOINTER_TO_INT(rec->def);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *settings_get_str(const char *key)
|
const char *settings_get_str(const char *key)
|
||||||
{
|
{
|
||||||
return iconfig_get_str("settings", key, settings_get_default_str(key));
|
SETTINGS_REC *rec;
|
||||||
|
CONFIG_NODE *setnode, *node;
|
||||||
|
|
||||||
|
rec = settings_find(key);
|
||||||
|
g_return_val_if_fail(rec != NULL, NULL);
|
||||||
|
|
||||||
|
setnode = iconfig_node_traverse("settings", FALSE);
|
||||||
|
if (setnode == NULL)
|
||||||
|
return rec->def;
|
||||||
|
|
||||||
|
node = config_node_section(setnode, rec->module, -1);
|
||||||
|
return node == NULL ? rec->def :
|
||||||
|
config_node_get_str(node, key, rec->def);
|
||||||
}
|
}
|
||||||
|
|
||||||
int settings_get_int(const char *key)
|
int settings_get_int(const char *key)
|
||||||
{
|
{
|
||||||
return iconfig_get_int("settings", key, settings_get_default_int(key));
|
SETTINGS_REC *rec;
|
||||||
|
CONFIG_NODE *setnode, *node;
|
||||||
|
int def;
|
||||||
|
|
||||||
|
rec = settings_find(key);
|
||||||
|
g_return_val_if_fail(rec != NULL, 0);
|
||||||
|
def = GPOINTER_TO_INT(rec->def);
|
||||||
|
|
||||||
|
setnode = iconfig_node_traverse("settings", FALSE);
|
||||||
|
if (setnode == NULL)
|
||||||
|
return def;
|
||||||
|
|
||||||
|
node = config_node_section(setnode, rec->module, -1);
|
||||||
|
return node == NULL ? def :
|
||||||
|
config_node_get_int(node, key, def);
|
||||||
}
|
}
|
||||||
|
|
||||||
int settings_get_bool(const char *key)
|
int settings_get_bool(const char *key)
|
||||||
{
|
{
|
||||||
return iconfig_get_bool("settings", key,
|
SETTINGS_REC *rec;
|
||||||
settings_get_default_int(key));
|
CONFIG_NODE *setnode, *node;
|
||||||
|
int def;
|
||||||
|
|
||||||
|
rec = settings_find(key);
|
||||||
|
g_return_val_if_fail(rec != NULL, 0);
|
||||||
|
def = GPOINTER_TO_INT(rec->def);
|
||||||
|
|
||||||
|
setnode = iconfig_node_traverse("settings", FALSE);
|
||||||
|
if (setnode == NULL)
|
||||||
|
return def;
|
||||||
|
|
||||||
|
node = config_node_section(setnode, rec->module, -1);
|
||||||
|
return node == NULL ? def :
|
||||||
|
config_node_get_bool(node, key, def);
|
||||||
}
|
}
|
||||||
|
|
||||||
void settings_add_str_module(const char *module, const char *section,
|
void settings_add_str_module(const char *module, const char *section,
|
||||||
@ -191,6 +217,35 @@ void settings_remove_module(const char *module)
|
|||||||
(void *) module);
|
(void *) module);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static CONFIG_NODE *settings_get_node(const char *key)
|
||||||
|
{
|
||||||
|
SETTINGS_REC *rec;
|
||||||
|
CONFIG_NODE *node;
|
||||||
|
|
||||||
|
g_return_val_if_fail(key != NULL, NULL);
|
||||||
|
|
||||||
|
rec = g_hash_table_lookup(settings, key);
|
||||||
|
g_return_val_if_fail(rec != NULL, NULL);
|
||||||
|
|
||||||
|
node = iconfig_node_traverse("settings", TRUE);
|
||||||
|
return config_node_section(node, rec->module, NODE_TYPE_BLOCK);
|
||||||
|
}
|
||||||
|
|
||||||
|
void settings_set_str(const char *key, const char *value)
|
||||||
|
{
|
||||||
|
iconfig_node_set_str(settings_get_node(key), key, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
void settings_set_int(const char *key, int value)
|
||||||
|
{
|
||||||
|
iconfig_node_set_int(settings_get_node(key), key, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
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_get_type(const char *key)
|
||||||
{
|
{
|
||||||
SETTINGS_REC *rec;
|
SETTINGS_REC *rec;
|
||||||
@ -209,6 +264,89 @@ SETTINGS_REC *settings_get_record(const char *key)
|
|||||||
return g_hash_table_lookup(settings, key);
|
return g_hash_table_lookup(settings, key);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void sig_init_finished(void)
|
||||||
|
{
|
||||||
|
fe_initialized = TRUE;
|
||||||
|
if (last_errors != NULL) {
|
||||||
|
signal_emit("gui dialog", 2, "error", last_errors->str);
|
||||||
|
g_string_free(last_errors, TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (last_config_error_msg != NULL) {
|
||||||
|
signal_emit("gui dialog", 2, "error", last_config_error_msg);
|
||||||
|
g_free_and_null(last_config_error_msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* FIXME: remove after 0.7.98 - only for backward compatibility */
|
||||||
|
static void settings_move(SETTINGS_REC *rec, char *value)
|
||||||
|
{
|
||||||
|
CONFIG_NODE *setnode, *node;
|
||||||
|
|
||||||
|
setnode = iconfig_node_traverse("settings", TRUE);
|
||||||
|
node = config_node_section(setnode, rec->module, NODE_TYPE_BLOCK);
|
||||||
|
|
||||||
|
iconfig_node_set_str(node, rec->key, value);
|
||||||
|
iconfig_node_set_str(setnode, rec->key, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* verify that all settings in config file for `module' are actually found
|
||||||
|
from /SET list */
|
||||||
|
void settings_check_module(const char *module)
|
||||||
|
{
|
||||||
|
SETTINGS_REC *set;
|
||||||
|
CONFIG_NODE *node;
|
||||||
|
GString *errors;
|
||||||
|
GSList *tmp, *next;
|
||||||
|
int count;
|
||||||
|
|
||||||
|
g_return_if_fail(module != NULL);
|
||||||
|
|
||||||
|
node = iconfig_node_traverse("settings", TRUE);
|
||||||
|
if (node != NULL) {
|
||||||
|
/* FIXME: remove after 0.7.98 */
|
||||||
|
for (tmp = node->value; tmp != NULL; tmp = next) {
|
||||||
|
CONFIG_NODE *node = tmp->data;
|
||||||
|
|
||||||
|
next = tmp->next;
|
||||||
|
if (node->type != NODE_TYPE_KEY)
|
||||||
|
continue;
|
||||||
|
set = g_hash_table_lookup(settings, node->key);
|
||||||
|
if (set != NULL)
|
||||||
|
settings_move(set, node->value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
node = node == NULL ? NULL : config_node_section(node, module, -1);
|
||||||
|
if (node == NULL) return;
|
||||||
|
|
||||||
|
errors = g_string_new(NULL);
|
||||||
|
g_string_sprintf(errors, "Unknown settings in configuration "
|
||||||
|
"file for module %s:", module);
|
||||||
|
|
||||||
|
count = 0;
|
||||||
|
for (tmp = node->value; tmp != NULL; tmp = tmp->next) {
|
||||||
|
node = tmp->data;
|
||||||
|
|
||||||
|
set = g_hash_table_lookup(settings, node->key);
|
||||||
|
if (set == NULL || strcmp(set->module, module) != 0) {
|
||||||
|
g_string_sprintfa(errors, " %s", node->key);
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (count > 0) {
|
||||||
|
if (fe_initialized)
|
||||||
|
signal_emit("gui dialog", 2, "error", errors->str);
|
||||||
|
else {
|
||||||
|
if (last_errors == NULL)
|
||||||
|
last_errors = g_string_new(NULL);
|
||||||
|
else
|
||||||
|
g_string_append_c(last_errors, '\n');
|
||||||
|
g_string_append(last_errors, errors->str);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
g_string_free(errors, TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
static int settings_compare(SETTINGS_REC *v1, SETTINGS_REC *v2)
|
static int settings_compare(SETTINGS_REC *v1, SETTINGS_REC *v2)
|
||||||
{
|
{
|
||||||
return strcmp(v1->section, v2->section);
|
return strcmp(v1->section, v2->section);
|
||||||
@ -321,15 +459,6 @@ static CONFIG_REC *parse_configfile(const char *fname)
|
|||||||
return config;
|
return config;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sig_print_config_error(void)
|
|
||||||
{
|
|
||||||
signal_emit("gui dialog", 2, "error", last_error_msg);
|
|
||||||
signal_remove("irssi init finished",
|
|
||||||
(SIGNAL_FUNC) sig_print_config_error);
|
|
||||||
|
|
||||||
g_free_and_null(last_error_msg);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void init_configfile(void)
|
static void init_configfile(void)
|
||||||
{
|
{
|
||||||
struct stat statbuf;
|
struct stat statbuf;
|
||||||
@ -354,12 +483,10 @@ static void init_configfile(void)
|
|||||||
|
|
||||||
/* any errors? */
|
/* any errors? */
|
||||||
if (config_last_error(mainconfig) != NULL) {
|
if (config_last_error(mainconfig) != NULL) {
|
||||||
last_error_msg =
|
last_config_error_msg =
|
||||||
g_strdup_printf(_("Ignored errors in configuration "
|
g_strdup_printf(_("Ignored errors in configuration "
|
||||||
"file:\n%s"),
|
"file:\n%s"),
|
||||||
config_last_error(mainconfig));
|
config_last_error(mainconfig));
|
||||||
signal_add("irssi init finished",
|
|
||||||
(SIGNAL_FUNC) sig_print_config_error);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
signal(SIGTERM, sig_term);
|
signal(SIGTERM, sig_term);
|
||||||
@ -450,12 +577,17 @@ void settings_init(void)
|
|||||||
settings = g_hash_table_new((GHashFunc) g_str_hash,
|
settings = g_hash_table_new((GHashFunc) g_str_hash,
|
||||||
(GCompareFunc) g_str_equal);
|
(GCompareFunc) g_str_equal);
|
||||||
|
|
||||||
|
last_errors = NULL;
|
||||||
|
last_config_error_msg = NULL;
|
||||||
|
fe_initialized = FALSE;
|
||||||
|
|
||||||
config_last_mtime = 0;
|
config_last_mtime = 0;
|
||||||
config_last_modifycounter = 0;
|
config_last_modifycounter = 0;
|
||||||
init_configfile();
|
init_configfile();
|
||||||
|
|
||||||
settings_add_bool("misc", "settings_autosave", TRUE);
|
settings_add_bool("misc", "settings_autosave", TRUE);
|
||||||
timeout_tag = g_timeout_add(1000*60*60, (GSourceFunc) sig_autosave, NULL);
|
timeout_tag = g_timeout_add(1000*60*60, (GSourceFunc) sig_autosave, NULL);
|
||||||
|
signal_add("irssi init finished", (SIGNAL_FUNC) sig_init_finished);
|
||||||
signal_add("gui exit", (SIGNAL_FUNC) sig_autosave);
|
signal_add("gui exit", (SIGNAL_FUNC) sig_autosave);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -467,9 +599,9 @@ static void settings_hash_free(const char *key, SETTINGS_REC *rec)
|
|||||||
void settings_deinit(void)
|
void settings_deinit(void)
|
||||||
{
|
{
|
||||||
g_source_remove(timeout_tag);
|
g_source_remove(timeout_tag);
|
||||||
|
signal_remove("irssi init finished", (SIGNAL_FUNC) sig_init_finished);
|
||||||
signal_remove("gui exit", (SIGNAL_FUNC) sig_autosave);
|
signal_remove("gui exit", (SIGNAL_FUNC) sig_autosave);
|
||||||
|
|
||||||
g_free_not_null(last_error_msg);
|
|
||||||
g_hash_table_foreach(settings, (GHFunc) settings_hash_free, NULL);
|
g_hash_table_foreach(settings, (GHFunc) settings_hash_free, NULL);
|
||||||
g_hash_table_destroy(settings);
|
g_hash_table_destroy(settings);
|
||||||
|
|
||||||
|
@ -62,6 +62,10 @@ void settings_remove_module(const char *module);
|
|||||||
#define settings_add_bool(section, key, def) \
|
#define settings_add_bool(section, key, def) \
|
||||||
settings_add_bool_module(MODULE_NAME, section, key, def)
|
settings_add_bool_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);
|
||||||
|
|
||||||
/* Get the type (SETTING_TYPE_xxx) of `key' */
|
/* Get the type (SETTING_TYPE_xxx) of `key' */
|
||||||
int settings_get_type(const char *key);
|
int settings_get_type(const char *key);
|
||||||
/* Get all settings sorted by section. Free the result with g_slist_free() */
|
/* Get all settings sorted by section. Free the result with g_slist_free() */
|
||||||
@ -69,6 +73,11 @@ GSList *settings_get_sorted(void);
|
|||||||
/* Get the record of the setting */
|
/* Get the record of the setting */
|
||||||
SETTINGS_REC *settings_get_record(const char *key);
|
SETTINGS_REC *settings_get_record(const char *key);
|
||||||
|
|
||||||
|
/* verify that all settings in config file for `module' are actually found
|
||||||
|
from /SET list */
|
||||||
|
void settings_check_module(const char *module);
|
||||||
|
#define settings_check() settings_check_module(MODULE_NAME)
|
||||||
|
|
||||||
/* if `fname' is NULL, the default is used */
|
/* if `fname' is NULL, the default is used */
|
||||||
int settings_reread(const char *fname);
|
int settings_reread(const char *fname);
|
||||||
int settings_save(const char *fname);
|
int settings_save(const char *fname);
|
||||||
|
@ -128,6 +128,8 @@ void fe_common_core_init(void)
|
|||||||
|
|
||||||
fe_messages_init();
|
fe_messages_init();
|
||||||
fe_ignore_messages_init();
|
fe_ignore_messages_init();
|
||||||
|
|
||||||
|
settings_check();
|
||||||
}
|
}
|
||||||
|
|
||||||
void fe_common_core_deinit(void)
|
void fe_common_core_deinit(void)
|
||||||
|
@ -55,11 +55,11 @@ static void set_print(SETTINGS_REC *rec)
|
|||||||
static void set_boolean(const char *key, const char *value)
|
static void set_boolean(const char *key, const char *value)
|
||||||
{
|
{
|
||||||
if (g_strcasecmp(value, "ON") == 0)
|
if (g_strcasecmp(value, "ON") == 0)
|
||||||
iconfig_set_bool("settings", key, TRUE);
|
settings_set_bool(key, TRUE);
|
||||||
else if (g_strcasecmp(value, "OFF") == 0)
|
else if (g_strcasecmp(value, "OFF") == 0)
|
||||||
iconfig_set_bool("settings", key, FALSE);
|
settings_set_bool(key, FALSE);
|
||||||
else if (g_strcasecmp(value, "TOGGLE") == 0)
|
else if (g_strcasecmp(value, "TOGGLE") == 0)
|
||||||
iconfig_set_bool("settings", key, !settings_get_bool(key));
|
settings_set_bool(key, !settings_get_bool(key));
|
||||||
else
|
else
|
||||||
printformat(NULL, NULL, MSGLEVEL_CLIENTCRAP, IRCTXT_NOT_TOGGLE);
|
printformat(NULL, NULL, MSGLEVEL_CLIENTCRAP, IRCTXT_NOT_TOGGLE);
|
||||||
}
|
}
|
||||||
@ -102,10 +102,10 @@ static void cmd_set(char *data)
|
|||||||
set_boolean(key, clear ? FALSE : value);
|
set_boolean(key, clear ? FALSE : value);
|
||||||
break;
|
break;
|
||||||
case SETTING_TYPE_INT:
|
case SETTING_TYPE_INT:
|
||||||
iconfig_set_int("settings", key, clear ? 0 : atoi(value));
|
settings_set_int(key, clear ? 0 : atoi(value));
|
||||||
break;
|
break;
|
||||||
case SETTING_TYPE_STRING:
|
case SETTING_TYPE_STRING:
|
||||||
iconfig_set_str("settings", key, clear ? "" : value);
|
settings_set_str(key, clear ? "" : value);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
signal_emit("setup changed", 0);
|
signal_emit("setup changed", 0);
|
||||||
|
@ -110,6 +110,7 @@ void fe_common_irc_init(void)
|
|||||||
fe_netjoin_init();
|
fe_netjoin_init();
|
||||||
|
|
||||||
fe_irc_modules_init();
|
fe_irc_modules_init();
|
||||||
|
settings_check();
|
||||||
}
|
}
|
||||||
|
|
||||||
void fe_common_irc_deinit(void)
|
void fe_common_irc_deinit(void)
|
||||||
@ -138,12 +139,12 @@ void fe_common_irc_finish_init(void)
|
|||||||
|
|
||||||
if (cmdline_nick != NULL) {
|
if (cmdline_nick != NULL) {
|
||||||
/* override nick found from setup */
|
/* override nick found from setup */
|
||||||
iconfig_set_str("settings", "nick", cmdline_nick);
|
settings_set_str("nick", cmdline_nick);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cmdline_hostname != NULL) {
|
if (cmdline_hostname != NULL) {
|
||||||
/* override host name found from setup */
|
/* override host name found from setup */
|
||||||
iconfig_set_str("settings", "hostname", cmdline_hostname);
|
settings_set_str("hostname", cmdline_hostname);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (autocon_server != NULL) {
|
if (autocon_server != NULL) {
|
||||||
|
@ -24,6 +24,7 @@
|
|||||||
#include "signals.h"
|
#include "signals.h"
|
||||||
#include "levels.h"
|
#include "levels.h"
|
||||||
#include "core.h"
|
#include "core.h"
|
||||||
|
#include "settings.h"
|
||||||
|
|
||||||
#include "printtext.h"
|
#include "printtext.h"
|
||||||
#include "fe-common-core.h"
|
#include "fe-common-core.h"
|
||||||
@ -124,6 +125,8 @@ static void textui_finish_init(void)
|
|||||||
gui_windows_init();
|
gui_windows_init();
|
||||||
statusbar_init();
|
statusbar_init();
|
||||||
|
|
||||||
|
settings_check();
|
||||||
|
|
||||||
fe_common_core_finish_init();
|
fe_common_core_finish_init();
|
||||||
fe_common_irc_finish_init();
|
fe_common_irc_finish_init();
|
||||||
|
|
||||||
|
@ -95,7 +95,7 @@ static void init_userinfo(void)
|
|||||||
set = settings_get_str("real_name");
|
set = settings_get_str("real_name");
|
||||||
if (set == NULL || *set == '\0') {
|
if (set == NULL || *set == '\0') {
|
||||||
str = g_getenv("IRCNAME");
|
str = g_getenv("IRCNAME");
|
||||||
iconfig_set_str("settings", "real_name",
|
settings_set_str("real_name",
|
||||||
str != NULL ? str : g_get_real_name());
|
str != NULL ? str : g_get_real_name());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -103,7 +103,7 @@ static void init_userinfo(void)
|
|||||||
user_name = settings_get_str("user_name");
|
user_name = settings_get_str("user_name");
|
||||||
if (user_name == NULL || *user_name == '\0') {
|
if (user_name == NULL || *user_name == '\0') {
|
||||||
str = g_getenv("IRCUSER");
|
str = g_getenv("IRCUSER");
|
||||||
iconfig_set_str("settings", "user_name",
|
settings_set_str("user_name",
|
||||||
str != NULL ? str : g_get_user_name());
|
str != NULL ? str : g_get_user_name());
|
||||||
|
|
||||||
user_name = settings_get_str("user_name");
|
user_name = settings_get_str("user_name");
|
||||||
@ -113,8 +113,7 @@ static void init_userinfo(void)
|
|||||||
nick = settings_get_str("nick");
|
nick = settings_get_str("nick");
|
||||||
if (nick == NULL || *nick == '\0') {
|
if (nick == NULL || *nick == '\0') {
|
||||||
str = g_getenv("IRCNICK");
|
str = g_getenv("IRCNICK");
|
||||||
iconfig_set_str("settings", "nick",
|
settings_set_str("nick", str != NULL ? str : user_name);
|
||||||
str != NULL ? str : user_name);
|
|
||||||
|
|
||||||
nick = settings_get_str("nick");
|
nick = settings_get_str("nick");
|
||||||
}
|
}
|
||||||
@ -128,7 +127,7 @@ static void init_userinfo(void)
|
|||||||
str = g_strdup(nick);
|
str = g_strdup(nick);
|
||||||
str[strlen(str)-1] = '_';
|
str[strlen(str)-1] = '_';
|
||||||
}
|
}
|
||||||
iconfig_set_str("settings", "alternate_nick", str);
|
settings_set_str("alternate_nick", str);
|
||||||
g_free(str);
|
g_free(str);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -137,7 +136,7 @@ static void init_userinfo(void)
|
|||||||
if (set == NULL || *set == '\0') {
|
if (set == NULL || *set == '\0') {
|
||||||
str = g_getenv("IRCHOST");
|
str = g_getenv("IRCHOST");
|
||||||
if (str != NULL)
|
if (str != NULL)
|
||||||
iconfig_set_str("settings", "hostname", str);
|
settings_set_str("hostname", str);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user