Added flash notification and option

This commit is contained in:
James Booth
2012-04-24 01:39:23 +01:00
parent b3ae1a7d12
commit 1b7d9e9e26
4 changed files with 33 additions and 0 deletions

View File

@@ -39,6 +39,7 @@ static int _cmd_connect(const char * const inp);
static int _cmd_msg(const char * const inp);
static int _cmd_close(const char * const inp);
static int _cmd_set_beep(const char * const inp);
static int _cmd_set_flash(const char * const inp);
static int _cmd_default(const char * const inp);
int process_input(char *inp)
@@ -87,6 +88,8 @@ static int _handle_command(const char * const command, const char * const inp)
result = _cmd_connect(inp);
} else if (strcmp(command, "/beep") == 0) {
result = _cmd_set_beep(inp);
} else if (strcmp(command, "/flash") == 0) {
result = _cmd_set_flash(inp);
} else {
result = _cmd_default(inp);
}
@@ -210,8 +213,10 @@ static int _cmd_close(const char * const inp)
static int _cmd_set_beep(const char * const inp)
{
if (strcmp(inp, "/beep on") == 0) {
cons_show("Sound enabled.");
win_set_beep(TRUE);
} else if (strcmp(inp, "/beep off") == 0) {
cons_show("Sound disabled.");
win_set_beep(FALSE);
} else {
cons_show("Usage: /beep <on/off>");
@@ -220,6 +225,21 @@ static int _cmd_set_beep(const char * const inp)
return TRUE;
}
static int _cmd_set_flash(const char * const inp)
{
if (strcmp(inp, "/flash on") == 0) {
cons_show("Screen flash enabled.");
status_bar_set_flash(TRUE);
} else if (strcmp(inp, "/flash off") == 0) {
cons_show("Screen flash disabled.");
status_bar_set_flash(FALSE);
} else {
cons_show("Usage: /flash <on/off>");
}
return TRUE;
}
static int _cmd_default(const char * const inp)
{
if (win_in_chat()) {