about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2012-10-23 00:18:28 +0100
committerJames Booth <boothj5@gmail.com>2012-10-23 00:18:28 +0100
commitd19afc35075c7b614ee243eb00805c1eba68fc35 (patch)
treea7acda3d057743641761e6dc7444b58d42e85982 /src
parent907b5cf801f78ed41a95da04cbdc6b95b5e4a451 (diff)
downloadprofani-tty-d19afc35075c7b614ee243eb00805c1eba68fc35.tar.gz
Added /about command
Useful for showing version
Diffstat (limited to 'src')
-rw-r--r--src/command.c18
-rw-r--r--src/ui.h1
-rw-r--r--src/windows.c44
3 files changed, 45 insertions, 18 deletions
diff --git a/src/command.c b/src/command.c
index 66547525..2ae038c5 100644
--- a/src/command.c
+++ b/src/command.c
@@ -61,6 +61,7 @@ static gboolean _cmd_set_boolean_preference(const char * const inp,
 // command prototypes
 static gboolean _cmd_quit(const char * const inp, struct cmd_help_t help);
 static gboolean _cmd_help(const char * const inp, struct cmd_help_t help);
+static gboolean _cmd_about(const char * const inp, struct cmd_help_t help);
 static gboolean _cmd_prefs(const char * const inp, struct cmd_help_t help);
 static gboolean _cmd_who(const char * const inp, struct cmd_help_t help);
 static gboolean _cmd_connect(const char * const inp, struct cmd_help_t help);
@@ -93,7 +94,7 @@ static struct cmd_t main_commands[] =
         _cmd_help,
         { "/help [area|command]", "Show help summary, or help on a specific area or command",
         { "/help [area|command]",
-          "---------------",
+          "--------------------",
           "Show help options.",
           "Specify an area (basic, status, settings, navigation) for more help on that area.",
           "Specify the command if you want more detailed help on a specific command.",
@@ -102,6 +103,14 @@ static struct cmd_t main_commands[] =
           "Example : /help settings",
           NULL } } },
 
+    { "/about",
+        _cmd_about,
+        { "/about", "About Profanity",
+        { "/about",
+          "------",
+          "Show versioning and license information.",
+          NULL  } } },
+
     { "/connect",
         _cmd_connect,
         { "/connect user@host", "Login to jabber.",
@@ -595,6 +604,13 @@ _cmd_help(const char * const inp, struct cmd_help_t help)
 }
 
 static gboolean
+_cmd_about(const char * const inp, struct cmd_help_t help)
+{
+    cons_about();
+    return TRUE;
+}
+
+static gboolean
 _cmd_prefs(const char * const inp, struct cmd_help_t help)
 {
     cons_prefs();
diff --git a/src/ui.h b/src/ui.h
index 8b2e5163..9d32602a 100644
--- a/src/ui.h
+++ b/src/ui.h
@@ -103,6 +103,7 @@ void win_bad_show(const char * const msg);
 void win_remind(void);
 
 // console window actions
+void cons_about(void);
 void cons_help(void);
 void cons_basic_help(void);
 void cons_settings_help(void);
diff --git a/src/windows.c b/src/windows.c
index cc1f660e..3183222f 100644
--- a/src/windows.c
+++ b/src/windows.c
@@ -648,6 +648,7 @@ cons_navigation_help(void)
     cons_show("F2-F10                   : Chat windows.");
     cons_show("UP, DOWN                 : Navigate input history.");
     cons_show("LEFT, RIGHT, HOME, END   : Edit current input.");
+    cons_show("ESC                      : Clear current input.");
     cons_show("TAB                      : Autocomplete command/recipient/login");
     cons_show("PAGE UP, PAGE DOWN       : Page the main window.");
     cons_show("");
@@ -772,8 +773,7 @@ win_page_off(void)
 static void
 _create_windows(void)
 {
-    int rows, cols;
-    getmaxyx(stdscr, rows, cols);
+    int cols = getmaxx(stdscr);
     max_cols = cols;
 
     // create the console window in 0
@@ -788,6 +788,31 @@ _create_windows(void)
     scrollok(cons.win, TRUE);
 
     _wins[0] = cons;
+
+    cons_about();
+
+    // create the chat windows
+    int i;
+    for (i = 1; i < NUM_WINS; i++) {
+        struct prof_win chat;
+        strcpy(chat.from, "");
+        chat.win = newpad(PAD_SIZE, cols);
+        wbkgd(chat.win, COLOUR_TEXT);
+        chat.y_pos = 0;
+        chat.paged = 0;
+        chat.unread = 0;
+        chat.history_shown = 0;
+        scrollok(chat.win, TRUE);
+        _wins[i] = chat;
+    }
+}
+
+void
+cons_about(void)
+{
+    int rows, cols;
+    getmaxyx(stdscr, rows, cols);
+
     _cons_win = _wins[0].win;
 
     if (prefs_get_showsplash()) {
@@ -817,21 +842,6 @@ _create_windows(void)
     prefresh(_cons_win, 0, 0, 1, 0, rows-3, cols-1);
 
     dirty = TRUE;
-
-    // create the chat windows
-    int i;
-    for (i = 1; i < NUM_WINS; i++) {
-        struct prof_win chat;
-        strcpy(chat.from, "");
-        chat.win = newpad(PAD_SIZE, cols);
-        wbkgd(chat.win, COLOUR_TEXT);
-        chat.y_pos = 0;
-        chat.paged = 0;
-        chat.unread = 0;
-        chat.history_shown = 0;
-        scrollok(chat.win, TRUE);
-        _wins[i] = chat;
-    }
 }
 
 static void