summaryrefslogtreecommitdiff
path: root/mastoapi.c
diff options
context:
space:
mode:
authorGravatar default2023-04-24 17:49:08 +0200
committerGravatar default2023-04-24 17:49:08 +0200
commit3fb91ea25ae5b90493602427efc51fbe2440c3bf (patch)
treea3d90cfa4f116dc8453e6fd635f64a82ba346bd4 /mastoapi.c
parentAdded emojis to mastoapi_account(). (diff)
downloadsnac2-3fb91ea25ae5b90493602427efc51fbe2440c3bf.tar.gz
snac2-3fb91ea25ae5b90493602427efc51fbe2440c3bf.tar.xz
snac2-3fb91ea25ae5b90493602427efc51fbe2440c3bf.zip
Skip muted morons from timelines and statuses.
Diffstat (limited to 'mastoapi.c')
-rw-r--r--mastoapi.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/mastoapi.c b/mastoapi.c
index 8697ac2..61a12cd 100644
--- a/mastoapi.c
+++ b/mastoapi.c
@@ -994,6 +994,10 @@ int mastoapi_get_handler(const xs_dict *req, const char *q_path,
994 if (strcmp(xs_dict_get(msg, "type"), "Note") != 0) 994 if (strcmp(xs_dict_get(msg, "type"), "Note") != 0)
995 continue; 995 continue;
996 996
997 /* drop notes from muted morons */
998 if (is_muted(&snac1, xs_dict_get(msg, "attributedTo")))
999 continue;
1000
997 /* convert the Note into a Mastodon status */ 1001 /* convert the Note into a Mastodon status */
998 xs *st = mastoapi_status(&snac1, msg); 1002 xs *st = mastoapi_status(&snac1, msg);
999 1003
@@ -1293,7 +1297,7 @@ int mastoapi_get_handler(const xs_dict *req, const char *q_path,
1293 } 1297 }
1294 else 1298 else
1295 if (xs_startswith(cmd, "/v1/statuses/")) { 1299 if (xs_startswith(cmd, "/v1/statuses/")) {
1296 /* operations on a status */ 1300 /* information about a status */
1297 xs *l = xs_split(cmd, "/"); 1301 xs *l = xs_split(cmd, "/");
1298 const char *id = xs_list_get(l, 3); 1302 const char *id = xs_list_get(l, 3);
1299 const char *op = xs_list_get(l, 4); 1303 const char *op = xs_list_get(l, 4);
@@ -1307,8 +1311,10 @@ int mastoapi_get_handler(const xs_dict *req, const char *q_path,
1307 1311
1308 if (valid_status(timeline_get_by_md5(&snac1, id, &msg))) { 1312 if (valid_status(timeline_get_by_md5(&snac1, id, &msg))) {
1309 if (op == NULL) { 1313 if (op == NULL) {
1310 /* return the status itself */ 1314 if (!is_muted(&snac1, xs_dict_get(msg, "attributedTo"))) {
1311 out = mastoapi_status(&snac1, msg); 1315 /* return the status itself */
1316 out = mastoapi_status(&snac1, msg);
1317 }
1312 } 1318 }
1313 else 1319 else
1314 if (strcmp(op, "context") == 0) { 1320 if (strcmp(op, "context") == 0) {