commit fdda3c9

default  ·  2023-02-20 09:19:15 +0000 UTC
parent 9ac8ae9
New checkbox 'Only for mentioned people'.
1 files changed,  +17, -11
M html.c
M html.c
+17, -11
 1@@ -268,6 +268,7 @@ d_char *html_top_controls(snac *snac, d_char *s)
 2         "rows=\"8\" wrap=\"virtual\" required=\"required\"></textarea>\n"
 3         "<input type=\"hidden\" name=\"in_reply_to\" value=\"\">\n"
 4         "<p>%s: <input type=\"checkbox\" name=\"sensitive\">\n"
 5+        "<p>%s: <input type=\"checkbox\" name=\"mentioned_only\">\n"
 6         "<p><input type=\"file\" name=\"attach\">\n"
 7         "<p>%s: <input type=\"text\" name=\"alt_text\">\n"
 8         "<p><input type=\"submit\" class=\"button\" value=\"%s\">\n"
 9@@ -360,6 +361,7 @@ d_char *html_top_controls(snac *snac, d_char *s)
10     xs *s1 = xs_fmt(_tmpl,
11         snac->actor,
12         L("Sensitive content"),
13+        L("Only for mentioned people"),
14         L("Image description"),
15         L("Post"),
16 
17@@ -527,6 +529,7 @@ d_char *html_entry_controls(snac *snac, d_char *os, char *msg, const char *md5)
18             "<input type=\"hidden\" name=\"edit_id\" value=\"%s\">\n"
19 
20             "<p>%s: <input type=\"checkbox\" name=\"sensitive\">\n"
21+            "<p>%s: <input type=\"checkbox\" name=\"mentioned_only\">\n"
22             "<p><input type=\"file\" name=\"attach\">\n"
23             "<p>%s: <input type=\"text\" name=\"alt_text\">\n"
24 
25@@ -542,6 +545,7 @@ d_char *html_entry_controls(snac *snac, d_char *os, char *msg, const char *md5)
26             prev_src,
27             id,
28             L("Sensitive content"),
29+            L("Only for mentioned people"),
30             L("Image description"),
31             md5,
32             L("Post")
33@@ -564,6 +568,7 @@ d_char *html_entry_controls(snac *snac, d_char *os, char *msg, const char *md5)
34             "<input type=\"hidden\" name=\"in_reply_to\" value=\"%s\">\n"
35 
36             "<p>%s: <input type=\"checkbox\" name=\"sensitive\">\n"
37+            "<p>%s: <input type=\"checkbox\" name=\"mentioned_only\">\n"
38             "<p><input type=\"file\" name=\"attach\">\n"
39             "<p>%s: <input type=\"text\" name=\"alt_text\">\n"
40 
41@@ -579,6 +584,7 @@ d_char *html_entry_controls(snac *snac, d_char *os, char *msg, const char *md5)
42             ct,
43             id,
44             L("Sensitive content"),
45+            L("Only for mentioned people"),
46             L("Image description"),
47             md5,
48             L("Post")
49@@ -1353,7 +1359,7 @@ int html_post_handler(d_char *req, char *q_path, d_char *payload, int p_size,
50     int status = 0;
51     snac snac;
52     char *uid, *p_path;
53-    char *p_vars;
54+    xs_dict *p_vars;
55 
56     xs *l = xs_split_n(q_path, "/", 2);
57 
58@@ -1383,16 +1389,16 @@ int html_post_handler(d_char *req, char *q_path, d_char *payload, int p_size,
59 
60     if (p_path && strcmp(p_path, "admin/note") == 0) {
61         /* post note */
62-        char *content     = xs_dict_get(p_vars, "content");
63-        char *in_reply_to = xs_dict_get(p_vars, "in_reply_to");
64-        char *attach_url  = xs_dict_get(p_vars, "attach_url");
65-        char *attach_file = xs_dict_get(p_vars, "attach");
66-        char *to          = xs_dict_get(p_vars, "to");
67-        char *sensitive   = xs_dict_get(p_vars, "sensitive");
68-        char *edit_id     = xs_dict_get(p_vars, "edit_id");
69-        char *alt_text    = xs_dict_get(p_vars, "alt_text");
70-        xs *attach_list   = xs_list_new();
71-        int priv          = 0;
72+        xs_str *content      = xs_dict_get(p_vars, "content");
73+        xs_str *in_reply_to  = xs_dict_get(p_vars, "in_reply_to");
74+        xs_str *attach_url   = xs_dict_get(p_vars, "attach_url");
75+        xs_list *attach_file = xs_dict_get(p_vars, "attach");
76+        xs_str *to           = xs_dict_get(p_vars, "to");
77+        xs_str *sensitive    = xs_dict_get(p_vars, "sensitive");
78+        xs_str *edit_id      = xs_dict_get(p_vars, "edit_id");
79+        xs_str *alt_text     = xs_dict_get(p_vars, "alt_text");
80+        int priv             = !xs_is_null(xs_dict_get(p_vars, "mentioned_only"));
81+        xs *attach_list      = xs_list_new();
82 
83         /* default alt text */
84         if (xs_is_null(alt_text))