]> git.pond.sub.org Git - empserver/commitdiff
subs: Don't squash telegrams together when time goes backwards
authorMarkus Armbruster <armbru@pond.sub.org>
Sat, 4 Jul 2015 12:31:28 +0000 (14:31 +0200)
committerMarkus Armbruster <armbru@pond.sub.org>
Sat, 5 Dec 2015 11:41:16 +0000 (12:41 +0100)
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 <armbru@pond.sub.org>
src/lib/subs/wu.c

index 4c84aeab898d446a94be6bffffbf22fcbd561753..c8efc0ec1210874a8bc6038fee86cc1013785ee6 100644 (file)
@@ -54,18 +54,13 @@ clear_telegram_is_new(natid to)
     last_tel[to].tel_from = NATID_BAD;
 }
 
     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
 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;
     }
        last_tel[to] = *tel;
        return 1;
     }