diff options
| author | 2023-02-08 13:21:44 +0100 | |
|---|---|---|
| committer | 2023-02-08 13:21:44 +0100 | |
| commit | 3fcc139d6651a7d1c4fb431b3a9ee17cac897b27 (patch) | |
| tree | 030ca35b044d5848dc18814c60dbd03a6fb6626d | |
| parent | New function timeline_fn_by_md5(). (diff) | |
| download | penes-snac2-3fcc139d6651a7d1c4fb431b3a9ee17cac897b27.tar.gz penes-snac2-3fcc139d6651a7d1c4fb431b3a9ee17cac897b27.tar.xz penes-snac2-3fcc139d6651a7d1c4fb431b3a9ee17cac897b27.zip | |
timeline_top_level() now looks for the entries in the user caches.
| -rw-r--r-- | data.c | 13 | ||||
| -rw-r--r-- | main.c | 2 | ||||
| -rw-r--r-- | snac.h | 2 |
3 files changed, 10 insertions, 7 deletions
| @@ -906,11 +906,12 @@ void timeline_admire(snac *snac, char *id, char *admirer, int like) | |||
| 906 | } | 906 | } |
| 907 | 907 | ||
| 908 | 908 | ||
| 909 | d_char *timeline_top_level(d_char *list) | 909 | xs_list *timeline_top_level(snac *snac, xs_list *list) |
| 910 | /* returns the top level md5 entries from this index */ | 910 | /* returns the top level md5 entries from this index */ |
| 911 | { | 911 | { |
| 912 | xs_set seen; | 912 | xs_set seen; |
| 913 | char *p, *v; | 913 | xs_list *p; |
| 914 | xs_str *v; | ||
| 914 | 915 | ||
| 915 | xs_set_init(&seen); | 916 | xs_set_init(&seen); |
| 916 | 917 | ||
| @@ -927,8 +928,10 @@ d_char *timeline_top_level(d_char *list) | |||
| 927 | if (!object_parent(line, line2, sizeof(line2))) | 928 | if (!object_parent(line, line2, sizeof(line2))) |
| 928 | break; | 929 | break; |
| 929 | 930 | ||
| 930 | /* well, there is a parent... but if it's not there, use this */ | 931 | /* well, there is a parent... but is it here? */ |
| 931 | if (!object_here_by_md5(line2)) | 932 | xs *pfn = timeline_fn_by_md5(snac, line2); |
| 933 | |||
| 934 | if (pfn == NULL) | ||
| 932 | break; | 935 | break; |
| 933 | 936 | ||
| 934 | /* it's here! try again with its own parent */ | 937 | /* it's here! try again with its own parent */ |
| @@ -965,7 +968,7 @@ d_char *timeline_list(snac *snac, const char *idx_name, int skip, int show) | |||
| 965 | { | 968 | { |
| 966 | xs *list = timeline_simple_list(snac, idx_name, skip, show); | 969 | xs *list = timeline_simple_list(snac, idx_name, skip, show); |
| 967 | 970 | ||
| 968 | return timeline_top_level(list); | 971 | return timeline_top_level(snac, list); |
| 969 | } | 972 | } |
| 970 | 973 | ||
| 971 | 974 | ||
| @@ -165,7 +165,7 @@ int main(int argc, char *argv[]) | |||
| 165 | 165 | ||
| 166 | xs *idx = xs_fmt("%s/private.idx", snac.basedir); | 166 | xs *idx = xs_fmt("%s/private.idx", snac.basedir); |
| 167 | xs *list = index_list_desc(idx, 0, 256); | 167 | xs *list = index_list_desc(idx, 0, 256); |
| 168 | xs *tl = timeline_top_level(list); | 168 | xs *tl = timeline_top_level(&snac, list); |
| 169 | 169 | ||
| 170 | xs *j = xs_json_dumps_pp(tl, 4); | 170 | xs *j = xs_json_dumps_pp(tl, 4); |
| 171 | printf("%s\n", j); | 171 | printf("%s\n", j); |
| @@ -99,7 +99,7 @@ d_char *timeline_list(snac *snac, const char *idx_name, int skip, int show); | |||
| 99 | int timeline_add(snac *snac, char *id, char *o_msg); | 99 | int timeline_add(snac *snac, char *id, char *o_msg); |
| 100 | void timeline_admire(snac *snac, char *id, char *admirer, int like); | 100 | void timeline_admire(snac *snac, char *id, char *admirer, int like); |
| 101 | 101 | ||
| 102 | d_char *timeline_top_level(d_char *list); | 102 | xs_list *timeline_top_level(snac *snac, xs_list *list); |
| 103 | 103 | ||
| 104 | d_char *local_list(snac *snac, int max); | 104 | d_char *local_list(snac *snac, int max); |
| 105 | 105 | ||