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 | |
parent | 7e619ed990503faf45fc1ae1e28a3a6062dc7532 (diff) | |
download | irssi-b0fa4dd46d8bf1cf63880fabf2105dd9134100df.zip |
show initial nick and name on first start
Diffstat (limited to 'src/fe-text')
-rw-r--r-- | src/fe-text/irssi.c | 49 | ||||
-rw-r--r-- | src/fe-text/module-formats.c | 21 | ||||
-rw-r--r-- | src/fe-text/module-formats.h | 6 |
3 files changed, 52 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; diff --git a/src/fe-text/module-formats.c b/src/fe-text/module-formats.c index 899827c2..c4606197 100644 --- a/src/fe-text/module-formats.c +++ b/src/fe-text/module-formats.c @@ -78,5 +78,26 @@ FORMAT_REC gui_text_formats[] = { "paste_warning", "Pasting $0 lines to $1. Press Ctrl-K if you wish to do this or Ctrl-C to cancel.", 2, { 1, 0 } }, { "paste_prompt", "Hit Ctrl-K to paste, Ctrl-C to abort?", 0 }, + /* ---- */ + { NULL, "Welcome", 0 }, + + { "irssi_banner", + " ___ _%:" + "|_ _|_ _ _____(_)%:" + " | || '_(_-<_-< |%:" + "|___|_| /__/__/_|%:" + "Irssi v$J - http://www.irssi.org", 0 }, + { "welcome_firsttime", + "- - - - - - - - - - - - - - - - - - - - - - - - - - - -\n" + "Hi there! If this is your first time using Irssi, you%:" + "might want to go to our website and read the startup%:" + "documentation to get you going.%:%:" + "Our community and staff are available to assist you or%:" + "to answer any questions you may have.%:%:" + "Use the /HELP command to get detailed information about%:" + "the available commands.%:" + "- - - - - - - - - - - - - - - - - - - - - - - - - - - -", 0 }, + { "welcome_init_settings", "The following settings were initialized", 0 }, + { NULL, NULL, 0 } }; diff --git a/src/fe-text/module-formats.h b/src/fe-text/module-formats.h index 3fa8c511..05e9438d 100644 --- a/src/fe-text/module-formats.h +++ b/src/fe-text/module-formats.h @@ -52,6 +52,12 @@ enum { TXT_PASTE_WARNING, TXT_PASTE_PROMPT, + TXT_FILL_5, /* Welcome */ + + TXT_IRSSI_BANNER, + TXT_WELCOME_FIRSTTIME, + TXT_WELCOME_INIT_SETTINGS, + TXT_COUNT }; |