about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorMichael Vetter <jubalh@iodoru.org>2022-07-05 12:23:47 +0200
committerGitHub <noreply@github.com>2022-07-05 12:23:47 +0200
commit9605334d5a57dfcf6ef367a92574c9901f688bd8 (patch)
tree3917f2e1742daa06ba69569199d1e0d678d321f6
parent6a3ea47dc0aec4c4b0d9a4160ceacfc4ab09c2de (diff)
parent27a5c9d287e856bd774988b4066667db54b65de7 (diff)
downloadprofani-tty-9605334d5a57dfcf6ef367a92574c9901f688bd8.tar.gz
Merge pull request #1735 from profanity-im/feat/first-start
Display a help message upon first start of Profanity
-rw-r--r--src/config/preferences.c1
-rw-r--r--src/ui/console.c24
2 files changed, 24 insertions, 1 deletions
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);