diff options
Diffstat (limited to 'data.c')
| -rw-r--r-- | data.c | 28 |
1 files changed, 28 insertions, 0 deletions
| @@ -1477,6 +1477,34 @@ xs_list *inbox_list(void) | |||
| 1477 | 1477 | ||
| 1478 | /** notifications **/ | 1478 | /** notifications **/ |
| 1479 | 1479 | ||
| 1480 | xs_str *notify_check_time(snac *snac, int reset) | ||
| 1481 | /* gets or resets the latest notification check time */ | ||
| 1482 | { | ||
| 1483 | xs_str *t = NULL; | ||
| 1484 | xs *fn = xs_fmt("%s/notifydate.txt", snac->basedir); | ||
| 1485 | FILE *f; | ||
| 1486 | |||
| 1487 | if (reset) { | ||
| 1488 | if ((f = fopen(fn, "w")) != NULL) { | ||
| 1489 | t = tid(0); | ||
| 1490 | fprintf(f, "%s\n", t); | ||
| 1491 | fclose(f); | ||
| 1492 | } | ||
| 1493 | } | ||
| 1494 | else { | ||
| 1495 | if ((f = fopen(fn, "r")) != NULL) { | ||
| 1496 | t = xs_readline(f); | ||
| 1497 | fclose(f); | ||
| 1498 | } | ||
| 1499 | else | ||
| 1500 | /* never set before */ | ||
| 1501 | t = xs_fmt("%16.6f", 0.0); | ||
| 1502 | } | ||
| 1503 | |||
| 1504 | return t; | ||
| 1505 | } | ||
| 1506 | |||
| 1507 | |||
| 1480 | void notify_add(snac *snac, const char *type, const char *utype, | 1508 | void notify_add(snac *snac, const char *type, const char *utype, |
| 1481 | const char *actor, const char *objid) | 1509 | const char *actor, const char *objid) |
| 1482 | /* adds a new notification */ | 1510 | /* adds a new notification */ |