about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/command.c19
-rw-r--r--src/input_win.c2
-rw-r--r--src/jabber.c2
-rw-r--r--src/preferences.c13
-rw-r--r--src/preferences.h2
-rw-r--r--src/windows.c83
6 files changed, 82 insertions, 39 deletions
diff --git a/src/command.c b/src/command.c
index 55a44224..3252fdda 100644
--- a/src/command.c
+++ b/src/command.c
@@ -71,6 +71,7 @@ static gboolean _cmd_tiny(const char * const inp, struct cmd_help_t help);
 static gboolean _cmd_close(const char * const inp, struct cmd_help_t help);
 static gboolean _cmd_set_beep(const char * const inp, struct cmd_help_t help);
 static gboolean _cmd_set_notify(const char * const inp, struct cmd_help_t help);
+static gboolean _cmd_set_intype(const char * const inp, struct cmd_help_t help);
 static gboolean _cmd_set_flash(const char * const inp, struct cmd_help_t help);
 static gboolean _cmd_set_showsplash(const char * const inp, struct cmd_help_t help);
 static gboolean _cmd_set_chlog(const char * const inp, struct cmd_help_t help);
@@ -256,6 +257,17 @@ static struct cmd_t setting_commands[] =
           "Config file value :   flash=true|false",
           NULL } } },
 
+    { "/intype",
+        _cmd_set_intype,
+        { "/intype on|off", "Show when contact is typing.",
+        { "/intype on|off",
+          "--------------",
+          "Show when a contact is typing in the console, and in active message window.",
+          "",
+          "Config file section : [ui]",
+          "Config file value :   intype=true|false",
+          NULL } } },
+
     { "/showsplash",
         _cmd_set_showsplash,
         { "/showsplash on|off", "Splash logo on startup.",
@@ -942,6 +954,13 @@ _cmd_set_flash(const char * const inp, struct cmd_help_t help)
 }
 
 static gboolean
+_cmd_set_intype(const char * const inp, struct cmd_help_t help)
+{
+    return _cmd_set_boolean_preference(inp, help, "/intype",
+        "Show contact typing", prefs_set_intype);
+}
+
+static gboolean
 _cmd_set_showsplash(const char * const inp, struct cmd_help_t help)
 {
     return _cmd_set_boolean_preference(inp, help, "/showsplash",
diff --git a/src/input_win.c b/src/input_win.c
index 330b6443..724b3a25 100644
--- a/src/input_win.c
+++ b/src/input_win.c
@@ -362,6 +362,8 @@ _handle_edit(const int ch, char *input, int *size)
             cmd_help_complete);
         _parameter_autocomplete(input, size, "/beep",
             prefs_autocomplete_boolean_choice);
+        _parameter_autocomplete(input, size, "/intype",
+            prefs_autocomplete_boolean_choice);
         _parameter_autocomplete(input, size, "/flash",
             prefs_autocomplete_boolean_choice);
         _parameter_autocomplete(input, size, "/showsplash",
diff --git a/src/jabber.c b/src/jabber.c
index 9e1b2461..4913618e 100644
--- a/src/jabber.c
+++ b/src/jabber.c
@@ -290,7 +290,7 @@ _message_handler(xmpp_conn_t * const conn,
     // if no message, check for chatstates
     if (body == NULL) {
 
-        if (prefs_get_notify_typing()) {
+        if (prefs_get_notify_typing() || prefs_get_intype()) {
             if (xmpp_stanza_get_child_by_name(stanza, "active") != NULL) {
                 // active
             } else if (xmpp_stanza_get_child_by_name(stanza, "composing") != NULL) {
diff --git a/src/preferences.c b/src/preferences.c
index bc4f67f7..78044fcc 100644
--- a/src/preferences.c
+++ b/src/preferences.c
@@ -301,6 +301,19 @@ prefs_set_flash(gboolean value)
 }
 
 gboolean
+prefs_get_intype(void)
+{
+    return g_key_file_get_boolean(prefs, "ui", "intype", NULL);
+}
+
+void
+prefs_set_intype(gboolean value)
+{
+    g_key_file_set_boolean(prefs, "ui", "intype", value);
+    _save_prefs();
+}
+
+gboolean
 prefs_get_chlog(void)
 {
     return g_key_file_get_boolean(prefs, "ui", "chlog", NULL);
diff --git a/src/preferences.h b/src/preferences.h
index 223b8b8e..6ccdf461 100644
--- a/src/preferences.h
+++ b/src/preferences.h
@@ -54,6 +54,8 @@ gboolean prefs_get_showsplash(void);
 void prefs_set_showsplash(gboolean value);
 gboolean prefs_get_vercheck(void);
 void prefs_set_vercheck(gboolean value);
+gboolean prefs_get_intype(void);
+void prefs_set_intype(gboolean value);
 
 void prefs_set_notify_message(gboolean value);
 gboolean prefs_get_notify_message(void);
diff --git a/src/windows.c b/src/windows.c
index dff982ca..b7486c92 100644
--- a/src/windows.c
+++ b/src/windows.c
@@ -222,23 +222,25 @@ win_show_typing(const char * const from)
 
     int win_index = _find_prof_win_index(short_from);
 
-    // no chat window for user
-    if (win_index == NUM_WINS) {
-        _cons_show_typing(short_from);
-
-    // have chat window but not currently in it
-    } else if (win_index != _curr_prof_win) {
-        _cons_show_typing(short_from);
-        dirty = TRUE;
+    if (prefs_get_intype()) {
+        // no chat window for user
+        if (win_index == NUM_WINS) {
+            _cons_show_typing(short_from);
+
+        // have chat window but not currently in it
+        } else if (win_index != _curr_prof_win) {
+            _cons_show_typing(short_from);
+            dirty = TRUE;
 
-    // in chat window with user
-    } else {
-        title_bar_set_typing(TRUE);
-        title_bar_draw();
+        // in chat window with user
+        } else {
+            title_bar_set_typing(TRUE);
+            title_bar_draw();
 
-        status_bar_active(win_index);
-        dirty = TRUE;
-   }
+            status_bar_active(win_index);
+            dirty = TRUE;
+       }
+    }
 
 #ifdef HAVE_LIBNOTIFY
     if (prefs_get_notify_typing())
@@ -509,52 +511,57 @@ cons_prefs(void)
     cons_show("");
 
     if (prefs_get_beep())
-        cons_show("Terminal beep           : ON");
+        cons_show("Terminal beep                : ON");
     else
-        cons_show("Terminal beep           : OFF");
+        cons_show("Terminal beep                : OFF");
 
     if (prefs_get_flash())
-        cons_show("Terminal flash          : ON");
+        cons_show("Terminal flash               : ON");
     else
-        cons_show("Terminal flash          : OFF");
+        cons_show("Terminal flash               : OFF");
 
-    if (prefs_get_notify_message())
-        cons_show("Message notifications   : ON");
+    if (prefs_get_intype())
+        cons_show("Show typing                  : ON");
     else
-        cons_show("Message notifications   : OFF");
-
-    if (prefs_get_notify_typing())
-        cons_show("Typing notifications    : ON");
-    else
-        cons_show("Typing notifications    : OFF");
+        cons_show("Show typing                  : OFF");
 
     if (prefs_get_showsplash())
-        cons_show("Splash screen           : ON");
+        cons_show("Splash screen                : ON");
     else
-        cons_show("Splash screen           : OFF");
+        cons_show("Splash screen                : OFF");
 
     if (prefs_get_chlog())
-        cons_show("Chat logging            : ON");
+        cons_show("Chat logging                 : ON");
     else
-        cons_show("Chat logging            : OFF");
+        cons_show("Chat logging                 : OFF");
 
     if (prefs_get_history())
-        cons_show("Chat history            : ON");
+        cons_show("Chat history                 : ON");
     else
-        cons_show("Chat history            : OFF");
+        cons_show("Chat history                 : OFF");
 
     if (prefs_get_vercheck())
-        cons_show("Version checking        : ON");
+        cons_show("Version checking             : ON");
+    else
+        cons_show("Version checking             : OFF");
+
+    if (prefs_get_notify_message())
+        cons_show("Message notifications        : ON");
+    else
+        cons_show("Message notifications        : OFF");
+
+    if (prefs_get_notify_typing())
+        cons_show("Typing notifications         : ON");
     else
-        cons_show("Version checking        : OFF");
+        cons_show("Typing notifications         : OFF");
 
     gint remind_period = prefs_get_notify_remind();
     if (remind_period == 0) {
-        cons_show("Message reminder period : OFF");
+        cons_show("Reminder notification period : OFF");
     } else if (remind_period == 1) {
-        cons_show("Message reminder period : 1 second");
+        cons_show("Reminder notification period : 1 second");
     } else {
-        cons_show("Message reminder period : %d seconds", remind_period);
+        cons_show("Reminder notification period : %d seconds", remind_period);
     }
 
     cons_show("");