summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--activitypub.c11
-rw-r--r--html.c6
-rw-r--r--main.c2
-rw-r--r--mastoapi.c5
-rw-r--r--snac.h2
5 files changed, 16 insertions, 10 deletions
diff --git a/activitypub.c b/activitypub.c
index 5e1dd55..c9f700f 100644
--- a/activitypub.c
+++ b/activitypub.c
@@ -1555,7 +1555,7 @@ xs_dict *msg_follow(snac *snac, const char *q)
1555 1555
1556xs_dict *msg_note(snac *snac, const xs_str *content, const xs_val *rcpts, 1556xs_dict *msg_note(snac *snac, const xs_str *content, const xs_val *rcpts,
1557 const xs_str *in_reply_to, const xs_list *attach, 1557 const xs_str *in_reply_to, const xs_list *attach,
1558 int scope, const char *lang_str) 1558 int scope, const char *lang_str, const char *msg_date)
1559/* creates a 'Note' message */ 1559/* creates a 'Note' message */
1560/* scope: 0, public; 1, private (mentioned only); 2, "quiet public"; 3, followers only */ 1560/* scope: 0, public; 1, private (mentioned only); 2, "quiet public"; 3, followers only */
1561{ 1561{
@@ -1569,7 +1569,12 @@ xs_dict *msg_note(snac *snac, const xs_str *content, const xs_val *rcpts,
1569 xs *irt = NULL; 1569 xs *irt = NULL;
1570 xs *tag = xs_list_new(); 1570 xs *tag = xs_list_new();
1571 xs *atls = xs_list_new(); 1571 xs *atls = xs_list_new();
1572 xs_dict *msg = msg_base(snac, "Note", id, NULL, "@now", NULL); 1572
1573 /* discard non-parseable dates */
1574 if (!xs_is_string(msg_date) || xs_parse_iso_date(msg_date, 0) == 0)
1575 msg_date = NULL;
1576
1577 xs_dict *msg = msg_base(snac, "Note", id, NULL, xs_or(msg_date, "@now"), NULL);
1573 xs_list *p; 1578 xs_list *p;
1574 const xs_val *v; 1579 const xs_val *v;
1575 1580
@@ -1782,7 +1787,7 @@ xs_dict *msg_question(snac *user, const char *content, xs_list *attach,
1782 const xs_list *opts, int multiple, int end_secs) 1787 const xs_list *opts, int multiple, int end_secs)
1783/* creates a Question message */ 1788/* creates a Question message */
1784{ 1789{
1785 xs_dict *msg = msg_note(user, content, NULL, NULL, attach, 0, NULL); 1790 xs_dict *msg = msg_note(user, content, NULL, NULL, attach, 0, NULL, NULL);
1786 int max = 8; 1791 int max = 8;
1787 xs_set seen; 1792 xs_set seen;
1788 1793
diff --git a/html.c b/html.c
index cb30eec..8ffa2be 100644
--- a/html.c
+++ b/html.c
@@ -4020,7 +4020,7 @@ int html_get_handler(const xs_dict *req, const char *q_path,
4020 const char *b64 = xs_dict_get(q_vars, "content"); 4020 const char *b64 = xs_dict_get(q_vars, "content");
4021 int sz; 4021 int sz;
4022 xs *content = xs_base64_dec(b64, &sz); 4022 xs *content = xs_base64_dec(b64, &sz);
4023 xs *msg = msg_note(&snac, content, NULL, NULL, NULL, 0, NULL); 4023 xs *msg = msg_note(&snac, content, NULL, NULL, NULL, 0, NULL, NULL);
4024 xs *c_msg = msg_create(&snac, msg); 4024 xs *c_msg = msg_create(&snac, msg);
4025 4025
4026 timeline_add(&snac, xs_dict_get(msg, "id"), msg); 4026 timeline_add(&snac, xs_dict_get(msg, "id"), msg);
@@ -4220,7 +4220,7 @@ int html_post_handler(const xs_dict *req, const char *q_path,
4220 enqueue_close_question(&snac, xs_dict_get(msg, "id"), end_secs); 4220 enqueue_close_question(&snac, xs_dict_get(msg, "id"), end_secs);
4221 } 4221 }
4222 else 4222 else
4223 msg = msg_note(&snac, content_2, to, in_reply_to, attach_list, priv, NULL); 4223 msg = msg_note(&snac, content_2, to, in_reply_to, attach_list, priv, NULL, NULL);
4224 4224
4225 if (sensitive != NULL) { 4225 if (sensitive != NULL) {
4226 msg = xs_dict_set(msg, "sensitive", xs_stock(XSTYPE_TRUE)); 4226 msg = xs_dict_set(msg, "sensitive", xs_stock(XSTYPE_TRUE));
@@ -4659,7 +4659,7 @@ int html_post_handler(const xs_dict *req, const char *q_path,
4659 int c = 0; 4659 int c = 0;
4660 4660
4661 while (xs_list_next(ls, &v, &c)) { 4661 while (xs_list_next(ls, &v, &c)) {
4662 xs *msg = msg_note(&snac, "", actor, irt, NULL, 1, NULL); 4662 xs *msg = msg_note(&snac, "", actor, irt, NULL, 1, NULL, NULL);
4663 4663
4664 /* set the option */ 4664 /* set the option */
4665 msg = xs_dict_append(msg, "name", v); 4665 msg = xs_dict_append(msg, "name", v);
diff --git a/main.c b/main.c
index a4ea961..3cd4524 100644
--- a/main.c
+++ b/main.c
@@ -710,7 +710,7 @@ int main(int argc, char *argv[])
710 if (strcmp(cmd, "note_unlisted") == 0) 710 if (strcmp(cmd, "note_unlisted") == 0)
711 scope = 2; 711 scope = 2;
712 712
713 msg = msg_note(&snac, content, NULL, NULL, attl, scope, getenv("LANG")); 713 msg = msg_note(&snac, content, NULL, NULL, attl, scope, getenv("LANG"), NULL);
714 714
715 c_msg = msg_create(&snac, msg); 715 c_msg = msg_create(&snac, msg);
716 716
diff --git a/mastoapi.c b/mastoapi.c
index 797a4da..25b17e2 100644
--- a/mastoapi.c
+++ b/mastoapi.c
@@ -2628,6 +2628,7 @@ int mastoapi_post_handler(const xs_dict *req, const char *q_path,
2628 const char *summary = xs_dict_get(args, "spoiler_text"); 2628 const char *summary = xs_dict_get(args, "spoiler_text");
2629 const char *media_ids = xs_dict_get(args, "media_ids"); 2629 const char *media_ids = xs_dict_get(args, "media_ids");
2630 const char *language = xs_dict_get(args, "language"); 2630 const char *language = xs_dict_get(args, "language");
2631 const char *sched_date = xs_dict_get(args, "scheduled_at");
2631 2632
2632 if (xs_is_null(media_ids)) 2633 if (xs_is_null(media_ids))
2633 media_ids = xs_dict_get(args, "media_ids[]"); 2634 media_ids = xs_dict_get(args, "media_ids[]");
@@ -2684,7 +2685,7 @@ int mastoapi_post_handler(const xs_dict *req, const char *q_path,
2684 if (strcmp(visibility, "public") == 0) 2685 if (strcmp(visibility, "public") == 0)
2685 scope = 0; 2686 scope = 0;
2686 2687
2687 xs *msg = msg_note(&snac, content, NULL, irt, attach_list, scope, language); 2688 xs *msg = msg_note(&snac, content, NULL, irt, attach_list, scope, language, sched_date);
2688 2689
2689 if (!xs_is_null(summary) && *summary) { 2690 if (!xs_is_null(summary) && *summary) {
2690 msg = xs_dict_set(msg, "sensitive", xs_stock(XSTYPE_TRUE)); 2691 msg = xs_dict_set(msg, "sensitive", xs_stock(XSTYPE_TRUE));
@@ -3034,7 +3035,7 @@ int mastoapi_post_handler(const xs_dict *req, const char *q_path,
3034 if (o) { 3035 if (o) {
3035 const char *name = xs_dict_get(o, "name"); 3036 const char *name = xs_dict_get(o, "name");
3036 3037
3037 xs *msg = msg_note(&snac, "", atto, (char *)id, NULL, 1, NULL); 3038 xs *msg = msg_note(&snac, "", atto, (char *)id, NULL, 1, NULL, NULL);
3038 msg = xs_dict_append(msg, "name", name); 3039 msg = xs_dict_append(msg, "name", name);
3039 3040
3040 xs *c_msg = msg_create(&snac, msg); 3041 xs *c_msg = msg_create(&snac, msg);
diff --git a/snac.h b/snac.h
index ac1abcd..ac30c44 100644
--- a/snac.h
+++ b/snac.h
@@ -329,7 +329,7 @@ xs_dict *msg_follow(snac *snac, const char *actor);
329 329
330xs_dict *msg_note(snac *snac, const xs_str *content, const xs_val *rcpts, 330xs_dict *msg_note(snac *snac, const xs_str *content, const xs_val *rcpts,
331 const xs_str *in_reply_to, const xs_list *attach, 331 const xs_str *in_reply_to, const xs_list *attach,
332 int scope, const char *lang); 332 int scope, const char *lang_str, const char *msg_date);
333 333
334xs_dict *msg_undo(snac *snac, const xs_val *object); 334xs_dict *msg_undo(snac *snac, const xs_val *object);
335xs_dict *msg_delete(snac *snac, const char *id); 335xs_dict *msg_delete(snac *snac, const char *id);