Create the base message of msg_question() from msg_note().

This commit is contained in:
default 2023-05-30 05:54:45 +02:00
parent 7659362448
commit be39b52064
3 changed files with 7 additions and 6 deletions

View File

@ -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;

2
main.c
View File

@ -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) {

3
snac.h
View File

@ -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);