mirror of
https://github.com/profanity-im/profanity.git
synced 2024-11-03 19:37:16 -05:00
Added beep setting command
This commit is contained in:
parent
5572bbdf15
commit
b3ae1a7d12
16
command.c
16
command.c
@ -38,6 +38,7 @@ static int _cmd_ros(void);
|
||||
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_default(const char * const inp);
|
||||
|
||||
int process_input(char *inp)
|
||||
@ -84,6 +85,8 @@ static int _handle_command(const char * const command, const char * const inp)
|
||||
result = _cmd_close(inp);
|
||||
} else if (strcmp(command, "/connect") == 0) {
|
||||
result = _cmd_connect(inp);
|
||||
} else if (strcmp(command, "/beep") == 0) {
|
||||
result = _cmd_set_beep(inp);
|
||||
} else {
|
||||
result = _cmd_default(inp);
|
||||
}
|
||||
@ -204,6 +207,19 @@ static int _cmd_close(const char * const inp)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static int _cmd_set_beep(const char * const inp)
|
||||
{
|
||||
if (strcmp(inp, "/beep on") == 0) {
|
||||
win_set_beep(TRUE);
|
||||
} else if (strcmp(inp, "/beep off") == 0) {
|
||||
win_set_beep(FALSE);
|
||||
} else {
|
||||
cons_show("Usage: /beep <on/off>");
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static int _cmd_default(const char * const inp)
|
||||
{
|
||||
if (win_in_chat()) {
|
||||
|
12
windows.c
12
windows.c
@ -45,6 +45,9 @@ static int dirty;
|
||||
// max columns for main windows, never resize below
|
||||
static int max_cols = 0;
|
||||
|
||||
// allow beep?
|
||||
static int do_beep = TRUE;
|
||||
|
||||
static void _create_windows(void);
|
||||
static int _find_prof_win_index(const char * const contact);
|
||||
static int _new_prof_win(const char * const contact);
|
||||
@ -149,6 +152,11 @@ int win_in_chat(void)
|
||||
(strcmp(_wins[_curr_prof_win].from, "") != 0));
|
||||
}
|
||||
|
||||
void win_set_beep(int val)
|
||||
{
|
||||
do_beep = val;
|
||||
}
|
||||
|
||||
char *win_get_recipient(void)
|
||||
{
|
||||
struct prof_win current = _wins[_curr_prof_win];
|
||||
@ -180,7 +188,8 @@ void win_show_incomming_msg(const char * const from, const char * const message)
|
||||
_cons_show_incoming_message(short_from, win_index);
|
||||
}
|
||||
|
||||
beep();
|
||||
if (do_beep == TRUE)
|
||||
beep();
|
||||
}
|
||||
|
||||
void win_show_outgoing_msg(const char * const from, const char * const to,
|
||||
@ -264,6 +273,7 @@ void cons_help(void)
|
||||
cons_show("/msg user@host mesg : Send mesg to user.");
|
||||
cons_show("/who : Find out who is online.");
|
||||
cons_show("/ros : List all contacts.");
|
||||
cons_show("/beep <on/off> : Enable/disable sound notification");
|
||||
cons_show("/close : Close a chat window.");
|
||||
cons_show("/quit : Quit Profanity.");
|
||||
cons_show("");
|
||||
|
@ -67,6 +67,7 @@ void win_contact_online(const char * const from, const char * const show,
|
||||
void win_contact_offline(const char * const from, const char * const show,
|
||||
const char * const status);
|
||||
void win_disconnected(void);
|
||||
void win_set_beep(int val);
|
||||
|
||||
// console window actions
|
||||
void cons_help(void);
|
||||
|
Loading…
Reference in New Issue
Block a user