auto-away: when time limit set to <30, still register the client limit hooks instead...
authorJoe Bormolini <j.bormolini@gmail.com>
Tue, 10 Aug 2010 15:41:32 +0000 (08:41 -0700)
committerJoe Bormolini <j.bormolini@gmail.com>
Tue, 10 Aug 2010 15:41:32 +0000 (08:41 -0700)
src/auto_away.c

index ee60f40..aa479c0 100644 (file)
@@ -114,13 +114,11 @@ void auto_away_add(struct global *global, struct auto_away_config *config)
        d->config = config;
        d->last_message = time(NULL);
        d->max_idle_time = config->max_idle_time != -1?config->max_idle_time:AUTO_AWAY_DEFAULT_TIME;
-       if (d->max_idle_time < 30) {
-               log_global(LOG_WARNING, "Ignoring auto-away time %d because it is too low", d->max_idle_time);
-               g_free(d);
-               return;
-       }
-       d->timeout_id = g_timeout_add(1000, check_time, d);
        d->global = global;
+       if (d->max_idle_time >= 30)
+               d->timeout_id = g_timeout_add(1000, check_time, d);
+       else
+               log_global(LOG_WARNING, "Ignoring auto-away time %d because it is too low", d->max_idle_time);
        add_new_client_hook("auto-away", new_client, d);
        add_lose_client_hook("auto-away", lose_client, d);
        add_server_filter("auto-away", log_data, d, -1);