mirror of
https://codeberg.org/grunfink/snac2.git
synced 2024-11-10 03:50:38 +03:00
Minor refactor to msg_note().
This commit is contained in:
parent
63053ab5db
commit
f136426a25
@ -772,7 +772,7 @@ xs_dict *msg_note(snac *snac, const xs_str *content, const xs_val *rcpts,
|
|||||||
xs *cc = xs_list_new();
|
xs *cc = xs_list_new();
|
||||||
xs *irt = NULL;
|
xs *irt = NULL;
|
||||||
xs *tag = xs_list_new();
|
xs *tag = xs_list_new();
|
||||||
xs *atls = NULL;
|
xs *atls = xs_list_new();
|
||||||
xs_dict *msg = msg_base(snac, "Note", id, NULL, "@now", NULL);
|
xs_dict *msg = msg_base(snac, "Note", id, NULL, "@now", NULL);
|
||||||
xs_list *p;
|
xs_list *p;
|
||||||
xs_val *v;
|
xs_val *v;
|
||||||
@ -838,10 +838,8 @@ xs_dict *msg_note(snac *snac, const xs_str *content, const xs_val *rcpts,
|
|||||||
|
|
||||||
/* create the attachment list, if there are any */
|
/* create the attachment list, if there are any */
|
||||||
if (!xs_is_null(attach)) {
|
if (!xs_is_null(attach)) {
|
||||||
atls = xs_list_new();
|
|
||||||
|
|
||||||
while (xs_list_iter(&attach, &v)) {
|
while (xs_list_iter(&attach, &v)) {
|
||||||
xs *d = xs_dict_new();
|
xs *d = xs_dict_new();
|
||||||
char *url = xs_list_get(v, 0);
|
char *url = xs_list_get(v, 0);
|
||||||
char *alt = xs_list_get(v, 1);
|
char *alt = xs_list_get(v, 1);
|
||||||
char *mime = xs_mime_by_ext(url);
|
char *mime = xs_mime_by_ext(url);
|
||||||
@ -897,7 +895,7 @@ xs_dict *msg_note(snac *snac, const xs_str *content, const xs_val *rcpts,
|
|||||||
|
|
||||||
msg = xs_dict_append(msg, "sourceContent", content);
|
msg = xs_dict_append(msg, "sourceContent", content);
|
||||||
|
|
||||||
if (atls != NULL)
|
if (xs_list_len(atls))
|
||||||
msg = xs_dict_append(msg, "attachment", atls);
|
msg = xs_dict_append(msg, "attachment", atls);
|
||||||
|
|
||||||
return msg;
|
return msg;
|
||||||
|
Loading…
Reference in New Issue
Block a user