snac2

Fork of https://codeberg.org/grunfink/snac2
git clone https://git.inz.fi/snac2
Log | Files | Refs | README | LICENSE

commit 6e8adc86d00dccb9d6569336e6f208226c6bed22
parent bbb365e81be704d4afc93469c15f7396d56f56fa
Author: default <nobody@localhost>
Date:   Sat,  8 Jun 2024 21:25:02 +0200

mastoapi: Added missing field in list creation.

Diffstat:
Mdata.c | 9+++------
Mmastoapi.c | 4+++-
2 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/data.c b/data.c @@ -1831,21 +1831,18 @@ xs_val *list_maint(snac *user, const char *list, int op) if (add) { FILE *f; xs *dir = xs_fmt("%s/list/", user->basedir); - xs *id = xs_fmt("%010x", time(NULL)); + + l = xs_fmt("%010x", time(NULL)); mkdirx(dir); - xs *fn = xs_fmt("%s%s.id", dir, id); + xs *fn = xs_fmt("%s%s.id", dir, l); if ((f = fopen(fn, "w")) != NULL) { fprintf(f, "%s\n", list); fclose(f); } - - l = xs_stock(XSTYPE_TRUE); } - else - l = xs_stock(XSTYPE_FALSE); } break; diff --git a/mastoapi.c b/mastoapi.c @@ -2931,8 +2931,10 @@ int mastoapi_post_handler(const xs_dict *req, const char *q_path, if (xs_type(title) == XSTYPE_STRING) { /* add the list */ xs *out = xs_dict_new(); + xs *lid = list_maint(&snac, title, 1); - if (xs_type(list_maint(&snac, title, 1)) == XSTYPE_TRUE) { + if (!xs_is_null(lid)) { + out = xs_dict_append(out, "id", lid); out = xs_dict_append(out, "title", title); out = xs_dict_append(out, "replies_policy", xs_dict_get_def(args, "replies_policy", "list")); out = xs_dict_append(out, "exclusive", xs_stock(XSTYPE_FALSE));