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

added showsplash command

This commit is contained in:
Dolan O'Toole 2012-06-03 23:02:13 +01:00
parent 4dbf4ff099
commit d91175e5c2
3 changed files with 31 additions and 0 deletions

View File

@ -44,6 +44,7 @@ static gboolean _cmd_msg(const char * const inp);
static gboolean _cmd_close(const char * const inp);
static gboolean _cmd_set_beep(const char * const inp);
static gboolean _cmd_set_flash(const char * const inp);
static gboolean _cmd_set_showsplash(const char * const inp);
static gboolean _cmd_away(const char * const inp);
static gboolean _cmd_online(const char * const inp);
static gboolean _cmd_dnd(const char * const inp);
@ -107,6 +108,8 @@ static gboolean _handle_command(const char * const command, const char * const i
result = _cmd_set_beep(inp);
} else if (strcmp(command, "/flash") == 0) {
result = _cmd_set_flash(inp);
} else if (strcmp(command, "/showsplash") == 0) {
result = _cmd_set_showsplash(inp);
} else if (strcmp(command, "/away") == 0) {
result = _cmd_away(inp);
} else if (strcmp(command, "/online") == 0) {
@ -267,6 +270,21 @@ static gboolean _cmd_set_flash(const char * const inp)
return TRUE;
}
static gboolean _cmd_set_showsplash(const char * const inp)
{
if (strcmp(inp, "/showsplash on") == 0) {
cons_show("Splash screen enabled.");
prefs_set_showsplash(TRUE);
} else if (strcmp(inp, "/showsplash off") == 0) {
cons_show("Splash screen disabled.");
prefs_set_showsplash(FALSE);
} else {
cons_show("Usage: /showsplash <on/off>");
}
return TRUE;
}
static gboolean _cmd_away(const char * const inp)
{
_update_presence(PRESENCE_AWAY, "away", inp);

View File

@ -129,6 +129,17 @@ void prefs_add_login(const char *jid)
}
}
gboolean prefs_get_showsplash(void)
{
return g_key_file_get_boolean(prefs, "ui", "showsplash", NULL);
}
void prefs_set_showsplash(gboolean value)
{
g_key_file_set_boolean(prefs, "ui", "showsplash", value);
_save_prefs();
}
static void _save_prefs(void)
{
gsize g_data_size;

View File

@ -35,5 +35,7 @@ void prefs_set_beep(gboolean value);
gboolean prefs_get_flash(void);
void prefs_set_flash(gboolean value);
void prefs_add_login(const char *jid);
gboolean prefs_get_showsplash(void);
void prefs_set_showsplash(gboolean value);
#endif