diff --git a/src/chat_session.c b/src/chat_session.c index fe8660b5..cda51674 100644 --- a/src/chat_session.c +++ b/src/chat_session.c @@ -209,6 +209,7 @@ chat_session_set_active(const char * const recipient) log_error("No chat session found for %s.", recipient); } else { session->state = CHAT_STATE_ACTIVE; + g_timer_start(session->active_timer); session->sent = TRUE; } } diff --git a/src/command.c b/src/command.c index 956bd0e9..f5fe2177 100644 --- a/src/command.c +++ b/src/command.c @@ -95,6 +95,7 @@ static gboolean _cmd_set_showsplash(const char * const inp, struct cmd_help_t he static gboolean _cmd_set_chlog(const char * const inp, struct cmd_help_t help); static gboolean _cmd_set_history(const char * const inp, struct cmd_help_t help); static gboolean _cmd_set_states(const char * const inp, struct cmd_help_t help); +static gboolean _cmd_set_outtype(const char * const inp, struct cmd_help_t help); static gboolean _cmd_vercheck(const char * const inp, struct cmd_help_t help); static gboolean _cmd_away(const char * const inp, struct cmd_help_t help); static gboolean _cmd_online(const char * const inp, struct cmd_help_t help); @@ -351,6 +352,17 @@ static struct cmd_t setting_commands[] = "Config file value : states=true|false", NULL } } }, + { "/outtype", + _cmd_set_outtype, + { "/outtype on|off", "Send typing notification to recipient.", + { "/outtype on|off", + "--------------", + "Send an indication that you are typing to the other person in chat.", + "Chat states must be enabled for this to work, see the /states command.", + "", + "Config file section : [ui]", + "Config file value : outtype=true|false", + NULL } } }, { "/history", _cmd_set_history, @@ -658,6 +670,10 @@ _cmd_complete_parameters(char *input, int *size) prefs_autocomplete_boolean_choice); _parameter_autocomplete(input, size, "/intype", prefs_autocomplete_boolean_choice); + _parameter_autocomplete(input, size, "/states", + prefs_autocomplete_boolean_choice); + _parameter_autocomplete(input, size, "/outtype", + prefs_autocomplete_boolean_choice); _parameter_autocomplete(input, size, "/flash", prefs_autocomplete_boolean_choice); _parameter_autocomplete(input, size, "/showsplash", @@ -1044,6 +1060,13 @@ _cmd_set_states(const char * const inp, struct cmd_help_t help) "Sending chat states", prefs_set_states); } +static gboolean +_cmd_set_outtype(const char * const inp, struct cmd_help_t help) +{ + return _cmd_set_boolean_preference(inp, help, "/outtype", + "Sending typing notifications", prefs_set_outtype); +} + static gboolean _cmd_set_notify(const char * const inp, struct cmd_help_t help) { diff --git a/src/input_win.c b/src/input_win.c index 73720a9d..759b857e 100644 --- a/src/input_win.c +++ b/src/input_win.c @@ -152,7 +152,8 @@ inp_get_char(int *ch, char *input, int *size) } else if (chat_session_is_inactive(recipient) && !chat_session_get_sent(recipient)) { jabber_send_inactive(recipient); - } else if (chat_session_is_paused(recipient) && + } else if (prefs_get_outtype() && + chat_session_is_paused(recipient) && !chat_session_get_sent(recipient)) { jabber_send_paused(recipient); } @@ -160,14 +161,12 @@ inp_get_char(int *ch, char *input, int *size) } // if got char and in chat window, chat session active - if (*ch != ERR) { - if (win_in_chat()) { - char *recipient = win_get_recipient(); - chat_session_set_composing(recipient); - if (!chat_session_get_sent(recipient) || - chat_session_is_paused(recipient)) { - jabber_send_composing(recipient); - } + if (prefs_get_outtype() && (*ch != ERR) && win_in_chat()) { + char *recipient = win_get_recipient(); + chat_session_set_composing(recipient); + if (!chat_session_get_sent(recipient) || + chat_session_is_paused(recipient)) { + jabber_send_composing(recipient); } } } diff --git a/src/preferences.c b/src/preferences.c index b1e2f0a0..1cde801a 100644 --- a/src/preferences.c +++ b/src/preferences.c @@ -248,6 +248,19 @@ prefs_set_states(gboolean value) _save_prefs(); } +gboolean +prefs_get_outtype(void) +{ + return g_key_file_get_boolean(prefs, "ui", "outtype", NULL); +} + +void +prefs_set_outtype(gboolean value) +{ + g_key_file_set_boolean(prefs, "ui", "outtype", value); + _save_prefs(); +} + gboolean prefs_get_notify_typing(void) { diff --git a/src/preferences.h b/src/preferences.h index 31f352cb..e2975c51 100644 --- a/src/preferences.h +++ b/src/preferences.h @@ -58,6 +58,8 @@ gboolean prefs_get_intype(void); void prefs_set_intype(gboolean value); gboolean prefs_get_states(void); void prefs_set_states(gboolean value); +gboolean prefs_get_outtype(void); +void prefs_set_outtype(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 5f3fad1e..792c4556 100644 --- a/src/windows.c +++ b/src/windows.c @@ -557,6 +557,11 @@ cons_prefs(void) else cons_show("Send chat states : OFF"); + if (prefs_get_outtype()) + cons_show("Send typing notifications : ON"); + else + cons_show("Send typing notifications : OFF"); + if (prefs_get_history()) cons_show("Chat history : ON"); else