-/* $OpenBSD: alerts.c,v 1.17 2017/04/21 14:09:44 nicm Exp $ */
+/* $OpenBSD: alerts.c,v 1.18 2017/04/28 19:10:48 nicm Exp $ */
/*
* Copyright (c) 2015 Nicholas Marriott <nicholas.marriott@gmail.com>
log_debug("@%u alerts flags added %#x", w->id, flags);
}
- if (!w->alerts_queued) {
- w->alerts_queued = 1;
- TAILQ_INSERT_TAIL(&alerts_list, w, alerts_entry);
- w->references++;
- }
+ if (alerts_enabled(w, flags)) {
+ if (!w->alerts_queued) {
+ w->alerts_queued = 1;
+ TAILQ_INSERT_TAIL(&alerts_list, w, alerts_entry);
+ w->references++;
+ }
- if (!alerts_fired && alerts_enabled(w, flags)) {
- log_debug("alerts check queued (by @%u)", w->id);
- event_once(-1, EV_TIMEOUT, alerts_callback, NULL, NULL);
- alerts_fired = 1;
+ if (!alerts_fired) {
+ log_debug("alerts check queued (by @%u)", w->id);
+ event_once(-1, EV_TIMEOUT, alerts_callback, NULL, NULL);
+ alerts_fired = 1;
+ }
}
}