void
clear_telegram_is_new(natid to)
{
- last_tel[to].tel_type = 0;
last_tel[to].tel_from = NATID_BAD;
- last_tel[to].tel_date = 0;
}
/*
static int
telegram_is_new(natid to, struct telstr *tel)
{
- int is_new = 0;
-
- is_new |= tel->tel_type != last_tel[to].tel_type;
- is_new |= tel->tel_from != last_tel[to].tel_from;
- is_new |= tel->tel_type != TEL_UPDATE &&
- abs(tel->tel_date - last_tel[to].tel_date) > TEL_SECONDS;
-
- last_tel[to].tel_type = tel->tel_type;
- last_tel[to].tel_from = tel->tel_from;
- last_tel[to].tel_date = tel->tel_date;
-
- return is_new;
+ 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)) {
+ last_tel[to] = *tel;
+ return 1;
+ }
+ return 0;
}
/*