mirror of
https://codeberg.org/grunfink/snac2.git
synced 2024-11-25 06:25:04 +00:00
New function notify_check_time().
This commit is contained in:
parent
bcde97c2d5
commit
211bedd497
2 changed files with 29 additions and 0 deletions
28
data.c
28
data.c
|
@ -1477,6 +1477,34 @@ xs_list *inbox_list(void)
|
||||||
|
|
||||||
/** notifications **/
|
/** notifications **/
|
||||||
|
|
||||||
|
xs_str *notify_check_time(snac *snac, int reset)
|
||||||
|
/* gets or resets the latest notification check time */
|
||||||
|
{
|
||||||
|
xs_str *t = NULL;
|
||||||
|
xs *fn = xs_fmt("%s/notifydate.txt", snac->basedir);
|
||||||
|
FILE *f;
|
||||||
|
|
||||||
|
if (reset) {
|
||||||
|
if ((f = fopen(fn, "w")) != NULL) {
|
||||||
|
t = tid(0);
|
||||||
|
fprintf(f, "%s\n", t);
|
||||||
|
fclose(f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if ((f = fopen(fn, "r")) != NULL) {
|
||||||
|
t = xs_readline(f);
|
||||||
|
fclose(f);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
/* never set before */
|
||||||
|
t = xs_fmt("%16.6f", 0.0);
|
||||||
|
}
|
||||||
|
|
||||||
|
return t;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void notify_add(snac *snac, const char *type, const char *utype,
|
void notify_add(snac *snac, const char *type, const char *utype,
|
||||||
const char *actor, const char *objid)
|
const char *actor, const char *objid)
|
||||||
/* adds a new notification */
|
/* adds a new notification */
|
||||||
|
|
1
snac.h
1
snac.h
|
@ -137,6 +137,7 @@ d_char *history_list(snac *snac);
|
||||||
|
|
||||||
void lastlog_write(snac *snac);
|
void lastlog_write(snac *snac);
|
||||||
|
|
||||||
|
xs_str *notify_check_time(snac *snac, int reset);
|
||||||
void notify_add(snac *snac, const char *type, const char *utype,
|
void notify_add(snac *snac, const char *type, const char *utype,
|
||||||
const char *actor, const char *objid);
|
const char *actor, const char *objid);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue