summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar default2023-04-13 17:12:07 +0200
committerGravatar default2023-04-13 17:12:07 +0200
commit211bedd4978c4711f0e2399b38ccb6e76e39856d (patch)
tree91ec989f5842f2c61734218f552790724ef1a44d
parentNew function notify_add(). (diff)
downloadsnac2-211bedd4978c4711f0e2399b38ccb6e76e39856d.tar.gz
snac2-211bedd4978c4711f0e2399b38ccb6e76e39856d.tar.xz
snac2-211bedd4978c4711f0e2399b38ccb6e76e39856d.zip
New function notify_check_time().
-rw-r--r--data.c28
-rw-r--r--snac.h1
2 files changed, 29 insertions, 0 deletions
diff --git a/data.c b/data.c
index a98e9e5..cf66b9a 100644
--- a/data.c
+++ b/data.c
@@ -1477,6 +1477,34 @@ xs_list *inbox_list(void)
1477 1477
1478/** notifications **/ 1478/** notifications **/
1479 1479
1480xs_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
1480void notify_add(snac *snac, const char *type, const char *utype, 1508void 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 */
diff --git a/snac.h b/snac.h
index a707f16..e201801 100644
--- a/snac.h
+++ b/snac.h
@@ -137,6 +137,7 @@ d_char *history_list(snac *snac);
137 137
138void lastlog_write(snac *snac); 138void lastlog_write(snac *snac);
139 139
140xs_str *notify_check_time(snac *snac, int reset);
140void notify_add(snac *snac, const char *type, const char *utype, 141void notify_add(snac *snac, const char *type, const char *utype,
141 const char *actor, const char *objid); 142 const char *actor, const char *objid);
142 143