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 <armbru@pond.sub.org>
This commit is contained in:
Markus Armbruster 2015-07-04 14:31:28 +02:00
parent feb894cf1e
commit d074d29736

View file

@ -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;
}