mirror of
https://git.jabber.space/devs/cproof.git
synced 2026-07-30 15:46:21 +00:00
Added notify preference
This commit is contained in:
17
command.c
17
command.c
@@ -44,6 +44,7 @@ static gboolean _cmd_connect(const char * const inp);
|
|||||||
static gboolean _cmd_msg(const char * const inp);
|
static gboolean _cmd_msg(const char * const inp);
|
||||||
static gboolean _cmd_close(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_beep(const char * const inp);
|
||||||
|
static gboolean _cmd_set_notify(const char * const inp);
|
||||||
static gboolean _cmd_set_flash(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_set_showsplash(const char * const inp);
|
||||||
static gboolean _cmd_away(const char * const inp);
|
static gboolean _cmd_away(const char * const inp);
|
||||||
@@ -65,6 +66,7 @@ static PAutocomplete commands_ac;
|
|||||||
static struct cmd_t commands[] = {
|
static struct cmd_t commands[] = {
|
||||||
{ "/away", _cmd_away },
|
{ "/away", _cmd_away },
|
||||||
{ "/beep", _cmd_set_beep },
|
{ "/beep", _cmd_set_beep },
|
||||||
|
{ "/notify", _cmd_set_notify },
|
||||||
{ "/chat", _cmd_chat },
|
{ "/chat", _cmd_chat },
|
||||||
{ "/close", _cmd_close },
|
{ "/close", _cmd_close },
|
||||||
{ "/connect", _cmd_connect },
|
{ "/connect", _cmd_connect },
|
||||||
@@ -273,6 +275,21 @@ static gboolean _cmd_set_beep(const char * const inp)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static gboolean _cmd_set_notify(const char * const inp)
|
||||||
|
{
|
||||||
|
if (strcmp(inp, "/notify on") == 0) {
|
||||||
|
cons_show("Desktop notifications enabled.");
|
||||||
|
prefs_set_notify(TRUE);
|
||||||
|
} else if (strcmp(inp, "/notify off") == 0) {
|
||||||
|
cons_show("Desktop notifications disabled.");
|
||||||
|
prefs_set_notify(FALSE);
|
||||||
|
} else {
|
||||||
|
cons_show("Usage: /notify <on/off>");
|
||||||
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
static gboolean _cmd_set_flash(const char * const inp)
|
static gboolean _cmd_set_flash(const char * const inp)
|
||||||
{
|
{
|
||||||
if (strcmp(inp, "/flash on") == 0) {
|
if (strcmp(inp, "/flash on") == 0) {
|
||||||
|
|||||||
@@ -173,6 +173,17 @@ void prefs_set_beep(gboolean value)
|
|||||||
_save_prefs();
|
_save_prefs();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gboolean prefs_get_notify(void)
|
||||||
|
{
|
||||||
|
return g_key_file_get_boolean(prefs, "ui", "notify", NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
void prefs_set_notify(gboolean value)
|
||||||
|
{
|
||||||
|
g_key_file_set_boolean(prefs, "ui", "notify", value);
|
||||||
|
_save_prefs();
|
||||||
|
}
|
||||||
|
|
||||||
gboolean prefs_get_flash(void)
|
gboolean prefs_get_flash(void)
|
||||||
{
|
{
|
||||||
return g_key_file_get_boolean(prefs, "ui", "flash", NULL);
|
return g_key_file_get_boolean(prefs, "ui", "flash", NULL);
|
||||||
|
|||||||
@@ -32,6 +32,8 @@ void reset_login_search(void);
|
|||||||
|
|
||||||
gboolean prefs_get_beep(void);
|
gboolean prefs_get_beep(void);
|
||||||
void prefs_set_beep(gboolean value);
|
void prefs_set_beep(gboolean value);
|
||||||
|
gboolean prefs_get_notify(void);
|
||||||
|
void prefs_set_notify(gboolean value);
|
||||||
gboolean prefs_get_flash(void);
|
gboolean prefs_get_flash(void);
|
||||||
void prefs_set_flash(gboolean value);
|
void prefs_set_flash(gboolean value);
|
||||||
void prefs_add_login(const char *jid);
|
void prefs_add_login(const char *jid);
|
||||||
|
|||||||
@@ -189,11 +189,12 @@ void win_show_incomming_msg(const char * const from, const char * const message)
|
|||||||
if (prefs_get_flash())
|
if (prefs_get_flash())
|
||||||
flash();
|
flash();
|
||||||
|
|
||||||
_win_notify(short_from);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (prefs_get_beep())
|
if (prefs_get_beep())
|
||||||
beep();
|
beep();
|
||||||
|
if (prefs_get_notify())
|
||||||
|
_win_notify(short_from);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void _win_notify(char * short_from)
|
static void _win_notify(char * short_from)
|
||||||
@@ -305,6 +306,7 @@ void cons_help(void)
|
|||||||
cons_show("Settings:");
|
cons_show("Settings:");
|
||||||
cons_show("");
|
cons_show("");
|
||||||
cons_show("/beep <on/off> : Enable/disable sound notification");
|
cons_show("/beep <on/off> : Enable/disable sound notification");
|
||||||
|
cons_show("/notify <on/off> : Enable/disable desktop notifications");
|
||||||
cons_show("/flash <on/off> : Enable/disable screen flash notification");
|
cons_show("/flash <on/off> : Enable/disable screen flash notification");
|
||||||
cons_show("/showsplash <on/off> : Enable/disable splash logo on startup");
|
cons_show("/showsplash <on/off> : Enable/disable splash logo on startup");
|
||||||
cons_show("");
|
cons_show("");
|
||||||
|
|||||||
Reference in New Issue
Block a user