1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-12-04 14:46:46 -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_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_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);
@ -331,8 +332,26 @@ static struct cmd_t setting_commands[] =
"to myfriend@chatserv.com, the following chat log will be created:",
"",
" ~/.profanity/log/someuser_at_chatserv.com/myfriend_at_chatserv.com",
"",
"Config file section : [ui]",
"Config file value : chlog=true|false",
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",
_cmd_set_history,
{ "/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",
"for more than a day, messages will be shown from the day which",
"you started profanity.",
"",
"Config file section : [ui]",
"Config file value : history=true|false",
NULL } } }
};
@ -1012,6 +1034,13 @@ _cmd_set_beep(const char * const inp, struct cmd_help_t help)
"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
_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();
}
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
prefs_get_notify_typing(void)
{

View File

@ -56,6 +56,8 @@ gboolean prefs_get_vercheck(void);
void prefs_set_vercheck(gboolean value);
gboolean prefs_get_intype(void);
void prefs_set_intype(gboolean value);
gboolean prefs_get_states(void);
void prefs_set_states(gboolean value);
void prefs_set_notify_message(gboolean value);
gboolean prefs_get_notify_message(void);

View File

@ -552,6 +552,11 @@ cons_prefs(void)
else
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())
cons_show("Chat history : ON");
else