diff options
author | ailin-nemui <ailin-nemui@users.noreply.github.com> | 2017-11-01 15:48:35 +0100 |
---|---|---|
committer | ailin-nemui <ailin-nemui@users.noreply.github.com> | 2017-11-01 15:51:20 +0100 |
commit | b0fa4dd46d8bf1cf63880fabf2105dd9134100df (patch) | |
tree | 4541934244408dd231c37e042a7211e531dad275 /src/fe-text/irssi.c | |
parent | 7e619ed990503faf45fc1ae1e28a3a6062dc7532 (diff) | |
download | irssi-b0fa4dd46d8bf1cf63880fabf2105dd9134100df.zip |
show initial nick and name on first start
Diffstat (limited to 'src/fe-text/irssi.c')
-rw-r--r-- | src/fe-text/irssi.c | 49 |
1 files changed, 25 insertions, 24 deletions
diff --git a/src/fe-text/irssi.c b/src/fe-text/irssi.c index b5df47c9..6349ae2a 100644 --- a/src/fe-text/irssi.c +++ b/src/fe-text/irssi.c @@ -31,6 +31,7 @@ #include "printtext.h" #include "fe-common-core.h" +#include "fe-settings.h" #include "themes.h" #include "term.h" @@ -79,25 +80,8 @@ static int dirty, full_redraw; static GMainLoop *main_loop; int quitting; -static const char *banner_text = - " ___ _\n" - "|_ _|_ _ _____(_)\n" - " | || '_(_-<_-< |\n" - "|___|_| /__/__/_|\n" - "Irssi v" PACKAGE_VERSION " - http://www.irssi.org"; - -static const char *firsttimer_text = - "- - - - - - - - - - - - - - - - - - - - - - - - - - - -\n" - "Hi there! If this is your first time using Irssi, you\n" - "might want to go to our website and read the startup\n" - "documentation to get you going.\n\n" - "Our community and staff are available to assist you or\n" - "to answer any questions you may have.\n\n" - "Use the /HELP command to get detailed information about\n" - "the available commands.\n" - "- - - - - - - - - - - - - - - - - - - - - - - - - - - -"; - static int display_firsttimer = FALSE; +static int user_settings_changed = 0; static void sig_exit(void) @@ -105,6 +89,11 @@ static void sig_exit(void) quitting = TRUE; } +static void sig_settings_userinfo_changed(gpointer changedp) +{ + user_settings_changed = GPOINTER_TO_INT(changedp); +} + /* redraw irssi's screen.. */ void irssi_redraw(void) { @@ -161,6 +150,7 @@ static void textui_init(void) fe_common_irc_init(); theme_register(gui_text_formats); + signal_add("settings userinfo changed", (SIGNAL_FUNC) sig_settings_userinfo_changed); signal_add_last("gui exit", (SIGNAL_FUNC) sig_exit); } @@ -199,14 +189,24 @@ static void textui_finish_init(void) statusbar_redraw(NULL, TRUE); if (servers == NULL && lookup_servers == NULL) { - printtext(NULL, NULL, MSGLEVEL_CRAP|MSGLEVEL_NO_ACT, - "%s", banner_text); + printformat(NULL, NULL, MSGLEVEL_CRAP|MSGLEVEL_NO_ACT, TXT_IRSSI_BANNER); } if (display_firsttimer) { - printtext(NULL, NULL, MSGLEVEL_CRAP|MSGLEVEL_NO_ACT, - "%s", firsttimer_text); + printformat(NULL, NULL, MSGLEVEL_CRAP|MSGLEVEL_NO_ACT, TXT_WELCOME_FIRSTTIME); } + + /* see irc-servers-setup.c:init_userinfo */ + if (user_settings_changed) + printformat(NULL, NULL, MSGLEVEL_CLIENTNOTICE, TXT_WELCOME_INIT_SETTINGS); + if (user_settings_changed & (1<<0)) + fe_settings_set_print("real_name"); + if (user_settings_changed & (1<<1)) + fe_settings_set_print("user_name"); + if (user_settings_changed & (1<<2)) + fe_settings_set_print("nick"); + if (user_settings_changed & (1<<3)) + fe_settings_set_print("hostname"); } static void textui_deinit(void) @@ -223,6 +223,7 @@ static void textui_deinit(void) #endif dirty_check(); /* one last time to print any quit messages */ + signal_remove("settings userinfo changed", (SIGNAL_FUNC) sig_settings_userinfo_changed); signal_remove("gui exit", (SIGNAL_FUNC) sig_exit); lastlog_deinit(); @@ -249,6 +250,7 @@ static void textui_deinit(void) core_deinit(); } + static void check_files(void) { struct stat statbuf; @@ -259,12 +261,11 @@ static void check_files(void) } } - int main(int argc, char **argv) { static int version = 0; static GOptionEntry options[] = { - { "version", 'v', 0, G_OPTION_ARG_NONE, &version, "Display irssi version", NULL }, + { "version", 'v', 0, G_OPTION_ARG_NONE, &version, "Display Irssi version", NULL }, { NULL } }; int loglev; |