diff options
| author | 2022-12-02 20:39:31 +0100 | |
|---|---|---|
| committer | 2022-12-02 20:39:31 +0100 | |
| commit | 4819c4248dc54c05cd4db9f181b333c3fd05d03d (patch) | |
| tree | a0eb8b255ddce7590213051bbe1351e084b99749 /data.c | |
| parent | The old timeline is no longer maintained. (diff) | |
| download | snac2-4819c4248dc54c05cd4db9f181b333c3fd05d03d.tar.gz snac2-4819c4248dc54c05cd4db9f181b333c3fd05d03d.tar.xz snac2-4819c4248dc54c05cd4db9f181b333c3fd05d03d.zip | |
More old code deletions.
Diffstat (limited to 'data.c')
| -rw-r--r-- | data.c | 39 |
1 files changed, 1 insertions, 38 deletions
| @@ -791,49 +791,12 @@ d_char *timeline_find(snac *snac, char *id) | |||
| 791 | int timeline_del(snac *snac, char *id) | 791 | int timeline_del(snac *snac, char *id) |
| 792 | /* deletes a message from the timeline */ | 792 | /* deletes a message from the timeline */ |
| 793 | { | 793 | { |
| 794 | int ret = 404; | ||
| 795 | xs *fn = _timeline_find_fn(snac, id); | ||
| 796 | |||
| 797 | if (fn != NULL) { | ||
| 798 | xs *lfn = NULL; | ||
| 799 | |||
| 800 | unlink(fn); | ||
| 801 | snac_debug(snac, 1, xs_fmt("timeline_del %s", id)); | ||
| 802 | |||
| 803 | /* try to delete also from the local timeline */ | ||
| 804 | lfn = xs_replace(fn, "/timeline/", "/local/"); | ||
| 805 | |||
| 806 | if (unlink(lfn) != -1) | ||
| 807 | snac_debug(snac, 1, xs_fmt("timeline_del (local) %s", id)); | ||
| 808 | |||
| 809 | ret = 200; | ||
| 810 | } | ||
| 811 | |||
| 812 | /* delete from the user's caches */ | 794 | /* delete from the user's caches */ |
| 813 | object_user_cache_del(snac, id, "public"); | 795 | object_user_cache_del(snac, id, "public"); |
| 814 | object_user_cache_del(snac, id, "private"); | 796 | object_user_cache_del(snac, id, "private"); |
| 815 | 797 | ||
| 816 | /* try to delete the object if it's not used elsewhere */ | 798 | /* try to delete the object if it's not used elsewhere */ |
| 817 | object_del_if_unref(id); | 799 | return object_del_if_unref(id); |
| 818 | |||
| 819 | return ret; | ||
| 820 | } | ||
| 821 | |||
| 822 | |||
| 823 | d_char *timeline_get(snac *snac, char *fn) | ||
| 824 | /* gets a timeline entry by file name */ | ||
| 825 | { | ||
| 826 | d_char *d = NULL; | ||
| 827 | FILE *f; | ||
| 828 | |||
| 829 | if ((f = fopen(fn, "r")) != NULL) { | ||
| 830 | xs *j = xs_readall(f); | ||
| 831 | |||
| 832 | d = xs_json_loads(j); | ||
| 833 | fclose(f); | ||
| 834 | } | ||
| 835 | |||
| 836 | return d; | ||
| 837 | } | 800 | } |
| 838 | 801 | ||
| 839 | 802 | ||