From d074d29736f7c49fdd4bcfb4258b1a21f74c0adf Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Sat, 4 Jul 2015 14:31:28 +0200 Subject: [PATCH] subs: Don't squash telegrams together when time goes backwards We've always squashed them when the time difference is smaller than TEL_SECONDS, regardless of sign. This involves passing the difference to abs(), implicitly casting from time_t to int, which triggers a Clang warning. I could clean this up to get rid of the warning, but time should never go backwards, and trying to make things prettier when it does isn't worthwhile. Simply drop the abs(). While there, drop the function comment. It's been inaccurate since Empire 3 dropped mail.c, and bogus since commit 17223e8 (v4.3.29) added tel_cont. Signed-off-by: Markus Armbruster --- src/lib/subs/wu.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/lib/subs/wu.c b/src/lib/subs/wu.c index 4c84aeab8..c8efc0ec1 100644 --- a/src/lib/subs/wu.c +++ b/src/lib/subs/wu.c @@ -54,18 +54,13 @@ clear_telegram_is_new(natid to) last_tel[to].tel_from = NATID_BAD; } -/* - * telegram_is_new counts new telegrams the same as read_telegrams in - * lib/commands/mail.c and lib/commands/rea.c - */ - static int telegram_is_new(natid to, struct telstr *tel) { if (tel->tel_from != last_tel[to].tel_from || tel->tel_type != last_tel[to].tel_type || (tel->tel_type != TEL_UPDATE - && abs(tel->tel_date - last_tel[to].tel_date) > TEL_SECONDS)) { + && tel->tel_date - last_tel[to].tel_date > TEL_SECONDS)) { last_tel[to] = *tel; return 1; } -- 2.43.0