summaryrefslogtreecommitdiff
path: root/mastoapi.c
diff options
context:
space:
mode:
authorGravatar default2025-01-05 09:34:00 +0100
committerGravatar default2025-01-05 09:34:00 +0100
commit3a1cae73265aebdbe678d94fbdc16edf3ccc643f (patch)
tree3c50341495d370dfeb7bfe0312ad5644d9c8f865 /mastoapi.c
parentUse the site's CSS in the /share page. (diff)
downloadpenes-snac2-3a1cae73265aebdbe678d94fbdc16edf3ccc643f.tar.gz
penes-snac2-3a1cae73265aebdbe678d94fbdc16edf3ccc643f.tar.xz
penes-snac2-3a1cae73265aebdbe678d94fbdc16edf3ccc643f.zip
Moved post language setting to msg_note(), where it really belongs.
On the way, posting from the Mastodon API sets the language accordingly.
Diffstat (limited to 'mastoapi.c')
-rw-r--r--mastoapi.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/mastoapi.c b/mastoapi.c
index 853d74b..62108ad 100644
--- a/mastoapi.c
+++ b/mastoapi.c
@@ -2600,6 +2600,7 @@ int mastoapi_post_handler(const xs_dict *req, const char *q_path,
2600 const char *visibility = xs_dict_get(args, "visibility"); 2600 const char *visibility = xs_dict_get(args, "visibility");
2601 const char *summary = xs_dict_get(args, "spoiler_text"); 2601 const char *summary = xs_dict_get(args, "spoiler_text");
2602 const char *media_ids = xs_dict_get(args, "media_ids"); 2602 const char *media_ids = xs_dict_get(args, "media_ids");
2603 const char *language = xs_dict_get(args, "language");
2603 2604
2604 if (xs_is_null(media_ids)) 2605 if (xs_is_null(media_ids))
2605 media_ids = xs_dict_get(args, "media_ids[]"); 2606 media_ids = xs_dict_get(args, "media_ids[]");
@@ -2650,7 +2651,7 @@ int mastoapi_post_handler(const xs_dict *req, const char *q_path,
2650 2651
2651 /* prepare the message */ 2652 /* prepare the message */
2652 xs *msg = msg_note(&snac, content, NULL, irt, attach_list, 2653 xs *msg = msg_note(&snac, content, NULL, irt, attach_list,
2653 strcmp(visibility, "public") == 0 ? 0 : 1); 2654 strcmp(visibility, "public") == 0 ? 0 : 1, language);
2654 2655
2655 if (!xs_is_null(summary) && *summary) { 2656 if (!xs_is_null(summary) && *summary) {
2656 msg = xs_dict_set(msg, "sensitive", xs_stock(XSTYPE_TRUE)); 2657 msg = xs_dict_set(msg, "sensitive", xs_stock(XSTYPE_TRUE));
@@ -3000,7 +3001,7 @@ int mastoapi_post_handler(const xs_dict *req, const char *q_path,
3000 if (o) { 3001 if (o) {
3001 const char *name = xs_dict_get(o, "name"); 3002 const char *name = xs_dict_get(o, "name");
3002 3003
3003 xs *msg = msg_note(&snac, "", atto, (char *)id, NULL, 1); 3004 xs *msg = msg_note(&snac, "", atto, (char *)id, NULL, 1, NULL);
3004 msg = xs_dict_append(msg, "name", name); 3005 msg = xs_dict_append(msg, "name", name);
3005 3006
3006 xs *c_msg = msg_create(&snac, msg); 3007 xs *c_msg = msg_create(&snac, msg);