diff options
| -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; |