summaryrefslogtreecommitdiff
path: root/activitypub.c
diff options
context:
space:
mode:
authorGravatar Stefano Marinelli2025-10-21 12:29:56 +0200
committerGravatar Stefano Marinelli2025-10-21 12:29:56 +0200
commitbebb2c7439ecdef0266f47dc4b05ab093259e63b (patch)
tree9b7c90f92bf89a3474eaacb3bcc0e5ec1fbd4b65 /activitypub.c
parentEnhances Mastodon API compatibility by adding support for displaying remote u... (diff)
downloadpenes-snac2-bebb2c7439ecdef0266f47dc4b05ab093259e63b.tar.gz
penes-snac2-bebb2c7439ecdef0266f47dc4b05ab093259e63b.tar.xz
penes-snac2-bebb2c7439ecdef0266f47dc4b05ab093259e63b.zip
Instead of comparing the output status with == 200, it's better to check using valid_status()
Diffstat (limited to 'activitypub.c')
-rw-r--r--activitypub.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/activitypub.c b/activitypub.c
index 117bbc9..2d53cbe 100644
--- a/activitypub.c
+++ b/activitypub.c
@@ -141,7 +141,7 @@ static xs_dict *actor_get_collections(snac *user, xs_dict *actor, int throttle)
141 /* only fetch followers count if not already present */ 141 /* only fetch followers count if not already present */
142 if (xs_type(existing_followers) != XSTYPE_NUMBER && !xs_is_null(followers_url)) { 142 if (xs_type(existing_followers) != XSTYPE_NUMBER && !xs_is_null(followers_url)) {
143 xs *followers_coll = NULL; 143 xs *followers_coll = NULL;
144 if (activitypub_request(user, followers_url, &followers_coll) == 200) { 144 if (valid_status(activitypub_request(user, followers_url, &followers_coll))) {
145 const xs_number *total = xs_dict_get(followers_coll, "totalItems"); 145 const xs_number *total = xs_dict_get(followers_coll, "totalItems");
146 if (xs_type(total) == XSTYPE_NUMBER) { 146 if (xs_type(total) == XSTYPE_NUMBER) {
147 xs *total_copy = xs_dup(total); 147 xs *total_copy = xs_dup(total);
@@ -156,7 +156,7 @@ static xs_dict *actor_get_collections(snac *user, xs_dict *actor, int throttle)
156 /* only fetch following count if not already present */ 156 /* only fetch following count if not already present */
157 if (xs_type(existing_following) != XSTYPE_NUMBER && !xs_is_null(following_url)) { 157 if (xs_type(existing_following) != XSTYPE_NUMBER && !xs_is_null(following_url)) {
158 xs *following_coll = NULL; 158 xs *following_coll = NULL;
159 if (activitypub_request(user, following_url, &following_coll) == 200) { 159 if (valid_status(activitypub_request(user, following_url, &following_coll))) {
160 const xs_number *total = xs_dict_get(following_coll, "totalItems"); 160 const xs_number *total = xs_dict_get(following_coll, "totalItems");
161 if (xs_type(total) == XSTYPE_NUMBER) { 161 if (xs_type(total) == XSTYPE_NUMBER) {
162 xs *total_copy = xs_dup(total); 162 xs *total_copy = xs_dup(total);
@@ -171,7 +171,7 @@ static xs_dict *actor_get_collections(snac *user, xs_dict *actor, int throttle)
171 /* only fetch statuses count if not already present */ 171 /* only fetch statuses count if not already present */
172 if (xs_type(existing_statuses) != XSTYPE_NUMBER && !xs_is_null(outbox_url)) { 172 if (xs_type(existing_statuses) != XSTYPE_NUMBER && !xs_is_null(outbox_url)) {
173 xs *outbox_coll = NULL; 173 xs *outbox_coll = NULL;
174 if (activitypub_request(user, outbox_url, &outbox_coll) == 200) { 174 if (valid_status(activitypub_request(user, outbox_url, &outbox_coll))) {
175 const xs_number *total = xs_dict_get(outbox_coll, "totalItems"); 175 const xs_number *total = xs_dict_get(outbox_coll, "totalItems");
176 if (xs_type(total) == XSTYPE_NUMBER) { 176 if (xs_type(total) == XSTYPE_NUMBER) {
177 xs *total_copy = xs_dup(total); 177 xs *total_copy = xs_dup(total);