diff options
Diffstat (limited to 'html.c')
| -rw-r--r-- | html.c | 55 |
1 files changed, 49 insertions, 6 deletions
| @@ -559,6 +559,30 @@ xs_html *html_note(snac *user, const char *summary, | |||
| 559 | xs_html_text(L("End in 1 day")))))); | 559 | xs_html_text(L("End in 1 day")))))); |
| 560 | } | 560 | } |
| 561 | 561 | ||
| 562 | #if 0 | ||
| 563 | /* scheduled post data */ | ||
| 564 | xs *sched_date = xs_dup(""); | ||
| 565 | xs *sched_time = xs_dup(""); | ||
| 566 | |||
| 567 | xs_html_add(form, | ||
| 568 | xs_html_tag("p", NULL), | ||
| 569 | xs_html_tag("details", | ||
| 570 | xs_html_tag("summary", | ||
| 571 | xs_html_text(L("Scheduled post..."))), | ||
| 572 | xs_html_tag("p", | ||
| 573 | xs_html_text(L("Post date: ")), | ||
| 574 | xs_html_sctag("input", | ||
| 575 | xs_html_attr("type", "date"), | ||
| 576 | xs_html_attr("value", sched_date), | ||
| 577 | xs_html_attr("name", "post_date")), | ||
| 578 | xs_html_text(" "), | ||
| 579 | xs_html_text(L("Post time: ")), | ||
| 580 | xs_html_sctag("input", | ||
| 581 | xs_html_attr("type", "time"), | ||
| 582 | xs_html_attr("value", sched_time), | ||
| 583 | xs_html_attr("name", "post_time"))))); | ||
| 584 | #endif | ||
| 585 | |||
| 562 | xs_html_add(form, | 586 | xs_html_add(form, |
| 563 | xs_html_tag("p", NULL), | 587 | xs_html_tag("p", NULL), |
| 564 | xs_html_sctag("input", | 588 | xs_html_sctag("input", |
| @@ -4186,12 +4210,14 @@ int html_post_handler(const xs_dict *req, const char *q_path, | |||
| 4186 | snac_debug(&snac, 1, xs_fmt("web action '%s' received", p_path)); | 4210 | snac_debug(&snac, 1, xs_fmt("web action '%s' received", p_path)); |
| 4187 | 4211 | ||
| 4188 | /* post note */ | 4212 | /* post note */ |
| 4189 | const xs_str *content = xs_dict_get(p_vars, "content"); | 4213 | const char *content = xs_dict_get(p_vars, "content"); |
| 4190 | const xs_str *in_reply_to = xs_dict_get(p_vars, "in_reply_to"); | 4214 | const char *in_reply_to = xs_dict_get(p_vars, "in_reply_to"); |
| 4191 | const xs_str *to = xs_dict_get(p_vars, "to"); | 4215 | const char *to = xs_dict_get(p_vars, "to"); |
| 4192 | const xs_str *sensitive = xs_dict_get(p_vars, "sensitive"); | 4216 | const char *sensitive = xs_dict_get(p_vars, "sensitive"); |
| 4193 | const xs_str *summary = xs_dict_get(p_vars, "summary"); | 4217 | const char *summary = xs_dict_get(p_vars, "summary"); |
| 4194 | const xs_str *edit_id = xs_dict_get(p_vars, "edit_id"); | 4218 | const char *edit_id = xs_dict_get(p_vars, "edit_id"); |
| 4219 | const char *post_date = xs_dict_get_def(p_vars, "post_date", ""); | ||
| 4220 | const char *post_time = xs_dict_get_def(p_vars, "post_time", ""); | ||
| 4195 | int priv = !xs_is_null(xs_dict_get(p_vars, "mentioned_only")); | 4221 | int priv = !xs_is_null(xs_dict_get(p_vars, "mentioned_only")); |
| 4196 | int store_as_draft = !xs_is_null(xs_dict_get(p_vars, "is_draft")); | 4222 | int store_as_draft = !xs_is_null(xs_dict_get(p_vars, "is_draft")); |
| 4197 | xs *attach_list = xs_list_new(); | 4223 | xs *attach_list = xs_list_new(); |
| @@ -4279,6 +4305,23 @@ int html_post_handler(const xs_dict *req, const char *q_path, | |||
| 4279 | msg = xs_dict_set(msg, "summary", xs_is_null(summary) ? "..." : summary); | 4305 | msg = xs_dict_set(msg, "summary", xs_is_null(summary) ? "..." : summary); |
| 4280 | } | 4306 | } |
| 4281 | 4307 | ||
| 4308 | if (*post_date) { | ||
| 4309 | /* scheduled post */ | ||
| 4310 | xs *sched_date = xs_fmt("%sT%s:00", post_date, *post_time ? post_time : "12:00"); | ||
| 4311 | time_t t = xs_parse_localtime(sched_date, "%Y-%m-%dT%H:%M:%S"); | ||
| 4312 | |||
| 4313 | if (t != 0) { | ||
| 4314 | xs *iso_date = xs_str_iso_date(t); | ||
| 4315 | msg = xs_dict_set(msg, "published", iso_date); | ||
| 4316 | |||
| 4317 | snac_debug(&snac, 1, xs_fmt("Scheduled date: [%s]", iso_date)); | ||
| 4318 | } | ||
| 4319 | else { | ||
| 4320 | snac_log(&snac, xs_fmt("Invalid scheduled date: [%s]", sched_date)); | ||
| 4321 | post_date = ""; | ||
| 4322 | } | ||
| 4323 | } | ||
| 4324 | |||
| 4282 | if (xs_is_null(edit_id)) { | 4325 | if (xs_is_null(edit_id)) { |
| 4283 | /* new message */ | 4326 | /* new message */ |
| 4284 | const char *id = xs_dict_get(msg, "id"); | 4327 | const char *id = xs_dict_get(msg, "id"); |