diff options
| -rw-r--r-- | activitypub.c | 8 | ||||
| -rw-r--r-- | data.c | 12 |
2 files changed, 12 insertions, 8 deletions
diff --git a/activitypub.c b/activitypub.c index 5afe304..9ec7c37 100644 --- a/activitypub.c +++ b/activitypub.c | |||
| @@ -118,7 +118,7 @@ int activitypub_request(snac *user, const char *url, xs_dict **data) | |||
| 118 | int actor_request(const char *actor, xs_dict **data) | 118 | int actor_request(const char *actor, xs_dict **data) |
| 119 | /* request an actor */ | 119 | /* request an actor */ |
| 120 | { | 120 | { |
| 121 | int status, status2; | 121 | int status; |
| 122 | xs *payload = NULL; | 122 | xs *payload = NULL; |
| 123 | 123 | ||
| 124 | if (data) | 124 | if (data) |
| @@ -129,9 +129,9 @@ int actor_request(const char *actor, xs_dict **data) | |||
| 129 | 129 | ||
| 130 | if (status != 200) { | 130 | if (status != 200) { |
| 131 | /* actor data non-existent or stale: get from the net */ | 131 | /* actor data non-existent or stale: get from the net */ |
| 132 | status2 = activitypub_request(NULL, actor, &payload); | 132 | status = activitypub_request(NULL, actor, &payload); |
| 133 | 133 | ||
| 134 | if (valid_status(status2)) { | 134 | if (valid_status(status)) { |
| 135 | /* renew data */ | 135 | /* renew data */ |
| 136 | status = actor_add(actor, payload); | 136 | status = actor_add(actor, payload); |
| 137 | 137 | ||
| @@ -141,7 +141,7 @@ int actor_request(const char *actor, xs_dict **data) | |||
| 141 | } | 141 | } |
| 142 | } | 142 | } |
| 143 | else | 143 | else |
| 144 | srv_debug(0, xs_fmt("actor_request error %d", status2)); | 144 | srv_debug(0, xs_fmt("actor_request error %s %d", actor, status)); |
| 145 | } | 145 | } |
| 146 | 146 | ||
| 147 | /* collect the (presumed) shared inbox in this actor */ | 147 | /* collect the (presumed) shared inbox in this actor */ |
| @@ -649,10 +649,14 @@ int _object_add(const char *id, const xs_dict *obj, int ow) | |||
| 649 | xs *fn = _object_fn(id); | 649 | xs *fn = _object_fn(id); |
| 650 | FILE *f; | 650 | FILE *f; |
| 651 | 651 | ||
| 652 | if (!ow && mtime(fn) > 0.0) { | 652 | if (mtime(fn) > 0.0) { |
| 653 | /* object already here */ | 653 | if (!ow) { |
| 654 | srv_debug(1, xs_fmt("object_add object already here %s", id)); | 654 | /* object already here */ |
| 655 | return 204; /* No content */ | 655 | srv_debug(1, xs_fmt("object_add object already here %s", id)); |
| 656 | return 204; /* No content */ | ||
| 657 | } | ||
| 658 | else | ||
| 659 | status = 200; | ||
| 656 | } | 660 | } |
| 657 | 661 | ||
| 658 | if ((f = fopen(fn, "w")) != NULL) { | 662 | if ((f = fopen(fn, "w")) != NULL) { |