summaryrefslogtreecommitdiff
path: root/activitypub.c
diff options
context:
space:
mode:
authorGravatar default2025-03-02 06:04:52 +0100
committerGravatar default2025-03-02 06:04:52 +0100
commit8bd364bd49116b8b335272300ca05f25e1267df7 (patch)
tree662125524613d1d1309edc990fe143b19e510a49 /activitypub.c
parentUpdated documentation. (diff)
downloadsnac2-8bd364bd49116b8b335272300ca05f25e1267df7.tar.gz
snac2-8bd364bd49116b8b335272300ca05f25e1267df7.tar.xz
snac2-8bd364bd49116b8b335272300ca05f25e1267df7.zip
msg_note() accepts a nullable post date.
Diffstat (limited to 'activitypub.c')
-rw-r--r--activitypub.c11
1 files changed, 8 insertions, 3 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