mirror of
https://github.com/irssi/irssi.git
synced 2026-08-17 23:52:22 +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)
|
||||
|
|
|
|||
|
|
@ -29,8 +29,8 @@
|
|||
|
||||
#include "notifylist.h"
|
||||
|
||||
#define DEFAULT_NOTIFY_CHECK_TIME 60
|
||||
#define DEFAULT_NOTIFY_WHOIS_TIME (60*5)
|
||||
#define DEFAULT_NOTIFY_CHECK_TIME "1min"
|
||||
#define DEFAULT_NOTIFY_WHOIS_TIME "5min"
|
||||
|
||||
typedef struct {
|
||||
char *nick;
|
||||
|
|
@ -321,15 +321,16 @@ static void event_ison(IRC_SERVER_REC *server, const char *data)
|
|||
static void read_settings(void)
|
||||
{
|
||||
if (notify_tag != -1) g_source_remove(notify_tag);
|
||||
notify_tag = g_timeout_add(1000*settings_get_int("notify_check_time"), (GSourceFunc) notifylist_timeout_func, NULL);
|
||||
notify_tag = g_timeout_add(settings_get_time("notify_check_time"),
|
||||
(GSourceFunc) notifylist_timeout_func, NULL);
|
||||
|
||||
notify_whois_time = settings_get_int("notify_whois_time");
|
||||
notify_whois_time = settings_get_time("notify_whois_time")/1000;
|
||||
}
|
||||
|
||||
void notifylist_ison_init(void)
|
||||
{
|
||||
settings_add_int("misc", "notify_check_time", DEFAULT_NOTIFY_CHECK_TIME);
|
||||
settings_add_int("misc", "notify_whois_time", DEFAULT_NOTIFY_WHOIS_TIME);
|
||||
settings_add_time("misc", "notify_check_time", DEFAULT_NOTIFY_CHECK_TIME);
|
||||
settings_add_time("misc", "notify_whois_time", DEFAULT_NOTIFY_WHOIS_TIME);
|
||||
|
||||
notify_tag = -1;
|
||||
read_settings();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue