From be39b52064771b94e8e28f45a6f43ce32dfcf87d Mon Sep 17 00:00:00 2001 From: default Date: Tue, 30 May 2023 05:54:45 +0200 Subject: [PATCH] Create the base message of msg_question() from msg_note(). --- activitypub.c | 8 ++++---- main.c | 2 +- snac.h | 3 ++- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/activitypub.c b/activitypub.c index 15937c3..e9db6ba 100644 --- a/activitypub.c +++ b/activitypub.c @@ -932,15 +932,15 @@ xs_dict *msg_pong(snac *user, const char *rcpt, const char *object) } -xs_dict *msg_question(snac *user, const char *content, const xs_list *opts, int multiple, int end_secs) +xs_dict *msg_question(snac *user, const char *content, xs_list *attach, + const xs_list *opts, int multiple, int end_secs) /* creates a Question message */ { xs *ntid = tid(0); xs *id = xs_fmt("%s/q/%s", user->actor, ntid); - xs_dict *msg = msg_base(user, "Question", id, NULL, "@now", NULL); + xs_dict *msg = msg_note(user, content, NULL, NULL, attach, 0); - msg = xs_dict_append(msg, "content", content); - msg = xs_dict_append(msg, "attributedTo", user->actor); + msg = xs_dict_set(msg, "type", "Question"); xs *o = xs_list_new(); xs_list *p = (xs_list *)opts; diff --git a/main.c b/main.c index d378598..e8309c4 100644 --- a/main.c +++ b/main.c @@ -256,7 +256,7 @@ int main(int argc, char *argv[]) int end_secs = 5 * 60; xs *opts = xs_split(url, ";"); - xs *msg = msg_question(&snac, "Poll", opts, 0, end_secs); + xs *msg = msg_question(&snac, "Poll", NULL, opts, 0, end_secs); xs *c_msg = msg_create(&snac, msg); if (dbglevel) { diff --git a/snac.h b/snac.h index 60b31c0..33f3a85 100644 --- a/snac.h +++ b/snac.h @@ -208,7 +208,8 @@ d_char *msg_actor(snac *snac); xs_dict *msg_update(snac *snac, xs_dict *object); xs_dict *msg_ping(snac *user, const char *rcpt); xs_dict *msg_pong(snac *user, const char *rcpt, const char *object); -xs_dict *msg_question(snac *user, const char *content, const xs_list *opts, int multiple, int end_secs); +xs_dict *msg_question(snac *user, const char *content, xs_list *attach, + const xs_list *opts, int multiple, int end_secs); int activitypub_request(snac *snac, const char *url, xs_dict **data); int actor_request(snac *snac, const char *actor, xs_dict **data);