mirror of
https://git.jabber.space/devs/cproof.git
synced 2026-07-19 11:06:21 +00:00
Added settings for message notifications in current window
This commit is contained in:
@@ -469,14 +469,18 @@ static struct cmd_t command_defs[] =
|
||||
|
||||
{ "/notify",
|
||||
cmd_notify, parse_args, 2, 3, &cons_notify_setting,
|
||||
{ "/notify [type value]", "Control various desktop noficiations.",
|
||||
{ "/notify [type value]",
|
||||
"--------------------",
|
||||
{ "/notify [type value]|[type setting value]", "Control various desktop noficiations.",
|
||||
{ "/notify [type value]|[type setting value]",
|
||||
"-----------------------------------------",
|
||||
"Settings for various desktop notifications where type is one of:",
|
||||
"message : Notificaitons for regular messages.",
|
||||
" : on|off",
|
||||
"message current : Whether messages in the current window trigger notifications.",
|
||||
" : on|off",
|
||||
"room : Notificaitons for chat room messages.",
|
||||
" : on|off|mention",
|
||||
"room current : Whether chat room messages in the current window trigger notifications.",
|
||||
" : on|off",
|
||||
"remind : Notification reminders of unread messages.",
|
||||
" : where value is the reminder period in seconds,",
|
||||
" : use 0 to disable.",
|
||||
@@ -487,12 +491,13 @@ static struct cmd_t command_defs[] =
|
||||
"sub : Notifications for subscription requests.",
|
||||
" : on|off",
|
||||
"",
|
||||
"Example : /notify message on (enable message notifications)",
|
||||
"Example : /notify room mention (enable chat room notifications only on mention)",
|
||||
"Example : /notify remind 10 (remind every 10 seconds)",
|
||||
"Example : /notify remind 0 (switch off reminders)",
|
||||
"Example : /notify typing on (enable typing notifications)",
|
||||
"Example : /notify invite on (enable chat room invite notifications)",
|
||||
"Example : /notify message on (enable message notifications)",
|
||||
"Example : /notify room mention (enable chat room notifications only on mention)",
|
||||
"Example : /notify room current off (disable room message notifications when window visible)",
|
||||
"Example : /notify remind 10 (remind every 10 seconds)",
|
||||
"Example : /notify remind 0 (switch off reminders)",
|
||||
"Example : /notify typing on (enable typing notifications)",
|
||||
"Example : /notify invite on (enable chat room invite notifications)",
|
||||
NULL } } },
|
||||
|
||||
{ "/flash",
|
||||
@@ -878,6 +883,7 @@ static Autocomplete who_ac;
|
||||
static Autocomplete help_ac;
|
||||
static Autocomplete notify_ac;
|
||||
static Autocomplete notify_room_ac;
|
||||
static Autocomplete notify_message_ac;
|
||||
static Autocomplete prefs_ac;
|
||||
static Autocomplete sub_ac;
|
||||
static Autocomplete log_ac;
|
||||
@@ -974,10 +980,16 @@ cmd_init(void)
|
||||
autocomplete_add(notify_ac, "invite");
|
||||
autocomplete_add(notify_ac, "sub");
|
||||
|
||||
notify_message_ac = autocomplete_new();
|
||||
autocomplete_add(notify_message_ac, "on");
|
||||
autocomplete_add(notify_message_ac, "off");
|
||||
autocomplete_add(notify_message_ac, "current");
|
||||
|
||||
notify_room_ac = autocomplete_new();
|
||||
autocomplete_add(notify_room_ac, "on");
|
||||
autocomplete_add(notify_room_ac, "off");
|
||||
autocomplete_add(notify_room_ac, "mention");
|
||||
autocomplete_add(notify_room_ac, "current");
|
||||
|
||||
sub_ac = autocomplete_new();
|
||||
autocomplete_add(sub_ac, "request");
|
||||
@@ -1153,6 +1165,7 @@ cmd_uninit(void)
|
||||
autocomplete_free(who_ac);
|
||||
autocomplete_free(help_ac);
|
||||
autocomplete_free(notify_ac);
|
||||
autocomplete_free(notify_message_ac);
|
||||
autocomplete_free(notify_room_ac);
|
||||
autocomplete_free(sub_ac);
|
||||
autocomplete_free(titlebar_ac);
|
||||
@@ -1266,6 +1279,7 @@ cmd_reset_autocomplete()
|
||||
presence_reset_sub_request_search();
|
||||
autocomplete_reset(help_ac);
|
||||
autocomplete_reset(notify_ac);
|
||||
autocomplete_reset(notify_message_ac);
|
||||
autocomplete_reset(notify_room_ac);
|
||||
autocomplete_reset(sub_ac);
|
||||
|
||||
@@ -1782,13 +1796,27 @@ _notify_autocomplete(char *input, int *size)
|
||||
int i = 0;
|
||||
char *result = NULL;
|
||||
|
||||
result = autocomplete_param_with_func(input, size, "/notify room current", prefs_autocomplete_boolean_choice);
|
||||
if (result != NULL) {
|
||||
return result;
|
||||
}
|
||||
|
||||
result = autocomplete_param_with_func(input, size, "/notify message current", prefs_autocomplete_boolean_choice);
|
||||
if (result != NULL) {
|
||||
return result;
|
||||
}
|
||||
|
||||
result = autocomplete_param_with_ac(input, size, "/notify room", notify_room_ac);
|
||||
if (result != NULL) {
|
||||
return result;
|
||||
}
|
||||
|
||||
gchar *boolean_choices[] = { "/notify message", "/notify typing",
|
||||
"/notify invite", "/notify sub" };
|
||||
result = autocomplete_param_with_ac(input, size, "/notify message", notify_message_ac);
|
||||
if (result != NULL) {
|
||||
return result;
|
||||
}
|
||||
|
||||
gchar *boolean_choices[] = { "/notify typing", "/notify invite", "/notify sub" };
|
||||
for (i = 0; i < ARRAY_SIZE(boolean_choices); i++) {
|
||||
result = autocomplete_param_with_func(input, size, boolean_choices[i],
|
||||
prefs_autocomplete_boolean_choice);
|
||||
|
||||
Reference in New Issue
Block a user