mirror of
https://github.com/irssi/irssi.git
synced 2024-12-04 14:46:39 -05:00
use enum
This commit is contained in:
parent
4d6822b1c4
commit
02c677f467
@ -39,7 +39,7 @@ static GString *last_errors;
|
|||||||
static GSList *last_invalid_modules;
|
static GSList *last_invalid_modules;
|
||||||
static int fe_initialized;
|
static int fe_initialized;
|
||||||
static int config_changed; /* FIXME: remove after .98 (unless needed again) */
|
static int config_changed; /* FIXME: remove after .98 (unless needed again) */
|
||||||
static int user_settings_changed;
|
static unsigned int user_settings_changed;
|
||||||
|
|
||||||
static GHashTable *settings;
|
static GHashTable *settings;
|
||||||
static int timeout_tag;
|
static int timeout_tag;
|
||||||
@ -467,7 +467,7 @@ SETTINGS_REC *settings_get_record(const char *key)
|
|||||||
|
|
||||||
static void sig_init_userinfo_changed(gpointer changedp)
|
static void sig_init_userinfo_changed(gpointer changedp)
|
||||||
{
|
{
|
||||||
user_settings_changed = GPOINTER_TO_INT(changedp);
|
user_settings_changed |= GPOINTER_TO_UINT(changedp);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sig_init_finished(void)
|
static void sig_init_finished(void)
|
||||||
@ -486,7 +486,7 @@ static void sig_init_finished(void)
|
|||||||
signal_emit("setup changed", 0);
|
signal_emit("setup changed", 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
signal_emit("settings userinfo changed", 1, GINT_TO_POINTER(user_settings_changed));
|
signal_emit("settings userinfo changed", 1, GUINT_TO_POINTER(user_settings_changed));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void settings_clean_invalid_module(const char *module)
|
static void settings_clean_invalid_module(const char *module)
|
||||||
|
@ -30,6 +30,13 @@ typedef struct {
|
|||||||
char **choices;
|
char **choices;
|
||||||
} SETTINGS_REC;
|
} SETTINGS_REC;
|
||||||
|
|
||||||
|
enum {
|
||||||
|
USER_SETTINGS_REAL_NAME = 0x1,
|
||||||
|
USER_SETTINGS_USER_NAME = 0x2,
|
||||||
|
USER_SETTINGS_NICK = 0x4,
|
||||||
|
USER_SETTINGS_HOSTNAME = 0x8,
|
||||||
|
};
|
||||||
|
|
||||||
/* macros for handling the default Irssi configuration */
|
/* macros for handling the default Irssi configuration */
|
||||||
#define iconfig_get_str(a, b, c) config_get_str(mainconfig, a, b, c)
|
#define iconfig_get_str(a, b, c) config_get_str(mainconfig, a, b, c)
|
||||||
#define iconfig_get_int(a, b, c) config_get_int(mainconfig, a, b, c)
|
#define iconfig_get_int(a, b, c) config_get_int(mainconfig, a, b, c)
|
||||||
|
@ -81,7 +81,7 @@ static GMainLoop *main_loop;
|
|||||||
int quitting;
|
int quitting;
|
||||||
|
|
||||||
static int display_firsttimer = FALSE;
|
static int display_firsttimer = FALSE;
|
||||||
static int user_settings_changed = 0;
|
static unsigned int user_settings_changed = 0;
|
||||||
|
|
||||||
|
|
||||||
static void sig_exit(void)
|
static void sig_exit(void)
|
||||||
@ -91,7 +91,7 @@ static void sig_exit(void)
|
|||||||
|
|
||||||
static void sig_settings_userinfo_changed(gpointer changedp)
|
static void sig_settings_userinfo_changed(gpointer changedp)
|
||||||
{
|
{
|
||||||
user_settings_changed = GPOINTER_TO_INT(changedp);
|
user_settings_changed = GPOINTER_TO_UINT(changedp);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* redraw irssi's screen.. */
|
/* redraw irssi's screen.. */
|
||||||
@ -199,13 +199,13 @@ static void textui_finish_init(void)
|
|||||||
/* see irc-servers-setup.c:init_userinfo */
|
/* see irc-servers-setup.c:init_userinfo */
|
||||||
if (user_settings_changed)
|
if (user_settings_changed)
|
||||||
printformat(NULL, NULL, MSGLEVEL_CLIENTNOTICE, TXT_WELCOME_INIT_SETTINGS);
|
printformat(NULL, NULL, MSGLEVEL_CLIENTNOTICE, TXT_WELCOME_INIT_SETTINGS);
|
||||||
if (user_settings_changed & (1<<0))
|
if (user_settings_changed & USER_SETTINGS_REAL_NAME)
|
||||||
fe_settings_set_print("real_name");
|
fe_settings_set_print("real_name");
|
||||||
if (user_settings_changed & (1<<1))
|
if (user_settings_changed & USER_SETTINGS_USER_NAME)
|
||||||
fe_settings_set_print("user_name");
|
fe_settings_set_print("user_name");
|
||||||
if (user_settings_changed & (1<<2))
|
if (user_settings_changed & USER_SETTINGS_NICK)
|
||||||
fe_settings_set_print("nick");
|
fe_settings_set_print("nick");
|
||||||
if (user_settings_changed & (1<<3))
|
if (user_settings_changed & USER_SETTINGS_HOSTNAME)
|
||||||
fe_settings_set_print("hostname");
|
fe_settings_set_print("hostname");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -222,7 +222,7 @@ static void textui_deinit(void)
|
|||||||
fe_perl_deinit();
|
fe_perl_deinit();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
dirty_check(); /* one last time to print any quit messages */
|
dirty_check(); /* one last time to print any quit messages */
|
||||||
signal_remove("settings userinfo changed", (SIGNAL_FUNC) sig_settings_userinfo_changed);
|
signal_remove("settings userinfo changed", (SIGNAL_FUNC) sig_settings_userinfo_changed);
|
||||||
signal_remove("gui exit", (SIGNAL_FUNC) sig_exit);
|
signal_remove("gui exit", (SIGNAL_FUNC) sig_exit);
|
||||||
|
|
||||||
@ -250,7 +250,6 @@ static void textui_deinit(void)
|
|||||||
core_deinit();
|
core_deinit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void check_files(void)
|
static void check_files(void)
|
||||||
{
|
{
|
||||||
struct stat statbuf;
|
struct stat statbuf;
|
||||||
|
@ -116,7 +116,7 @@ static void sig_server_setup_fill_chatnet(IRC_SERVER_CONNECT_REC *conn,
|
|||||||
|
|
||||||
static void init_userinfo(void)
|
static void init_userinfo(void)
|
||||||
{
|
{
|
||||||
int changed;
|
unsigned int changed;
|
||||||
const char *set, *nick, *user_name, *str;
|
const char *set, *nick, *user_name, *str;
|
||||||
|
|
||||||
changed = 0;
|
changed = 0;
|
||||||
@ -126,7 +126,7 @@ static void init_userinfo(void)
|
|||||||
str = g_getenv("IRCNAME");
|
str = g_getenv("IRCNAME");
|
||||||
settings_set_str("real_name",
|
settings_set_str("real_name",
|
||||||
str != NULL ? str : g_get_real_name());
|
str != NULL ? str : g_get_real_name());
|
||||||
changed |= 1<<0;
|
changed |= USER_SETTINGS_REAL_NAME;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* username */
|
/* username */
|
||||||
@ -137,7 +137,7 @@ static void init_userinfo(void)
|
|||||||
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");
|
||||||
changed |= 1<<1;
|
changed |= USER_SETTINGS_USER_NAME;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* nick */
|
/* nick */
|
||||||
@ -147,7 +147,7 @@ static void init_userinfo(void)
|
|||||||
settings_set_str("nick", str != NULL ? str : user_name);
|
settings_set_str("nick", str != NULL ? str : user_name);
|
||||||
|
|
||||||
nick = settings_get_str("nick");
|
nick = settings_get_str("nick");
|
||||||
changed |= 1<<2;
|
changed |= USER_SETTINGS_NICK;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* host name */
|
/* host name */
|
||||||
@ -156,11 +156,11 @@ static void init_userinfo(void)
|
|||||||
str = g_getenv("IRCHOST");
|
str = g_getenv("IRCHOST");
|
||||||
if (str != NULL) {
|
if (str != NULL) {
|
||||||
settings_set_str("hostname", str);
|
settings_set_str("hostname", str);
|
||||||
changed |= 1<<3;
|
changed |= USER_SETTINGS_HOSTNAME;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
signal_emit("irssi init userinfo changed", 1, GINT_TO_POINTER(changed));
|
signal_emit("irssi init userinfo changed", 1, GUINT_TO_POINTER(changed));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sig_server_setup_read(IRC_SERVER_SETUP_REC *rec, CONFIG_NODE *node)
|
static void sig_server_setup_read(IRC_SERVER_SETUP_REC *rec, CONFIG_NODE *node)
|
||||||
|
Loading…
Reference in New Issue
Block a user