mirror of
https://codeberg.org/grunfink/snac2.git
synced 2024-11-22 05:15:04 +00:00
New function timeline_object_add().
This commit is contained in:
parent
40a9e6e984
commit
4a41f3a1f0
1 changed files with 16 additions and 9 deletions
25
data.c
25
data.c
|
@ -896,6 +896,21 @@ int _timeline_write(snac *snac, char *id, char *msg, char *parent, char *referre
|
|||
}
|
||||
|
||||
|
||||
void timeline_object_add(snac *snac, const char *id, char *msg)
|
||||
/* adds an object and update the user indexes */
|
||||
{
|
||||
object_add(id, msg);
|
||||
|
||||
xs *idx = xs_fmt("%s/timeline.idx", snac->basedir);
|
||||
index_add(idx, id);
|
||||
|
||||
if (xs_startswith(id, snac->actor)) {
|
||||
idx = xs_replace_i(idx, "timeline.", "local.");
|
||||
index_add(idx, id);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int timeline_add(snac *snac, char *id, char *o_msg, char *parent, char *referrer)
|
||||
/* adds a message to the timeline */
|
||||
{
|
||||
|
@ -931,15 +946,7 @@ int timeline_add(snac *snac, char *id, char *o_msg, char *parent, char *referrer
|
|||
if ((ret = _timeline_write(snac, id, msg, parent, referrer))) {
|
||||
snac_debug(snac, 1, xs_fmt("timeline_add %s", id));
|
||||
|
||||
object_add(id, o_msg);
|
||||
|
||||
xs *idx = xs_fmt("%s/timeline.idx", snac->basedir);
|
||||
index_add(idx, id);
|
||||
|
||||
if (xs_startswith(id, snac->actor)) {
|
||||
idx = xs_replace_i(idx, "timeline.", "local.");
|
||||
index_add(idx, id);
|
||||
}
|
||||
timeline_object_add(snac, id, o_msg);
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
|
Loading…
Reference in a new issue