diff options
author | default <nobody@localhost> | 2023-05-29 11:07:38 +0200 |
---|---|---|
committer | default <nobody@localhost> | 2023-05-29 11:07:38 +0200 |
commit | 765936244888f8d5f1644b0178cc6dc70597166b (patch) | |
tree | c7766c1c55748329f0cc4deda0e528bda6845d0c /activitypub.c | |
parent | 05ac2a062dc3f01837c511a2d7e2051cda15e44a (diff) |
Enqueue a close_question user q_item.
Diffstat (limited to 'activitypub.c')
-rw-r--r-- | activitypub.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/activitypub.c b/activitypub.c index 27f9c7c..15937c3 100644 --- a/activitypub.c +++ b/activitypub.c @@ -1058,8 +1058,10 @@ int update_question(snac *user, const char *id) xs *now = xs_str_utctime(0, ISO_DATE_SPEC); /* it's now greater than the endTime? */ - if (strcmp(now, end_time) > 0) - msg = xs_dict_set(msg, "closed", end_time); + if (strcmp(now, end_time) > 0) { + xs *et = xs_dup(end_time); + msg = xs_dict_set(msg, "closed", et); + } } /* update the count of voters */ @@ -1541,6 +1543,14 @@ void process_user_queue_item(snac *snac, xs_dict *q_item) } } else + if (strcmp(type, "close_question") == 0) { + /* the time for this question has ended */ + const char *id = xs_dict_get(q_item, "message"); + + if (!xs_is_null(id)) + update_question(snac, id); + } + else snac_log(snac, xs_fmt("unexpected q_item type '%s'", type)); } |