summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--html.c31
1 files changed, 30 insertions, 1 deletions
diff --git a/html.c b/html.c
index 3ad330d..09dd202 100644
--- a/html.c
+++ b/html.c
@@ -1374,7 +1374,7 @@ xs_html *html_top_controls(snac *snac)
1374 xs_html_attr("enctype", "multipart/form-data"), 1374 xs_html_attr("enctype", "multipart/form-data"),
1375 1375
1376 xs_html_tag("textarea", 1376 xs_html_tag("textarea",
1377 xs_html_attr("name", "hashtags"), 1377 xs_html_attr("name", "followed_hashtags"),
1378 xs_html_attr("cols", "40"), 1378 xs_html_attr("cols", "40"),
1379 xs_html_attr("rows", "4"), 1379 xs_html_attr("rows", "4"),
1380 xs_html_attr("placeholder", "#cats\n#windowfriday\n#classicalmusic"), 1380 xs_html_attr("placeholder", "#cats\n#windowfriday\n#classicalmusic"),
@@ -4390,6 +4390,35 @@ int html_post_handler(const xs_dict *req, const char *q_path,
4390 4390
4391 status = HTTP_STATUS_SEE_OTHER; 4391 status = HTTP_STATUS_SEE_OTHER;
4392 } 4392 }
4393 else
4394 if (p_path && strcmp(p_path, "admin/followed-hashtags") == 0) { /** **/
4395 const char *followed_hashtags = xs_dict_get(p_vars, "followed_hashtags");
4396
4397 if (xs_is_string(followed_hashtags)) {
4398 xs *new_hashtags = xs_list_new();
4399 xs *l = xs_split(followed_hashtags, "\n");
4400 const char *v;
4401
4402 xs_list_foreach(l, v) {
4403 xs *s1 = xs_strip_i(xs_dup(v));
4404 s1 = xs_replace_i(s1, " ", "");
4405
4406 if (*s1 == '\0')
4407 continue;
4408
4409 xs *s2 = xs_utf8_to_lower(s1);
4410 if (*s2 != '#')
4411 s2 = xs_str_prepend_i(s2, "#");
4412
4413 new_hashtags = xs_list_append(new_hashtags, s2);
4414 }
4415
4416 snac.config = xs_dict_set(snac.config, "followed_hashtags", new_hashtags);
4417 user_persist(&snac, 0);
4418 }
4419
4420 status = HTTP_STATUS_SEE_OTHER;
4421 }
4393 4422
4394 if (status == HTTP_STATUS_SEE_OTHER) { 4423 if (status == HTTP_STATUS_SEE_OTHER) {
4395 const char *redir = xs_dict_get(p_vars, "redir"); 4424 const char *redir = xs_dict_get(p_vars, "redir");