mirror of
https://codeberg.org/grunfink/snac2.git
synced 2024-11-25 14:35:04 +00:00
mastoapi: also fix polls from Pleroma.
This commit is contained in:
parent
c31a4ae73e
commit
c884f7081a
1 changed files with 15 additions and 2 deletions
17
mastoapi.c
17
mastoapi.c
|
@ -716,10 +716,23 @@ xs_dict *mastoapi_poll(snac *snac, const xs_dict *msg)
|
|||
xs *options = xs_list_new();
|
||||
|
||||
poll = xs_dict_append(poll, "id", mid);
|
||||
xs *fd = mastoapi_date(xs_dict_get(msg, "endTime"));
|
||||
char *date = xs_dict_get(msg, "endTime");
|
||||
if (date == NULL)
|
||||
date = xs_dict_get(msg, "closed");
|
||||
if (date == NULL)
|
||||
return NULL;
|
||||
|
||||
xs *fd = mastoapi_date(date);
|
||||
poll = xs_dict_append(poll, "expires_at", fd);
|
||||
|
||||
date = xs_dict_get(msg, "closed");
|
||||
time_t t = 0;
|
||||
|
||||
if (date != NULL)
|
||||
t = xs_parse_iso_date(date, 0);
|
||||
|
||||
poll = xs_dict_append(poll, "expired",
|
||||
xs_dict_get(msg, "closed") != NULL ? xs_stock(XSTYPE_TRUE) : xs_stock(XSTYPE_FALSE));
|
||||
t < time(NULL) ? xs_stock(XSTYPE_FALSE) : xs_stock(XSTYPE_TRUE));
|
||||
|
||||
if ((opts = xs_dict_get(msg, "oneOf")) != NULL)
|
||||
poll = xs_dict_append(poll, "multiple", xs_stock(XSTYPE_FALSE));
|
||||
|
|
Loading…
Reference in a new issue