summaryrefslogtreecommitdiff
path: root/src/irc/notifylist/notify-commands.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/irc/notifylist/notify-commands.c')
-rw-r--r--src/irc/notifylist/notify-commands.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/irc/notifylist/notify-commands.c b/src/irc/notifylist/notify-commands.c
index c51f33f3..1fb485e3 100644
--- a/src/irc/notifylist/notify-commands.c
+++ b/src/irc/notifylist/notify-commands.c
@@ -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)