mirror of
https://codeberg.org/grunfink/snac2.git
synced 2024-11-25 14:35:04 +00:00
New macro ISO_DATE_SPEC.
This commit is contained in:
parent
e913d03f02
commit
654e171b93
6 changed files with 9 additions and 7 deletions
|
@ -498,7 +498,7 @@ xs_dict *msg_base(snac *snac, const char *type, const char *id,
|
|||
|
||||
/* generated values */
|
||||
if (date && strcmp(date, "@now") == 0) {
|
||||
published = xs_str_utctime(0, "%Y-%m-%dT%H:%M:%SZ");
|
||||
published = xs_str_utctime(0, ISO_DATE_SPEC);
|
||||
date = published;
|
||||
}
|
||||
|
||||
|
@ -959,7 +959,7 @@ xs_dict *msg_question(snac *user, const char *content, const xs_list *opts, int
|
|||
|
||||
/* set the end time */
|
||||
time_t t = time(NULL) + end_secs;
|
||||
xs *et = xs_str_utctime(t, "%Y-%m-%dT%H:%M:%SZ");
|
||||
xs *et = xs_str_utctime(t, ISO_DATE_SPEC);
|
||||
|
||||
msg = xs_dict_append(msg, "endTime", et);
|
||||
|
||||
|
@ -1234,7 +1234,7 @@ int process_input_message(snac *snac, xs_dict *msg, xs_dict *req)
|
|||
|
||||
if (xs_is_null(xs_dict_get(f_msg, "published"))) {
|
||||
/* add a date if it doesn't include one (Mastodon) */
|
||||
xs *date = xs_str_utctime(0, "%Y-%m-%dT%H:%M:%SZ");
|
||||
xs *date = xs_str_utctime(0, ISO_DATE_SPEC);
|
||||
f_msg = xs_dict_set(f_msg, "published", date);
|
||||
}
|
||||
|
||||
|
|
2
data.c
2
data.c
|
@ -1688,7 +1688,7 @@ void notify_add(snac *snac, const char *type, const char *utype,
|
|||
{
|
||||
xs *ntid = tid(0);
|
||||
xs *fn = xs_fmt("%s/notify/", snac->basedir);
|
||||
xs *date = xs_str_utctime(0, "%Y-%m-%dT%H:%M:%SZ");
|
||||
xs *date = xs_str_utctime(0, ISO_DATE_SPEC);
|
||||
FILE *f;
|
||||
|
||||
/* create the directory */
|
||||
|
|
2
html.c
2
html.c
|
@ -1756,7 +1756,7 @@ int html_post_handler(const xs_dict *req, const char *q_path,
|
|||
}
|
||||
|
||||
/* set the updated field */
|
||||
xs *updated = xs_str_utctime(0, "%Y-%m-%dT%H:%M:%SZ");
|
||||
xs *updated = xs_str_utctime(0, ISO_DATE_SPEC);
|
||||
msg = xs_dict_set(msg, "updated", updated);
|
||||
|
||||
/* overwrite object, not updating the indexes */
|
||||
|
|
|
@ -524,7 +524,7 @@ xs_dict *mastoapi_account(const xs_dict *actor)
|
|||
acct = xs_dict_append(acct, "created_at", pub);
|
||||
else {
|
||||
/* unset created_at crashes Tusky, so lie like a mf */
|
||||
xs *date = xs_str_utctime(0, "%Y-%m-%dT%H:%M:%SZ");
|
||||
xs *date = xs_str_utctime(0, ISO_DATE_SPEC);
|
||||
acct = xs_dict_append(acct, "created_at", date);
|
||||
}
|
||||
|
||||
|
|
2
snac.h
2
snac.h
|
@ -9,6 +9,8 @@
|
|||
|
||||
#define DIR_PERM 02770
|
||||
|
||||
#define ISO_DATE_SPEC "%Y-%m-%dT%H:%M:%SZ"
|
||||
|
||||
extern double disk_layout;
|
||||
extern d_char *srv_basedir;
|
||||
extern d_char *srv_config;
|
||||
|
|
2
utils.c
2
utils.c
|
@ -218,7 +218,7 @@ int adduser(const char *uid)
|
|||
{
|
||||
snac snac;
|
||||
xs *config = xs_dict_new();
|
||||
xs *date = xs_str_utctime(0, "%Y-%m-%dT%H:%M:%SZ");
|
||||
xs *date = xs_str_utctime(0, ISO_DATE_SPEC);
|
||||
xs *pwd = NULL;
|
||||
xs *pwd_f = NULL;
|
||||
xs *key = NULL;
|
||||
|
|
Loading…
Reference in a new issue