From cd0e211354575f89f169da2e86b5b234a2624b9d Mon Sep 17 00:00:00 2001 From: default Date: Tue, 12 Mar 2024 18:04:09 +0100 Subject: [PATCH] Don't call enqueue_actor_request() with a NULL user. --- activitypub.c | 2 ++ data.c | 12 +++++++++++- snac.h | 2 ++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/activitypub.c b/activitypub.c index 08f79ed..bd72cb4 100644 --- a/activitypub.c +++ b/activitypub.c @@ -2256,6 +2256,8 @@ void process_user_queue_item(snac *snac, xs_dict *q_item) if (valid_status((status = activitypub_request(snac, actor, &actor_o)))) actor_add(actor, actor_o); + else + object_touch(actor); snac_log(snac, xs_fmt("refresh actor %s %d", actor, status)); } diff --git a/data.c b/data.c index 77d81d5..3da25f1 100644 --- a/data.c +++ b/data.c @@ -811,6 +811,16 @@ double object_mtime(const char *id) } +void object_touch(const char *id) +{ + xs *md5 = xs_md5_hex(id, strlen(id)); + xs *fn = _object_fn_by_md5(md5, "object_touch"); + + if (mtime(fn)) + utimes(fn, NULL); +} + + xs_str *_object_index_fn(const char *id, const char *idxsfx) /* returns the filename of an object's index */ { @@ -1586,7 +1596,7 @@ int actor_get_refresh(snac *user, const char *actor, xs_dict **data) { int status = actor_get(actor, data); - if (status == 205) + if (status == 205 && user && !xs_startswith(user->actor, srv_baseurl)) enqueue_actor_request(user, actor); return status; diff --git a/snac.h b/snac.h index 6876747..9451544 100644 --- a/snac.h +++ b/snac.h @@ -112,6 +112,8 @@ double object_ctime_by_md5(const char *md5); double object_ctime(const char *id); double object_mtime_by_md5(const char *md5); double object_mtime(const char *id); +void object_touch(const char *id); + int object_admire(const char *id, const char *actor, int like); int object_unadmire(const char *id, const char *actor, int like);