mirror of
https://github.com/irssi/irssi.git
synced 2026-08-19 08:32:07 +02:00
Added time, size and level setting types. Breaks some settings - I'll add
automatic converter to these settings later. Meanwhile you CVS users can fix your config files yourself :) Time settings allow using "days", "hours", "minutes", "seconds" and "milliseconds" or several of their abbreviations. For example "5d 4h 5msecs". Size settings allow using "gbytes", "mbytes", "kbytes" and "bytes" or their abbrevations. For example "5MB". Level settings are currently handled pretty much the way they were before. git-svn-id: http://svn.irssi.org/repos/irssi/trunk@3080 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
parent
9c18cb00e7
commit
bd6fe052bc
35 changed files with 526 additions and 186 deletions
|
|
@ -26,9 +26,7 @@
|
|||
|
||||
#include "notifylist.h"
|
||||
|
||||
#define DEFAULT_NOTIFY_IDLE_TIME 60
|
||||
|
||||
/* SYNTAX: NOTIFY [-away] [-idle [<minutes>]] <mask> [<ircnets>] */
|
||||
/* SYNTAX: NOTIFY [-away] [-idle [<time>]] <mask> [<ircnets>] */
|
||||
static void cmd_notify(gchar *data)
|
||||
{
|
||||
GHashTable *optlist;
|
||||
|
|
@ -46,14 +44,16 @@ static void cmd_notify(gchar *data)
|
|||
idletime = g_hash_table_lookup(optlist, "idle");
|
||||
if (idletime == NULL)
|
||||
idle_check_time = 0;
|
||||
else if (*idletime == '\0')
|
||||
idle_check_time = settings_get_time("notify_idle_time");
|
||||
else {
|
||||
idle_check_time = is_numeric(idletime, 0) ? (atoi(idletime)*60) :
|
||||
(settings_get_int("notify_idle_time")*60);
|
||||
if (!parse_time_interval(idletime, &idle_check_time))
|
||||
cmd_return_error(CMDERR_INVALID_TIME);
|
||||
}
|
||||
|
||||
away_check = g_hash_table_lookup(optlist, "away") != NULL;
|
||||
notifylist_remove(mask);
|
||||
notifylist_add(mask, ircnets, away_check, idle_check_time);
|
||||
notifylist_add(mask, ircnets, away_check, idle_check_time/1000);
|
||||
|
||||
cmd_params_free(free_arg);
|
||||
}
|
||||
|
|
@ -77,11 +77,11 @@ static void cmd_unnotify(const char *data)
|
|||
|
||||
void notifylist_commands_init(void)
|
||||
{
|
||||
settings_add_int("misc", "notify_idle_time", DEFAULT_NOTIFY_IDLE_TIME);
|
||||
settings_add_time("misc", "notify_idle_time", "hour");
|
||||
command_bind("notify", NULL, (SIGNAL_FUNC) cmd_notify);
|
||||
command_bind("unnotify", NULL, (SIGNAL_FUNC) cmd_unnotify);
|
||||
|
||||
command_set_options("notify", "@idle away");
|
||||
command_set_options("notify", "-idle away");
|
||||
}
|
||||
|
||||
void notifylist_commands_deinit(void)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue