mirror of
https://codeberg.org/grunfink/snac2.git
synced 2024-11-22 13:25:04 +00:00
Added some functions that return index filenames.
This commit is contained in:
parent
db7a68d198
commit
f5332ec016
2 changed files with 30 additions and 7 deletions
32
data.c
32
data.c
|
@ -1300,10 +1300,17 @@ xs_list *timeline_top_level(snac *snac, const xs_list *list)
|
|||
}
|
||||
|
||||
|
||||
xs_list *timeline_simple_list(snac *snac, const char *idx_name, int skip, int show)
|
||||
xs_str *user_index_fn(snac *user, const char *idx_name)
|
||||
/* returns the filename of a user index */
|
||||
{
|
||||
return xs_fmt("%s/%s.idx", user->basedir, idx_name);
|
||||
}
|
||||
|
||||
|
||||
xs_list *timeline_simple_list(snac *user, const char *idx_name, int skip, int show)
|
||||
/* returns a timeline (with all entries) */
|
||||
{
|
||||
xs *idx = xs_fmt("%s/%s.idx", snac->basedir, idx_name);
|
||||
xs *idx = user_index_fn(user, idx_name);
|
||||
|
||||
return index_list_desc(idx, skip, show);
|
||||
}
|
||||
|
@ -1327,10 +1334,16 @@ xs_list *timeline_list(snac *snac, const char *idx_name, int skip, int show)
|
|||
}
|
||||
|
||||
|
||||
xs_str *instance_index_fn(void)
|
||||
{
|
||||
return xs_fmt("%s/public.idx", srv_basedir);
|
||||
}
|
||||
|
||||
|
||||
xs_list *timeline_instance_list(int skip, int show)
|
||||
/* returns the timeline for the full instance */
|
||||
{
|
||||
xs *idx = xs_fmt("%s/public.idx", srv_basedir);
|
||||
xs *idx = instance_index_fn();
|
||||
|
||||
return index_list_desc(idx, skip, show);
|
||||
}
|
||||
|
@ -1803,15 +1816,22 @@ void tag_index(const char *id, const xs_dict *obj)
|
|||
}
|
||||
|
||||
|
||||
xs_list *tag_search(const char *tag, int skip, int show)
|
||||
/* returns the list of posts tagged with tag */
|
||||
xs_str *tag_fn(const char *tag)
|
||||
{
|
||||
if (*tag == '#')
|
||||
tag++;
|
||||
|
||||
xs *lw_tag = xs_tolower_i(xs_dup(tag));
|
||||
xs *md5 = xs_md5_hex(lw_tag, strlen(lw_tag));
|
||||
xs *idx = xs_fmt("%s/tag/%c%c/%s.idx", srv_basedir, md5[0], md5[1], md5);
|
||||
|
||||
return xs_fmt("%s/tag/%c%c/%s.idx", srv_basedir, md5[0], md5[1], md5);
|
||||
}
|
||||
|
||||
|
||||
xs_list *tag_search(const char *tag, int skip, int show)
|
||||
/* returns the list of posts tagged with tag */
|
||||
{
|
||||
xs *idx = tag_fn(tag);
|
||||
|
||||
return index_list_desc(idx, skip, show);
|
||||
}
|
||||
|
|
5
snac.h
5
snac.h
|
@ -145,13 +145,15 @@ int timeline_touch(snac *snac);
|
|||
int timeline_here(snac *snac, const char *md5);
|
||||
int timeline_get_by_md5(snac *snac, const char *md5, xs_dict **msg);
|
||||
int timeline_del(snac *snac, const char *id);
|
||||
xs_list *timeline_simple_list(snac *snac, const char *idx_name, int skip, int show);
|
||||
xs_str *user_index_fn(snac *user, const char *idx_name);
|
||||
xs_list *timeline_simple_list(snac *user, const char *idx_name, int skip, int show);
|
||||
xs_list *timeline_list(snac *snac, const char *idx_name, int skip, int show);
|
||||
int timeline_add(snac *snac, const char *id, const xs_dict *o_msg);
|
||||
int timeline_admire(snac *snac, const char *id, const char *admirer, int like);
|
||||
|
||||
xs_list *timeline_top_level(snac *snac, const xs_list *list);
|
||||
xs_list *local_list(snac *snac, int max);
|
||||
xs_str *instance_index_fn(void);
|
||||
xs_list *timeline_instance_list(int skip, int show);
|
||||
|
||||
int following_add(snac *snac, const char *actor, const xs_dict *msg);
|
||||
|
@ -179,6 +181,7 @@ void hide(snac *snac, const char *id);
|
|||
int is_hidden(snac *snac, const char *id);
|
||||
|
||||
void tag_index(const char *id, const xs_dict *obj);
|
||||
xs_str *tag_fn(const char *tag);
|
||||
xs_list *tag_search(const char *tag, int skip, int show);
|
||||
|
||||
xs_val *list_maint(snac *user, const char *list, int op);
|
||||
|
|
Loading…
Reference in a new issue