From 4708687be29a4babb795302979738c7571107d38 Mon Sep 17 00:00:00 2001 From: nekobit Date: Tue, 14 Jun 2022 15:21:36 +0000 Subject: [PATCH] List creation FossilOrigin-Name: f0c478cb4c4645a9f02b3e4a27392b99bf29a41b728cfcb65320045d94cef706 --- src/lists.c | 11 +++++++++++ src/query.c | 1 + src/query.h | 1 + static/lists.tmpl | 4 ++-- 4 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/lists.c b/src/lists.c index 49e995d..c56d857 100644 --- a/src/lists.c +++ b/src/lists.c @@ -68,6 +68,17 @@ void content_lists(struct session* ssn, mastodont_t* api, char** data) char* lists_format = NULL; char* lists_page = NULL; + if (ssn->post.title.is_set) + { + struct mstdnt_storage create_storage = { 0 }; + struct mstdnt_list_args args = { + .title = keystr(ssn->post.title), + .replies_policy = MSTDNT_LIST_REPLIES_POLICY_LIST, + }; + mastodont_create_list(api, &args, &create_storage, NULL); + mastodont_storage_cleanup(&create_storage); + } + if (mastodont_get_lists(api, &storage, &lists, &size_list)) { lists_page = construct_error(storage.error, E_ERROR, 1, NULL); diff --git a/src/query.c b/src/query.c index 893cccf..ee7986a 100644 --- a/src/query.c +++ b/src/query.c @@ -90,6 +90,7 @@ char* read_post_data(struct post_values* post) { "lang", &(post->lang), key_int }, { "itype", &(post->itype), key_string }, { "id", &(post->id), key_string }, + { "title", &(post->title), key_string }, { "theme", &(post->theme), key_string }, { "themeclr", &(post->themeclr), key_int }, { "jsactions", &(post->jsactions), key_int }, diff --git a/src/query.h b/src/query.h index 6f77992..8307e57 100644 --- a/src/query.h +++ b/src/query.h @@ -34,6 +34,7 @@ struct post_values struct key theme; // String struct key themeclr; // Int struct key lang; // Int + struct key title; // String struct key jsactions; // Int struct key jsreply; // Int struct key jslive; // Int diff --git a/static/lists.tmpl b/static/lists.tmpl index 4febce0..3db9ec1 100644 --- a/static/lists.tmpl +++ b/static/lists.tmpl @@ -7,9 +7,9 @@