diff options
| author | 2023-06-07 11:39:13 +0200 | |
|---|---|---|
| committer | 2023-06-07 11:39:13 +0200 | |
| commit | e926fa23098f594b52d560f20043fd1a47329848 (patch) | |
| tree | d3a632cc3696e28f16f15856c6f0b96b200c9f3a /activitypub.c | |
| parent | New function timeline_request_replies(). (diff) | |
| download | snac2-e926fa23098f594b52d560f20043fd1a47329848.tar.gz snac2-e926fa23098f594b52d560f20043fd1a47329848.tar.xz snac2-e926fa23098f594b52d560f20043fd1a47329848.zip | |
Changed timeline_request_replies() to receive an id and not an object.
Diffstat (limited to 'activitypub.c')
| -rw-r--r-- | activitypub.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/activitypub.c b/activitypub.c index 06d4117..f9e7077 100644 --- a/activitypub.c +++ b/activitypub.c | |||
| @@ -143,7 +143,7 @@ int actor_request(snac *snac, const char *actor, xs_dict **data) | |||
| 143 | } | 143 | } |
| 144 | 144 | ||
| 145 | 145 | ||
| 146 | void timeline_request_replies(snac *user, const xs_dict *msg); | 146 | void timeline_request_replies(snac *user, const char *id); |
| 147 | 147 | ||
| 148 | int timeline_request(snac *snac, char **id, xs_str **wrk) | 148 | int timeline_request(snac *snac, char **id, xs_str **wrk) |
| 149 | /* ensures that an entry and its ancestors are in the timeline */ | 149 | /* ensures that an entry and its ancestors are in the timeline */ |
| @@ -191,18 +191,22 @@ int timeline_request(snac *snac, char **id, xs_str **wrk) | |||
| 191 | } | 191 | } |
| 192 | } | 192 | } |
| 193 | 193 | ||
| 194 | if (object) | 194 | timeline_request_replies(snac, *id); |
| 195 | timeline_request_replies(snac, object); | ||
| 196 | } | 195 | } |
| 197 | 196 | ||
| 198 | return status; | 197 | return status; |
| 199 | } | 198 | } |
| 200 | 199 | ||
| 201 | 200 | ||
| 202 | void timeline_request_replies(snac *user, const xs_dict *msg) | 201 | void timeline_request_replies(snac *user, const char *id) |
| 203 | /* requests all replies of a message */ | 202 | /* requests all replies of a message */ |
| 204 | /* FIXME: experimental -- needs more testing */ | 203 | /* FIXME: experimental -- needs more testing */ |
| 205 | { | 204 | { |
| 205 | xs *msg = NULL; | ||
| 206 | |||
| 207 | if (!valid_status(object_get(id, &msg))) | ||
| 208 | return; | ||
| 209 | |||
| 206 | /* does it have a replies collection? */ | 210 | /* does it have a replies collection? */ |
| 207 | const xs_dict *replies = xs_dict_get(msg, "replies"); | 211 | const xs_dict *replies = xs_dict_get(msg, "replies"); |
| 208 | 212 | ||
| @@ -247,7 +251,7 @@ void timeline_request_replies(snac *user, const xs_dict *msg) | |||
| 247 | } | 251 | } |
| 248 | } | 252 | } |
| 249 | else | 253 | else |
| 250 | snac_debug(user, 0, xs_fmt("reply collection get %s %d", next, status)); | 254 | snac_debug(user, 0, xs_fmt("replies request error %s %d", next, status)); |
| 251 | } | 255 | } |
| 252 | } | 256 | } |
| 253 | } | 257 | } |