summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar default2022-11-16 11:42:16 +0100
committerGravatar default2022-11-16 11:42:16 +0100
commita06930f4daa270660151c256d2283b9b3c57ab83 (patch)
tree2cb6ce06487f27f53ecca24a81681212a395c6b7
parentShow the complete date as a 'title' popup. (diff)
downloadpenes-snac2-a06930f4daa270660151c256d2283b9b3c57ab83.tar.gz
penes-snac2-a06930f4daa270660151c256d2283b9b3c57ab83.tar.xz
penes-snac2-a06930f4daa270660151c256d2283b9b3c57ab83.zip
Posts can be marked as 'sensitive content' (not yet for replies).
-rw-r--r--data.c2
-rw-r--r--html.c10
2 files changed, 11 insertions, 1 deletions
diff --git a/data.c b/data.c
index 53706c6..0866e31 100644
--- a/data.c
+++ b/data.c
@@ -79,7 +79,7 @@ int srv_open(char *basedir)
79 if (error != NULL) 79 if (error != NULL)
80 srv_log(error); 80 srv_log(error);
81 81
82/* disabled temporarily; messages can't be sent */ 82/* disabled temporarily; messages can't be sent (libcurl issue?) */
83#if 0 83#if 0
84#ifdef __OpenBSD__ 84#ifdef __OpenBSD__
85 srv_debug(2, xs_fmt("Calling unveil()")); 85 srv_debug(2, xs_fmt("Calling unveil()"));
diff --git a/html.c b/html.c
index 7b87fc8..8fb3892 100644
--- a/html.c
+++ b/html.c
@@ -242,6 +242,7 @@ d_char *html_top_controls(snac *snac, d_char *s)
242 "<textarea class=\"snac-textarea\" name=\"content\" " 242 "<textarea class=\"snac-textarea\" name=\"content\" "
243 "rows=\"8\" wrap=\"virtual\" required=\"required\"></textarea>\n" 243 "rows=\"8\" wrap=\"virtual\" required=\"required\"></textarea>\n"
244 "<input type=\"hidden\" name=\"in_reply_to\" value=\"\">\n" 244 "<input type=\"hidden\" name=\"in_reply_to\" value=\"\">\n"
245 "<p><input type=\"checkbox\" name=\"sensitive\"> %s\n"
245 "<p><input type=\"file\" name=\"attach\">\n" 246 "<p><input type=\"file\" name=\"attach\">\n"
246 "<p><input type=\"submit\" class=\"button\" value=\"%s\">\n" 247 "<p><input type=\"submit\" class=\"button\" value=\"%s\">\n"
247 "</form><p>\n" 248 "</form><p>\n"
@@ -297,6 +298,7 @@ d_char *html_top_controls(snac *snac, d_char *s)
297 298
298 xs *s1 = xs_fmt(_tmpl, 299 xs *s1 = xs_fmt(_tmpl,
299 snac->actor, 300 snac->actor,
301 L("Sensitive content"),
300 L("Post"), 302 L("Post"),
301 303
302 L("More options..."), 304 L("More options..."),
@@ -1120,6 +1122,7 @@ int html_post_handler(d_char *req, char *q_path, d_char *payload, int p_size,
1120 char *attach_url = xs_dict_get(p_vars, "attach_url"); 1122 char *attach_url = xs_dict_get(p_vars, "attach_url");
1121 char *attach_file = xs_dict_get(p_vars, "attach"); 1123 char *attach_file = xs_dict_get(p_vars, "attach");
1122 char *to = xs_dict_get(p_vars, "to"); 1124 char *to = xs_dict_get(p_vars, "to");
1125 char *sensitive = xs_dict_get(p_vars, "sensitive");
1123 xs *attach_list = xs_list_new(); 1126 xs *attach_list = xs_list_new();
1124 1127
1125 /* is attach_url set? */ 1128 /* is attach_url set? */
@@ -1152,6 +1155,13 @@ int html_post_handler(d_char *req, char *q_path, d_char *payload, int p_size,
1152 1155
1153 msg = msg_note(&snac, content_2, to, in_reply_to, attach_list); 1156 msg = msg_note(&snac, content_2, to, in_reply_to, attach_list);
1154 1157
1158 if (sensitive != NULL) {
1159 xs *t = xs_val_new(XSTYPE_TRUE);
1160
1161 msg = xs_dict_set(msg, "sensitive", t);
1162 msg = xs_dict_set(msg, "summary", "...");
1163 }
1164
1155 c_msg = msg_create(&snac, msg); 1165 c_msg = msg_create(&snac, msg);
1156 1166
1157 post(&snac, c_msg); 1167 post(&snac, c_msg);