commit be39b52
default
·
2023-05-30 03:54:45 +0000 UTC
parent 7659362
Create the base message of msg_question() from msg_note().
3 files changed,
+7,
-6
+4,
-4
1@@ -932,15 +932,15 @@ xs_dict *msg_pong(snac *user, const char *rcpt, const char *object)
2 }
3
4
5-xs_dict *msg_question(snac *user, const char *content, const xs_list *opts, int multiple, int end_secs)
6+xs_dict *msg_question(snac *user, const char *content, xs_list *attach,
7+ const xs_list *opts, int multiple, int end_secs)
8 /* creates a Question message */
9 {
10 xs *ntid = tid(0);
11 xs *id = xs_fmt("%s/q/%s", user->actor, ntid);
12- xs_dict *msg = msg_base(user, "Question", id, NULL, "@now", NULL);
13+ xs_dict *msg = msg_note(user, content, NULL, NULL, attach, 0);
14
15- msg = xs_dict_append(msg, "content", content);
16- msg = xs_dict_append(msg, "attributedTo", user->actor);
17+ msg = xs_dict_set(msg, "type", "Question");
18
19 xs *o = xs_list_new();
20 xs_list *p = (xs_list *)opts;
M
main.c
+1,
-1
1@@ -256,7 +256,7 @@ int main(int argc, char *argv[])
2 int end_secs = 5 * 60;
3 xs *opts = xs_split(url, ";");
4
5- xs *msg = msg_question(&snac, "Poll", opts, 0, end_secs);
6+ xs *msg = msg_question(&snac, "Poll", NULL, opts, 0, end_secs);
7 xs *c_msg = msg_create(&snac, msg);
8
9 if (dbglevel) {
M
snac.h
+2,
-1
1@@ -208,7 +208,8 @@ d_char *msg_actor(snac *snac);
2 xs_dict *msg_update(snac *snac, xs_dict *object);
3 xs_dict *msg_ping(snac *user, const char *rcpt);
4 xs_dict *msg_pong(snac *user, const char *rcpt, const char *object);
5-xs_dict *msg_question(snac *user, const char *content, const xs_list *opts, int multiple, int end_secs);
6+xs_dict *msg_question(snac *user, const char *content, xs_list *attach,
7+ const xs_list *opts, int multiple, int end_secs);
8
9 int activitypub_request(snac *snac, const char *url, xs_dict **data);
10 int actor_request(snac *snac, const char *actor, xs_dict **data);