diff options
| author | 2023-06-15 04:11:39 +0200 | |
|---|---|---|
| committer | 2023-06-15 04:11:39 +0200 | |
| commit | e97092cf0c35fb51c2900c8001d89daf32a07ba1 (patch) | |
| tree | 83936805fe7a3e69f161d9c43cf31f5b7d1b6d95 | |
| parent | Use utimes() to 'touch' the actor file in actor_get(). (diff) | |
| download | penes-snac2-e97092cf0c35fb51c2900c8001d89daf32a07ba1.tar.gz penes-snac2-e97092cf0c35fb51c2900c8001d89daf32a07ba1.tar.xz penes-snac2-e97092cf0c35fb51c2900c8001d89daf32a07ba1.zip | |
Maintain a link to the author object in the following/ subdirectory.
| -rw-r--r-- | data.c | 13 | ||||
| -rw-r--r-- | xs_time.h | 2 |
2 files changed, 12 insertions, 3 deletions
| @@ -1169,6 +1169,13 @@ int following_add(snac *snac, const char *actor, const xs_dict *msg) | |||
| 1169 | 1169 | ||
| 1170 | fwrite(j, 1, strlen(j), f); | 1170 | fwrite(j, 1, strlen(j), f); |
| 1171 | fclose(f); | 1171 | fclose(f); |
| 1172 | |||
| 1173 | /* get the filename of the actor object */ | ||
| 1174 | xs *actor_fn = _object_fn(actor); | ||
| 1175 | |||
| 1176 | /* increase its reference count */ | ||
| 1177 | fn = xs_replace_i(fn, ".json", ""); | ||
| 1178 | link(actor_fn, fn); | ||
| 1172 | } | 1179 | } |
| 1173 | else | 1180 | else |
| 1174 | ret = 500; | 1181 | ret = 500; |
| @@ -1184,9 +1191,13 @@ int following_del(snac *snac, const char *actor) | |||
| 1184 | { | 1191 | { |
| 1185 | xs *fn = _following_fn(snac, actor); | 1192 | xs *fn = _following_fn(snac, actor); |
| 1186 | 1193 | ||
| 1194 | snac_debug(snac, 2, xs_fmt("following_del %s %s", actor, fn)); | ||
| 1195 | |||
| 1187 | unlink(fn); | 1196 | unlink(fn); |
| 1188 | 1197 | ||
| 1189 | snac_debug(snac, 2, xs_fmt("following_del %s %s", actor, fn)); | 1198 | /* also delete the reference to the author */ |
| 1199 | fn = xs_replace_i(fn, ".json", ""); | ||
| 1200 | unlink(fn); | ||
| 1190 | 1201 | ||
| 1191 | return 200; | 1202 | return 200; |
| 1192 | } | 1203 | } |
| @@ -32,8 +32,6 @@ xs_str *xs_str_time(time_t t, const char *fmt, int local) | |||
| 32 | 32 | ||
| 33 | strftime(tmp, sizeof(tmp), fmt, &tm); | 33 | strftime(tmp, sizeof(tmp), fmt, &tm); |
| 34 | 34 | ||
| 35 | // printf("%d %d\n", local, t - xs_parse_time(tmp, fmt, local)); | ||
| 36 | |||
| 37 | return xs_str_new(tmp); | 35 | return xs_str_new(tmp); |
| 38 | } | 36 | } |
| 39 | 37 | ||