diff options
| author | 2026-01-24 23:37:55 +0100 | |
|---|---|---|
| committer | 2026-01-24 23:56:45 +0100 | |
| commit | cd96b83828a852bdf4f4311900501eba8c3972ca (patch) | |
| tree | 0a572f2c368e3ae66c24ddbc7add1ccba516a524 | |
| parent | poll-limit: fix warning (diff) | |
| download | snac2-cd96b83828a852bdf4f4311900501eba8c3972ca.tar.gz snac2-cd96b83828a852bdf4f4311900501eba8c3972ca.tar.xz snac2-cd96b83828a852bdf4f4311900501eba8c3972ca.zip | |
poll-limits: added "max_poll_option_length" option
| -rw-r--r-- | activitypub.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/activitypub.c b/activitypub.c index e9e28be..8eb7844 100644 --- a/activitypub.c +++ b/activitypub.c | |||
| @@ -2322,13 +2322,16 @@ xs_dict *msg_question(snac *user, const char *content, xs_list *attach, | |||
| 2322 | /* creates a Question message */ | 2322 | /* creates a Question message */ |
| 2323 | { | 2323 | { |
| 2324 | xs_dict *msg = msg_note(user, content, NULL, NULL, attach, 0, NULL, NULL); | 2324 | xs_dict *msg = msg_note(user, content, NULL, NULL, attach, 0, NULL, NULL); |
| 2325 | size_t max_line = 200; | ||
| 2326 | int max = 8; | ||
| 2327 | const xs_number *max_options = xs_dict_get(srv_config, "max_poll_options"); | 2325 | const xs_number *max_options = xs_dict_get(srv_config, "max_poll_options"); |
| 2326 | const xs_number *max_length = xs_dict_get(srv_config, "max_poll_option_length"); | ||
| 2328 | xs_set seen; | 2327 | xs_set seen; |
| 2329 | 2328 | ||
| 2329 | size_t max_line = 60; | ||
| 2330 | int max = 8; | ||
| 2330 | if (xs_type(max_options) == XSTYPE_NUMBER) | 2331 | if (xs_type(max_options) == XSTYPE_NUMBER) |
| 2331 | max = xs_number_get(max_options); | 2332 | max = xs_number_get(max_options); |
| 2333 | if (xs_type(max_length) == XSTYPE_NUMBER) | ||
| 2334 | max_line = xs_number_get(max_length); | ||
| 2332 | 2335 | ||
| 2333 | msg = xs_dict_set(msg, "type", "Question"); | 2336 | msg = xs_dict_set(msg, "type", "Question"); |
| 2334 | 2337 | ||