diff options
| author | 2022-11-25 14:19:00 +0100 | |
|---|---|---|
| committer | 2022-11-25 14:19:00 +0100 | |
| commit | 4a41f3a1f0554988869dcc4e17c512dcb17c94a9 (patch) | |
| tree | af48a78b3f31bfa8698fd1287b5ee4252e19b85a | |
| parent | Fixed typo. (diff) | |
| download | snac2-4a41f3a1f0554988869dcc4e17c512dcb17c94a9.tar.gz snac2-4a41f3a1f0554988869dcc4e17c512dcb17c94a9.tar.xz snac2-4a41f3a1f0554988869dcc4e17c512dcb17c94a9.zip | |
New function timeline_object_add().
| -rw-r--r-- | data.c | 25 |
1 files changed, 16 insertions, 9 deletions
| @@ -896,6 +896,21 @@ int _timeline_write(snac *snac, char *id, char *msg, char *parent, char *referre | |||
| 896 | } | 896 | } |
| 897 | 897 | ||
| 898 | 898 | ||
| 899 | void 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 | |||
| 899 | int timeline_add(snac *snac, char *id, char *o_msg, char *parent, char *referrer) | 914 | int 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; |