summaryrefslogtreecommitdiff
path: root/data.c
diff options
context:
space:
mode:
authorGravatar default2022-11-25 14:19:00 +0100
committerGravatar default2022-11-25 14:19:00 +0100
commit4a41f3a1f0554988869dcc4e17c512dcb17c94a9 (patch)
treeaf48a78b3f31bfa8698fd1287b5ee4252e19b85a /data.c
parentFixed typo. (diff)
downloadsnac2-4a41f3a1f0554988869dcc4e17c512dcb17c94a9.tar.gz
snac2-4a41f3a1f0554988869dcc4e17c512dcb17c94a9.tar.xz
snac2-4a41f3a1f0554988869dcc4e17c512dcb17c94a9.zip
New function timeline_object_add().
Diffstat (limited to 'data.c')
-rw-r--r--data.c25
1 files changed, 16 insertions, 9 deletions
diff --git a/data.c b/data.c
index 90bd466..17c99cf 100644
--- a/data.c
+++ b/data.c
@@ -896,6 +896,21 @@ int _timeline_write(snac *snac, char *id, char *msg, char *parent, char *referre
896} 896}
897 897
898 898
899void timeline_object_add(snac *snac, const char *id, char *msg)
900/* adds an object and update the user indexes */
901{
902 object_add(id, msg);
903
904 xs *idx = xs_fmt("%s/timeline.idx", snac->basedir);
905 index_add(idx, id);
906
907 if (xs_startswith(id, snac->actor)) {
908 idx = xs_replace_i(idx, "timeline.", "local.");
909 index_add(idx, id);
910 }
911}
912
913
899int timeline_add(snac *snac, char *id, char *o_msg, char *parent, char *referrer) 914int timeline_add(snac *snac, char *id, char *o_msg, char *parent, char *referrer)
900/* adds a message to the timeline */ 915/* adds a message to the timeline */
901{ 916{
@@ -931,15 +946,7 @@ int timeline_add(snac *snac, char *id, char *o_msg, char *parent, char *referrer
931 if ((ret = _timeline_write(snac, id, msg, parent, referrer))) { 946 if ((ret = _timeline_write(snac, id, msg, parent, referrer))) {
932 snac_debug(snac, 1, xs_fmt("timeline_add %s", id)); 947 snac_debug(snac, 1, xs_fmt("timeline_add %s", id));
933 948
934 object_add(id, o_msg); 949 timeline_object_add(snac, id, o_msg);
935
936 xs *idx = xs_fmt("%s/timeline.idx", snac->basedir);
937 index_add(idx, id);
938
939 if (xs_startswith(id, snac->actor)) {
940 idx = xs_replace_i(idx, "timeline.", "local.");
941 index_add(idx, id);
942 }
943 } 950 }
944 951
945 return ret; 952 return ret;