Updated some data types.

This commit is contained in:
default 2023-06-04 10:34:39 +02:00
parent c69d0c1878
commit 3a8005f9bf
2 changed files with 25 additions and 25 deletions

View File

@ -669,10 +669,10 @@ xs_dict *msg_base(snac *snac, const char *type, const char *id,
} }
d_char *msg_collection(snac *snac, char *id) xs_dict *msg_collection(snac *snac, char *id)
/* creates an empty OrderedCollection message */ /* creates an empty OrderedCollection message */
{ {
d_char *msg = msg_base(snac, "OrderedCollection", id, NULL, NULL, NULL); xs_dict *msg = msg_base(snac, "OrderedCollection", id, NULL, NULL, NULL);
xs *ol = xs_list_new(); xs *ol = xs_list_new();
xs *nz = xs_number_new(0); xs *nz = xs_number_new(0);
@ -684,10 +684,10 @@ d_char *msg_collection(snac *snac, char *id)
} }
d_char *msg_accept(snac *snac, char *object, char *to) xs_dict *msg_accept(snac *snac, char *object, char *to)
/* creates an Accept message (as a response to a Follow) */ /* creates an Accept message (as a response to a Follow) */
{ {
d_char *msg = msg_base(snac, "Accept", "@dummy", snac->actor, NULL, object); xs_dict *msg = msg_base(snac, "Accept", "@dummy", snac->actor, NULL, object);
msg = xs_dict_append(msg, "to", to); msg = xs_dict_append(msg, "to", to);
@ -723,11 +723,11 @@ xs_dict *msg_update(snac *snac, xs_dict *object)
} }
d_char *msg_admiration(snac *snac, char *object, char *type) xs_dict *msg_admiration(snac *snac, char *object, char *type)
/* creates a Like or Announce message */ /* creates a Like or Announce message */
{ {
xs *a_msg = NULL; xs *a_msg = NULL;
d_char *msg = NULL; xs_dict *msg = NULL;
xs *wrk = NULL; xs *wrk = NULL;
/* call the object */ /* call the object */
@ -752,7 +752,7 @@ d_char *msg_admiration(snac *snac, char *object, char *type)
} }
d_char *msg_actor(snac *snac) xs_dict *msg_actor(snac *snac)
/* create a Person message for this actor */ /* create a Person message for this actor */
{ {
xs *ctxt = xs_list_new(); xs *ctxt = xs_list_new();
@ -761,7 +761,7 @@ d_char *msg_actor(snac *snac)
xs *avtr = NULL; xs *avtr = NULL;
xs *kid = NULL; xs *kid = NULL;
xs *f_bio = NULL; xs *f_bio = NULL;
d_char *msg = msg_base(snac, "Person", snac->actor, NULL, NULL, NULL); xs_dict *msg = msg_base(snac, "Person", snac->actor, NULL, NULL, NULL);
char *p; char *p;
int n; int n;
@ -828,10 +828,10 @@ xs_dict *msg_create(snac *snac, const xs_dict *object)
} }
d_char *msg_undo(snac *snac, char *object) xs_dict *msg_undo(snac *snac, char *object)
/* creates an 'Undo' message */ /* creates an 'Undo' message */
{ {
d_char *msg = msg_base(snac, "Undo", "@object", snac->actor, "@now", object); xs_dict *msg = msg_base(snac, "Undo", "@object", snac->actor, "@now", object);
msg = xs_dict_append(msg, "to", xs_dict_get(object, "object")); msg = xs_dict_append(msg, "to", xs_dict_get(object, "object"));
@ -839,11 +839,11 @@ d_char *msg_undo(snac *snac, char *object)
} }
d_char *msg_delete(snac *snac, char *id) xs_dict *msg_delete(snac *snac, char *id)
/* creates a 'Delete' + 'Tombstone' for a local entry */ /* creates a 'Delete' + 'Tombstone' for a local entry */
{ {
xs *tomb = xs_dict_new(); xs *tomb = xs_dict_new();
d_char *msg = NULL; xs_dict *msg = NULL;
/* sculpt the tombstone */ /* sculpt the tombstone */
tomb = xs_dict_append(tomb, "type", "Tombstone"); tomb = xs_dict_append(tomb, "type", "Tombstone");
@ -863,7 +863,7 @@ xs_dict *msg_follow(snac *snac, const char *q)
{ {
xs *actor_o = NULL; xs *actor_o = NULL;
xs *actor = NULL; xs *actor = NULL;
d_char *msg = NULL; xs_dict *msg = NULL;
int status; int status;
xs *url_or_uid = xs_strip_i(xs_str_new(q)); xs *url_or_uid = xs_strip_i(xs_str_new(q));

8
snac.h
View File

@ -196,16 +196,16 @@ int webfinger_get_handler(xs_dict *req, char *q_path,
const char *default_avatar_base64(void); const char *default_avatar_base64(void);
d_char *msg_admiration(snac *snac, char *object, char *type); xs_dict *msg_admiration(snac *snac, char *object, char *type);
xs_dict *msg_create(snac *snac, const xs_dict *object); xs_dict *msg_create(snac *snac, const xs_dict *object);
xs_dict *msg_follow(snac *snac, const char *actor); xs_dict *msg_follow(snac *snac, const char *actor);
xs_dict *msg_note(snac *snac, const xs_str *content, const xs_val *rcpts, xs_dict *msg_note(snac *snac, const xs_str *content, const xs_val *rcpts,
xs_str *in_reply_to, xs_list *attach, int priv); xs_str *in_reply_to, xs_list *attach, int priv);
d_char *msg_undo(snac *snac, char *object); xs_dict *msg_undo(snac *snac, char *object);
d_char *msg_delete(snac *snac, char *id); xs_dict *msg_delete(snac *snac, char *id);
d_char *msg_actor(snac *snac); xs_dict *msg_actor(snac *snac);
xs_dict *msg_update(snac *snac, xs_dict *object); xs_dict *msg_update(snac *snac, xs_dict *object);
xs_dict *msg_ping(snac *user, const char *rcpt); xs_dict *msg_ping(snac *user, const char *rcpt);
xs_dict *msg_pong(snac *user, const char *rcpt, const char *object); xs_dict *msg_pong(snac *user, const char *rcpt, const char *object);