1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-11-03 19:37:16 -05:00

Added states preference to enable chat states

This commit is contained in:
James Booth 2012-10-31 21:41:00 +00:00
parent baced85767
commit 7982d7061b
4 changed files with 49 additions and 0 deletions

View File

@ -94,6 +94,7 @@ 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_showsplash(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_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_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);
@ -331,8 +332,26 @@ static struct cmd_t setting_commands[] =
"to myfriend@chatserv.com, the following chat log will be created:", "to myfriend@chatserv.com, the following chat log will be created:",
"", "",
" ~/.profanity/log/someuser_at_chatserv.com/myfriend_at_chatserv.com", " ~/.profanity/log/someuser_at_chatserv.com/myfriend_at_chatserv.com",
"",
"Config file section : [ui]",
"Config file value : chlog=true|false",
NULL } } }, NULL } } },
{ "/states",
_cmd_set_states,
{ "/states on|off", "Send chat states during a chat session.",
{ "/states on|off",
"--------------",
"Sending of chat state notifications during chat sessions.",
"Enabling this will send information about your activity during a chat",
"session with somebody, such as whether you have become inactive, or",
"have close the chat window.",
"",
"Config file section : [ui]",
"Config file value : states=true|false",
NULL } } },
{ "/history", { "/history",
_cmd_set_history, _cmd_set_history,
{ "/history on|off", "Chat history in message windows.", { "/history on|off", "Chat history in message windows.",
@ -343,6 +362,9 @@ static struct cmd_t setting_commands[] =
"The last day of messages are shown, or if you have had profanity open", "The last day of messages are shown, or if you have had profanity open",
"for more than a day, messages will be shown from the day which", "for more than a day, messages will be shown from the day which",
"you started profanity.", "you started profanity.",
"",
"Config file section : [ui]",
"Config file value : history=true|false",
NULL } } } NULL } } }
}; };
@ -1012,6 +1034,13 @@ _cmd_set_beep(const char * const inp, struct cmd_help_t help)
"Sound", prefs_set_beep); "Sound", prefs_set_beep);
} }
static gboolean
_cmd_set_states(const char * const inp, struct cmd_help_t help)
{
return _cmd_set_boolean_preference(inp, help, "/states",
"Sending chat states", prefs_set_states);
}
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

@ -235,6 +235,19 @@ prefs_set_beep(gboolean value)
_save_prefs(); _save_prefs();
} }
gboolean
prefs_get_states(void)
{
return g_key_file_get_boolean(prefs, "ui", "states", NULL);
}
void
prefs_set_states(gboolean value)
{
g_key_file_set_boolean(prefs, "ui", "states", value);
_save_prefs();
}
gboolean gboolean
prefs_get_notify_typing(void) prefs_get_notify_typing(void)
{ {

View File

@ -56,6 +56,8 @@ gboolean prefs_get_vercheck(void);
void prefs_set_vercheck(gboolean value); void prefs_set_vercheck(gboolean value);
gboolean prefs_get_intype(void); gboolean prefs_get_intype(void);
void prefs_set_intype(gboolean value); void prefs_set_intype(gboolean value);
gboolean prefs_get_states(void);
void prefs_set_states(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

@ -552,6 +552,11 @@ cons_prefs(void)
else else
cons_show("Chat logging : OFF"); cons_show("Chat logging : OFF");
if (prefs_get_states())
cons_show("Send chat states : ON");
else
cons_show("Send chat states : OFF");
if (prefs_get_history()) if (prefs_get_history())
cons_show("Chat history : ON"); cons_show("Chat history : ON");
else else