1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-12-04 14:46:46 -05:00

Added a seperate option to enable outgoing typing notifications

This commit is contained in:
James Booth 2012-11-01 00:12:35 +00:00
parent 270ac03558
commit 4be7833e2b
6 changed files with 52 additions and 9 deletions

View File

@ -209,6 +209,7 @@ chat_session_set_active(const char * const recipient)
log_error("No chat session found for %s.", recipient); log_error("No chat session found for %s.", recipient);
} else { } else {
session->state = CHAT_STATE_ACTIVE; session->state = CHAT_STATE_ACTIVE;
g_timer_start(session->active_timer);
session->sent = TRUE; session->sent = TRUE;
} }
} }

View File

@ -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_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_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_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_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_away(const char * const inp, struct cmd_help_t help);
static gboolean _cmd_online(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", "Config file value : states=true|false",
NULL } } }, 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", { "/history",
_cmd_set_history, _cmd_set_history,
@ -658,6 +670,10 @@ _cmd_complete_parameters(char *input, int *size)
prefs_autocomplete_boolean_choice); prefs_autocomplete_boolean_choice);
_parameter_autocomplete(input, size, "/intype", _parameter_autocomplete(input, size, "/intype",
prefs_autocomplete_boolean_choice); 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", _parameter_autocomplete(input, size, "/flash",
prefs_autocomplete_boolean_choice); prefs_autocomplete_boolean_choice);
_parameter_autocomplete(input, size, "/showsplash", _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); "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 static gboolean
_cmd_set_notify(const char * const inp, struct cmd_help_t help) _cmd_set_notify(const char * const inp, struct cmd_help_t help)
{ {

View File

@ -152,7 +152,8 @@ inp_get_char(int *ch, char *input, int *size)
} else if (chat_session_is_inactive(recipient) && } else if (chat_session_is_inactive(recipient) &&
!chat_session_get_sent(recipient)) { !chat_session_get_sent(recipient)) {
jabber_send_inactive(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)) { !chat_session_get_sent(recipient)) {
jabber_send_paused(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 got char and in chat window, chat session active
if (*ch != ERR) { if (prefs_get_outtype() && (*ch != ERR) && win_in_chat()) {
if (win_in_chat()) { char *recipient = win_get_recipient();
char *recipient = win_get_recipient(); chat_session_set_composing(recipient);
chat_session_set_composing(recipient); if (!chat_session_get_sent(recipient) ||
if (!chat_session_get_sent(recipient) || chat_session_is_paused(recipient)) {
chat_session_is_paused(recipient)) { jabber_send_composing(recipient);
jabber_send_composing(recipient);
}
} }
} }
} }

View File

@ -248,6 +248,19 @@ prefs_set_states(gboolean value)
_save_prefs(); _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 gboolean
prefs_get_notify_typing(void) prefs_get_notify_typing(void)
{ {

View File

@ -58,6 +58,8 @@ gboolean prefs_get_intype(void);
void prefs_set_intype(gboolean value); void prefs_set_intype(gboolean value);
gboolean prefs_get_states(void); gboolean prefs_get_states(void);
void prefs_set_states(gboolean value); void prefs_set_states(gboolean value);
gboolean prefs_get_outtype(void);
void prefs_set_outtype(gboolean value);
void prefs_set_notify_message(gboolean value); void prefs_set_notify_message(gboolean value);
gboolean prefs_get_notify_message(void); gboolean prefs_get_notify_message(void);

View File

@ -557,6 +557,11 @@ cons_prefs(void)
else else
cons_show("Send chat states : OFF"); 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()) if (prefs_get_history())
cons_show("Chat history : ON"); cons_show("Chat history : ON");
else else