mirror of
https://codeberg.org/grunfink/snac2.git
synced 2024-11-22 05:15:04 +00:00
Use static_get_meta() when preparing the attachment.
This commit is contained in:
parent
8c4850df50
commit
66d5acc822
3 changed files with 9 additions and 7 deletions
4
data.c
4
data.c
|
@ -1366,7 +1366,7 @@ void static_put(snac *snac, const char *id, const char *data, int size)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void status_put_meta(snac *snac, const char *id, const char *str)
|
void static_put_meta(snac *snac, const char *id, const char *str)
|
||||||
/* puts metadata (i.e. a media description string) to id */
|
/* puts metadata (i.e. a media description string) to id */
|
||||||
{
|
{
|
||||||
xs *fn = _static_fn(snac, id);
|
xs *fn = _static_fn(snac, id);
|
||||||
|
@ -1380,7 +1380,7 @@ void status_put_meta(snac *snac, const char *id, const char *str)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
xs_str *status_get_meta(snac *snac, const char *id)
|
xs_str *static_get_meta(snac *snac, const char *id)
|
||||||
/* gets metadata from a media */
|
/* gets metadata from a media */
|
||||||
{
|
{
|
||||||
xs *fn = _static_fn(snac, id);
|
xs *fn = _static_fn(snac, id);
|
||||||
|
|
|
@ -1303,11 +1303,12 @@ int mastoapi_post_handler(const xs_dict *req, const char *q_path,
|
||||||
xs_str *v;
|
xs_str *v;
|
||||||
|
|
||||||
while (xs_list_iter(&p, &v)) {
|
while (xs_list_iter(&p, &v)) {
|
||||||
xs *l = xs_list_new();
|
xs *l = xs_list_new();
|
||||||
xs *url = xs_fmt("%s/s/%s", snac.actor, v);
|
xs *url = xs_fmt("%s/s/%s", snac.actor, v);
|
||||||
|
xs *desc = static_get_meta(&snac, v);
|
||||||
|
|
||||||
l = xs_list_append(l, url);
|
l = xs_list_append(l, url);
|
||||||
l = xs_list_append(l, "");
|
l = xs_list_append(l, desc);
|
||||||
|
|
||||||
attach_list = xs_list_append(attach_list, l);
|
attach_list = xs_list_append(attach_list, l);
|
||||||
}
|
}
|
||||||
|
@ -1498,6 +1499,7 @@ int mastoapi_post_handler(const xs_dict *req, const char *q_path,
|
||||||
|
|
||||||
/* store */
|
/* store */
|
||||||
static_put(&snac, id, payload + fo, fs);
|
static_put(&snac, id, payload + fo, fs);
|
||||||
|
static_put_meta(&snac, id, desc);
|
||||||
|
|
||||||
/* prepare a response */
|
/* prepare a response */
|
||||||
xs *rsp = xs_dict_new();
|
xs *rsp = xs_dict_new();
|
||||||
|
|
4
snac.h
4
snac.h
|
@ -130,8 +130,8 @@ int actor_get(snac *snac, const char *actor, d_char **data);
|
||||||
|
|
||||||
int static_get(snac *snac, const char *id, d_char **data, int *size);
|
int static_get(snac *snac, const char *id, d_char **data, int *size);
|
||||||
void static_put(snac *snac, const char *id, const char *data, int size);
|
void static_put(snac *snac, const char *id, const char *data, int size);
|
||||||
void status_put_meta(snac *snac, const char *id, const char *str);
|
void static_put_meta(snac *snac, const char *id, const char *str);
|
||||||
xs_str *status_get_meta(snac *snac, const char *id);
|
xs_str *static_get_meta(snac *snac, const char *id);
|
||||||
|
|
||||||
double history_mtime(snac *snac, char *id);
|
double history_mtime(snac *snac, char *id);
|
||||||
void history_add(snac *snac, char *id, char *content, int size);
|
void history_add(snac *snac, char *id, char *content, int size);
|
||||||
|
|
Loading…
Reference in a new issue