diff options
| author | 2024-03-12 17:54:54 +0100 | |
|---|---|---|
| committer | 2024-03-12 17:54:54 +0100 | |
| commit | f485dbdaf0f6372b9815be3d78ae2839e80d6946 (patch) | |
| tree | b7ddb23b52f9a199fd38f85168f46119fb4ff757 /activitypub.c | |
| parent | Updated documentation. (diff) | |
| download | snac2-f485dbdaf0f6372b9815be3d78ae2839e80d6946.tar.gz snac2-f485dbdaf0f6372b9815be3d78ae2839e80d6946.tar.xz snac2-f485dbdaf0f6372b9815be3d78ae2839e80d6946.zip | |
Added actor refreshing via the user queue.
Diffstat (limited to 'activitypub.c')
| -rw-r--r-- | activitypub.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/activitypub.c b/activitypub.c index b6a07c9..08f79ed 100644 --- a/activitypub.c +++ b/activitypub.c | |||
| @@ -2245,6 +2245,22 @@ void process_user_queue_item(snac *snac, xs_dict *q_item) | |||
| 2245 | verify_links(snac); | 2245 | verify_links(snac); |
| 2246 | } | 2246 | } |
| 2247 | else | 2247 | else |
| 2248 | if (strcmp(type, "actor_request") == 0) { | ||
| 2249 | const char *actor = xs_dict_get(q_item, "actor"); | ||
| 2250 | double mtime = object_mtime(actor); | ||
| 2251 | double max_time = 3600.0 * 36.0; | ||
| 2252 | |||
| 2253 | if (mtime + max_time < (double) time(NULL)) { | ||
| 2254 | xs *actor_o = NULL; | ||
| 2255 | int status; | ||
| 2256 | |||
| 2257 | if (valid_status((status = activitypub_request(snac, actor, &actor_o)))) | ||
| 2258 | actor_add(actor, actor_o); | ||
| 2259 | |||
| 2260 | snac_log(snac, xs_fmt("refresh actor %s %d", actor, status)); | ||
| 2261 | } | ||
| 2262 | } | ||
| 2263 | else | ||
| 2248 | snac_log(snac, xs_fmt("unexpected user q_item type '%s'", type)); | 2264 | snac_log(snac, xs_fmt("unexpected user q_item type '%s'", type)); |
| 2249 | } | 2265 | } |
| 2250 | 2266 | ||