mirror of
https://github.com/profanity-im/profanity.git
synced 2024-12-04 14:46:46 -05:00
Add new command /statuses for status notifications
This commit is contained in:
parent
ba0438607c
commit
a0a1f9017f
@ -385,14 +385,11 @@ static struct cmd_t setting_commands[] =
|
|||||||
" : use 0 to disable.",
|
" : use 0 to disable.",
|
||||||
"typing : Notifications when contacts are typing.",
|
"typing : Notifications when contacts are typing.",
|
||||||
" : on|off",
|
" : on|off",
|
||||||
"status : Notifcations for status messages.",
|
|
||||||
" : on|off",
|
|
||||||
"",
|
"",
|
||||||
"Example : /notify message on (enable message notifications)",
|
"Example : /notify message on (enable message notifications)",
|
||||||
"Example : /notify remind 10 (remind every 10 seconds)",
|
"Example : /notify remind 10 (remind every 10 seconds)",
|
||||||
"Example : /notify remind 0 (switch off reminders)",
|
"Example : /notify remind 0 (switch off reminders)",
|
||||||
"Example : /notify typing on (enable typing notifications)",
|
"Example : /notify typing on (enable typing notifications)",
|
||||||
"Example : /notify status off (disable status notifications)",
|
|
||||||
NULL } } },
|
NULL } } },
|
||||||
|
|
||||||
{ "/flash",
|
{ "/flash",
|
||||||
@ -540,6 +537,15 @@ static struct cmd_t setting_commands[] =
|
|||||||
"---------------",
|
"---------------",
|
||||||
"Set priority for the current session.",
|
"Set priority for the current session.",
|
||||||
"value : Number between -128 and 127. Default value is 0.",
|
"value : Number between -128 and 127. Default value is 0.",
|
||||||
|
NULL } } },
|
||||||
|
|
||||||
|
{ "/statuses",
|
||||||
|
_cmd_set_statuses, parse_args, 1, 1,
|
||||||
|
{ "/statuses on|off", "Set notifications for status messages.",
|
||||||
|
{ "/statuses on|off",
|
||||||
|
"---------------",
|
||||||
|
"Set notifications for status messages, such as online/offline or join/part channels.",
|
||||||
|
"When notifications are off status messages, such as online/offline or join/part, are not displayed.",
|
||||||
NULL } } }
|
NULL } } }
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -1782,7 +1788,7 @@ _cmd_set_notify(gchar **args, struct cmd_help_t help)
|
|||||||
|
|
||||||
// bad kind
|
// bad kind
|
||||||
if ((strcmp(kind, "message") != 0) && (strcmp(kind, "typing") != 0) &&
|
if ((strcmp(kind, "message") != 0) && (strcmp(kind, "typing") != 0) &&
|
||||||
(strcmp(kind, "remind") != 0) && (strcmp(kind, "status") != 0)) {
|
(strcmp(kind, "remind") != 0)) {
|
||||||
cons_show("Usage: %s", help.usage);
|
cons_show("Usage: %s", help.usage);
|
||||||
|
|
||||||
// set message setting
|
// set message setting
|
||||||
@ -1821,18 +1827,6 @@ _cmd_set_notify(gchar **args, struct cmd_help_t help)
|
|||||||
cons_show("Message reminder period set to %d seconds.", period);
|
cons_show("Message reminder period set to %d seconds.", period);
|
||||||
}
|
}
|
||||||
|
|
||||||
// set status setting
|
|
||||||
} else if (strcmp(kind, "status") == 0) {
|
|
||||||
if (strcmp(value, "on") == 0) {
|
|
||||||
cons_show("Status notifications enabled.");
|
|
||||||
prefs_set_notify_status(TRUE);
|
|
||||||
} else if (strcmp(value, "off") == 0) {
|
|
||||||
cons_show("Status notifications disabled.");
|
|
||||||
prefs_set_notify_status(FALSE);
|
|
||||||
} else {
|
|
||||||
cons_show("Usage: /notify status on|off");
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
cons_show("Unknown command: %s.", kind);
|
cons_show("Unknown command: %s.", kind);
|
||||||
}
|
}
|
||||||
@ -1975,6 +1969,13 @@ _cmd_set_priority(gchar **args, struct cmd_help_t help)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
_cmd_set_statuses(gchar **args, struct cmd_help_t help)
|
||||||
|
{
|
||||||
|
return _cmd_set_boolean_preference(args[0], help,
|
||||||
|
"Status notifications", prefs_set_statuses);
|
||||||
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
_cmd_vercheck(gchar **args, struct cmd_help_t help)
|
_cmd_vercheck(gchar **args, struct cmd_help_t help)
|
||||||
{
|
{
|
||||||
|
@ -411,15 +411,15 @@ prefs_set_splash(gboolean value)
|
|||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
prefs_get_notify_status(void)
|
prefs_get_statuses(void)
|
||||||
{
|
{
|
||||||
return g_key_file_get_boolean(prefs, "notifications", "status", NULL);
|
return g_key_file_get_boolean(prefs, "ui", "statuses", NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
prefs_set_notify_status(gboolean value)
|
prefs_set_statuses(gboolean value)
|
||||||
{
|
{
|
||||||
g_key_file_set_boolean(prefs, "notifications", "status", value);
|
g_key_file_set_boolean(prefs, "ui", "statuses", value);
|
||||||
_save_prefs();
|
_save_prefs();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -68,6 +68,8 @@ gint prefs_get_gone(void);
|
|||||||
void prefs_set_gone(gint value);
|
void prefs_set_gone(gint value);
|
||||||
gchar * prefs_get_theme(void);
|
gchar * prefs_get_theme(void);
|
||||||
void prefs_set_theme(gchar *value);
|
void prefs_set_theme(gchar *value);
|
||||||
|
void prefs_set_statuses(gboolean value);
|
||||||
|
gboolean prefs_get_statuses(void);
|
||||||
|
|
||||||
void prefs_set_notify_message(gboolean value);
|
void prefs_set_notify_message(gboolean value);
|
||||||
gboolean prefs_get_notify_message(void);
|
gboolean prefs_get_notify_message(void);
|
||||||
@ -75,8 +77,6 @@ void prefs_set_notify_typing(gboolean value);
|
|||||||
gboolean prefs_get_notify_typing(void);
|
gboolean prefs_get_notify_typing(void);
|
||||||
void prefs_set_notify_remind(gint period);
|
void prefs_set_notify_remind(gint period);
|
||||||
gint prefs_get_notify_remind(void);
|
gint prefs_get_notify_remind(void);
|
||||||
void prefs_set_notify_status(gboolean value);
|
|
||||||
gboolean prefs_get_notify_status(void);
|
|
||||||
void prefs_set_max_log_size(gint value);
|
void prefs_set_max_log_size(gint value);
|
||||||
gint prefs_get_max_log_size(void);
|
gint prefs_get_max_log_size(void);
|
||||||
void prefs_set_priority(gint value);
|
void prefs_set_priority(gint value);
|
||||||
|
@ -1227,6 +1227,11 @@ cons_show_ui_prefs(void)
|
|||||||
cons_show("Version checking (/vercheck) : ON");
|
cons_show("Version checking (/vercheck) : ON");
|
||||||
else
|
else
|
||||||
cons_show("Version checking (/vercheck) : OFF");
|
cons_show("Version checking (/vercheck) : OFF");
|
||||||
|
|
||||||
|
if (prefs_get_statuses())
|
||||||
|
cons_show("Status (/statuses) : ON");
|
||||||
|
else
|
||||||
|
cons_show("Status (/statuses) : OFF");
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -1253,11 +1258,6 @@ cons_show_desktop_prefs(void)
|
|||||||
} else {
|
} else {
|
||||||
cons_show("Reminder period (/notify remind) : %d seconds", remind_period);
|
cons_show("Reminder period (/notify remind) : %d seconds", remind_period);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (prefs_get_notify_status())
|
|
||||||
cons_show("Status (/notify status) : ON");
|
|
||||||
else
|
|
||||||
cons_show("Status (/notify status) : OFF");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -1971,7 +1971,7 @@ _show_status_string(WINDOW *win, const char * const from,
|
|||||||
GDateTime *last_activity, const char * const pre,
|
GDateTime *last_activity, const char * const pre,
|
||||||
const char * const default_show)
|
const char * const default_show)
|
||||||
{
|
{
|
||||||
if (!prefs_get_notify_status())
|
if (!prefs_get_statuses())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
_win_show_time(win);
|
_win_show_time(win);
|
||||||
|
Loading…
Reference in New Issue
Block a user