Răsfoiți Sursa

poll-limits: added "max_poll_option_length" option

green 6 luni în urmă
părinte
comite
cd96b83828
1 a modificat fișierele cu 5 adăugiri și 2 ștergeri
  1. 5 2
      activitypub.c

+ 5 - 2
activitypub.c

@@ -2322,13 +2322,16 @@ xs_dict *msg_question(snac *user, const char *content, xs_list *attach,
 /* creates a Question message */
 {
     xs_dict *msg = msg_note(user, content, NULL, NULL, attach, 0, NULL, NULL);
-    size_t max_line = 200;
-    int max = 8;
     const xs_number *max_options = xs_dict_get(srv_config, "max_poll_options");
+    const xs_number *max_length = xs_dict_get(srv_config, "max_poll_option_length");
     xs_set seen;
 
+    size_t max_line = 60;
+    int max = 8;
     if (xs_type(max_options) == XSTYPE_NUMBER)
         max = xs_number_get(max_options);
+    if (xs_type(max_length) == XSTYPE_NUMBER)
+        max_line = xs_number_get(max_length);
 
     msg = xs_dict_set(msg, "type", "Question");