From 27a5c9d287e856bd774988b4066667db54b65de7 Mon Sep 17 00:00:00 2001 From: Michael Vetter Date: Tue, 5 Jul 2022 06:57:11 +0200 Subject: Display a help message upon first start of Profanity Explaining how to register/connect/set up an account. --- src/config/preferences.c | 1 - src/ui/console.c | 24 ++++++++++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/src/config/preferences.c b/src/config/preferences.c index c452840d..dec92e7f 100644 --- a/src/config/preferences.c +++ b/src/config/preferences.c @@ -265,7 +265,6 @@ prefs_reload(void) void prefs_load(char* config_file) { - if (config_file == NULL) { prefs_loc = files_get_config_path(FILE_PROFRC); } else { diff --git a/src/ui/console.c b/src/ui/console.c index 28706b55..95a70a30 100644 --- a/src/ui/console.c +++ b/src/ui/console.c @@ -54,6 +54,7 @@ #include "common.h" #include "log.h" +#include "config/files.h" #include "config/preferences.h" #include "config/theme.h" #include "command/cmd_defs.h" @@ -391,6 +392,27 @@ cons_show_incoming_private_message(const char* const nick, const char* const roo free(priv_show); } +static void +_cons_welcome_first_start(void) +{ + gchar* prefs_loc = files_get_config_path(FILE_PROFANITY_IDENTIFIER); + if (!g_file_test(prefs_loc, G_FILE_TEST_EXISTS)) { + ProfWin* console = wins_get_console(); + win_println(console, THEME_DEFAULT, "-", "This seems to be your first time starting Profanity."); + win_println(console, THEME_DEFAULT, "-", ""); + win_println(console, THEME_DEFAULT, "-", "You can connect to an existing XMPP account via /connect myjid@domain.org."); + win_println(console, THEME_DEFAULT, "-", "If you plan to connect to this XMPP account regularly we suggest you set up an account:"); + win_println(console, THEME_DEFAULT, "-", "/account add myaccount"); + win_println(console, THEME_DEFAULT, "-", "/account set myaccount jid myjid@domain.org"); + win_println(console, THEME_DEFAULT, "-", "See /help account for more details."); + win_println(console, THEME_DEFAULT, "-", ""); + win_println(console, THEME_DEFAULT, "-", "If you want to register a new XMPP account with a server use:"); + win_println(console, THEME_DEFAULT, "-", "/register myjid myserver.org"); + win_println(console, THEME_DEFAULT, "-", ""); + } + g_free(prefs_loc); +} + void cons_about(void) { @@ -427,6 +449,8 @@ cons_about(void) cons_check_version(FALSE); } + _cons_welcome_first_start(); + pnoutrefresh(console->layout->win, 0, 0, 1, 0, rows - 3, cols - 1); cons_alert(NULL); -- cgit 1.4.1-2-gfad0