diff options
Diffstat (limited to 'activitypub.c')
| -rw-r--r-- | activitypub.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/activitypub.c b/activitypub.c index c34e510..8eb7844 100644 --- a/activitypub.c +++ b/activitypub.c | |||
| @@ -17,6 +17,7 @@ | |||
| 17 | 17 | ||
| 18 | #include "snac.h" | 18 | #include "snac.h" |
| 19 | 19 | ||
| 20 | #include <stddef.h> | ||
| 20 | #include <sys/wait.h> | 21 | #include <sys/wait.h> |
| 21 | 22 | ||
| 22 | const char * const public_address = "https:/" "/www.w3.org/ns/activitystreams#Public"; | 23 | const char * const public_address = "https:/" "/www.w3.org/ns/activitystreams#Public"; |
| @@ -2321,9 +2322,17 @@ xs_dict *msg_question(snac *user, const char *content, xs_list *attach, | |||
| 2321 | /* creates a Question message */ | 2322 | /* creates a Question message */ |
| 2322 | { | 2323 | { |
| 2323 | 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); |
| 2324 | int max = 8; | 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"); | ||
| 2325 | xs_set seen; | 2327 | xs_set seen; |
| 2326 | 2328 | ||
| 2329 | size_t max_line = 60; | ||
| 2330 | int max = 8; | ||
| 2331 | if (xs_type(max_options) == XSTYPE_NUMBER) | ||
| 2332 | max = xs_number_get(max_options); | ||
| 2333 | if (xs_type(max_length) == XSTYPE_NUMBER) | ||
| 2334 | max_line = xs_number_get(max_length); | ||
| 2335 | |||
| 2327 | msg = xs_dict_set(msg, "type", "Question"); | 2336 | msg = xs_dict_set(msg, "type", "Question"); |
| 2328 | 2337 | ||
| 2329 | /* make it non-editable */ | 2338 | /* make it non-editable */ |
| @@ -2341,8 +2350,8 @@ xs_dict *msg_question(snac *user, const char *content, xs_list *attach, | |||
| 2341 | xs *v2 = xs_dup(v); | 2350 | xs *v2 = xs_dup(v); |
| 2342 | xs *d = xs_dict_new(); | 2351 | xs *d = xs_dict_new(); |
| 2343 | 2352 | ||
| 2344 | if (strlen(v2) > 60) { | 2353 | if (strlen(v2) > max_line) { |
| 2345 | v2[60] = '\0'; | 2354 | v2[max_line] = '\0'; |
| 2346 | v2 = xs_str_cat(v2, "..."); | 2355 | v2 = xs_str_cat(v2, "..."); |
| 2347 | } | 2356 | } |
| 2348 | 2357 | ||