diff options
| author | 2024-05-27 12:24:17 +0200 | |
|---|---|---|
| committer | 2024-05-27 12:24:17 +0200 | |
| commit | 81cf309e4d0ba6c2debccc21ea4f85e1e6245dc5 (patch) | |
| tree | 10528a18c859964fa11eabe15955c85dce7ecf25 /data.c | |
| parent | Use enum instead of numeric status codes for HTTP statuses (diff) | |
| download | snac2-81cf309e4d0ba6c2debccc21ea4f85e1e6245dc5.tar.gz snac2-81cf309e4d0ba6c2debccc21ea4f85e1e6245dc5.tar.xz snac2-81cf309e4d0ba6c2debccc21ea4f85e1e6245dc5.zip | |
Implement Mastodon PATCH endpoint for account profile updates
Diffstat (limited to 'data.c')
| -rw-r--r-- | data.c | 27 |
1 files changed, 27 insertions, 0 deletions
| @@ -303,6 +303,33 @@ int user_open_by_md5(snac *snac, const char *md5) | |||
| 303 | return 0; | 303 | return 0; |
| 304 | } | 304 | } |
| 305 | 305 | ||
| 306 | int user_persist(snac *snac) | ||
| 307 | /* store user */ | ||
| 308 | { | ||
| 309 | xs *fn = xs_fmt("%s/user.json", snac->basedir); | ||
| 310 | xs *bfn = xs_fmt("%s.bak", fn); | ||
| 311 | FILE *f; | ||
| 312 | |||
| 313 | rename(fn, bfn); | ||
| 314 | |||
| 315 | if ((f = fopen(fn, "w")) != NULL) { | ||
| 316 | xs_json_dump(snac->config, 4, f); | ||
| 317 | fclose(f); | ||
| 318 | } | ||
| 319 | else | ||
| 320 | rename(bfn, fn); | ||
| 321 | |||
| 322 | history_del(snac, "timeline.html_"); | ||
| 323 | |||
| 324 | xs *a_msg = msg_actor(snac); | ||
| 325 | xs *u_msg = msg_update(snac, a_msg); | ||
| 326 | |||
| 327 | enqueue_message(snac, u_msg); | ||
| 328 | enqueue_verify_links(snac); | ||
| 329 | |||
| 330 | return 0; | ||
| 331 | } | ||
| 332 | |||
| 306 | 333 | ||
| 307 | double mtime_nl(const char *fn, int *n_link) | 334 | double mtime_nl(const char *fn, int *n_link) |
| 308 | /* returns the mtime and number of links of a file or directory, or 0.0 */ | 335 | /* returns the mtime and number of links of a file or directory, or 0.0 */ |