From 67b21a9ecd23d0c26752870ae607b26084af065c Mon Sep 17 00:00:00 2001 From: default Date: Wed, 24 May 2023 12:12:06 +0200 Subject: [PATCH] Show HTML form code for oneOf polls. --- html.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/html.c b/html.c index 518ac1f..56b0dee 100644 --- a/html.c +++ b/html.c @@ -919,6 +919,29 @@ xs_str *html_entry(snac *snac, xs_str *os, const xs_dict *msg, int local, } else { /* poll still active */ + xs *s1 = xs_fmt("
\n" + "\n", + snac->actor, id); + + while (xs_list_iter(&p, &v)) { + const char *name = xs_dict_get(v, "name"); + + if (name) { + /* FIXME: process anyOf (checkbox) correctly */ + xs *opt = xs_fmt(" %s
\n", + name, name, name); + + s1 = xs_str_cat(s1, opt); + } + } + + xs *s2 = xs_fmt("

\n

\n\n", L("Vote")); + + s1 = xs_str_cat(s1, s2); + + c = xs_str_cat(c, s1); } }