diff options
| author | 2022-09-26 07:32:44 +0200 | |
|---|---|---|
| committer | 2022-09-26 07:32:44 +0200 | |
| commit | 1c8878c3dac3bba7ed2d758a1dc7b012f5c6a355 (patch) | |
| tree | b2610dcda61232791d026e5ea2a747587f4a7d64 /data.c | |
| parent | Resolve object id instead of discarding like or boost. (diff) | |
| download | snac2-1c8878c3dac3bba7ed2d758a1dc7b012f5c6a355.tar.gz snac2-1c8878c3dac3bba7ed2d758a1dc7b012f5c6a355.tar.xz snac2-1c8878c3dac3bba7ed2d758a1dc7b012f5c6a355.zip | |
Also store local referrers in the local timeline.
Diffstat (limited to 'data.c')
| -rw-r--r-- | data.c | 11 |
1 files changed, 7 insertions, 4 deletions
| @@ -400,7 +400,7 @@ d_char *_timeline_new_fn(snac *snac, char *id) | |||
| 400 | } | 400 | } |
| 401 | 401 | ||
| 402 | 402 | ||
| 403 | void _timeline_write(snac *snac, char *id, char *msg, char *parent) | 403 | void _timeline_write(snac *snac, char *id, char *msg, char *parent, char *referrer) |
| 404 | /* writes a timeline entry and refreshes the ancestors */ | 404 | /* writes a timeline entry and refreshes the ancestors */ |
| 405 | { | 405 | { |
| 406 | xs *fn = _timeline_new_fn(snac, id); | 406 | xs *fn = _timeline_new_fn(snac, id); |
| @@ -417,7 +417,8 @@ void _timeline_write(snac *snac, char *id, char *msg, char *parent) | |||
| 417 | 417 | ||
| 418 | /* related to this user? link to local timeline */ | 418 | /* related to this user? link to local timeline */ |
| 419 | if (xs_startswith(id, snac->actor) || | 419 | if (xs_startswith(id, snac->actor) || |
| 420 | (!xs_is_null(parent) && xs_startswith(parent, snac->actor))) { | 420 | (!xs_is_null(parent) && xs_startswith(parent, snac->actor)) || |
| 421 | (!xs_is_null(referrer) && xs_startswith(referrer, snac->actor))) { | ||
| 421 | xs *lfn = xs_replace(fn, "/timeline/", "/local/"); | 422 | xs *lfn = xs_replace(fn, "/timeline/", "/local/"); |
| 422 | link(fn, lfn); | 423 | link(fn, lfn); |
| 423 | 424 | ||
| @@ -557,7 +558,7 @@ int timeline_add(snac *snac, char *id, char *o_msg, char *parent, char *referrer | |||
| 557 | 558 | ||
| 558 | msg = xs_dict_set(msg, "_snac", md); | 559 | msg = xs_dict_set(msg, "_snac", md); |
| 559 | 560 | ||
| 560 | _timeline_write(snac, id, msg, parent); | 561 | _timeline_write(snac, id, msg, parent, referrer); |
| 561 | 562 | ||
| 562 | snac_log(snac, xs_fmt("timeline_add %s", id)); | 563 | snac_log(snac, xs_fmt("timeline_add %s", id)); |
| 563 | 564 | ||
| @@ -602,11 +603,13 @@ void timeline_admire(snac *snac, char *id, char *admirer, int like) | |||
| 602 | 603 | ||
| 603 | unlink(ofn); | 604 | unlink(ofn); |
| 604 | 605 | ||
| 605 | _timeline_write(snac, id, msg, xs_dict_get(meta, "parent")); | 606 | _timeline_write(snac, id, msg, xs_dict_get(meta, "parent"), admirer); |
| 606 | 607 | ||
| 607 | snac_log(snac, xs_fmt("timeline_admire (%s) %s %s", | 608 | snac_log(snac, xs_fmt("timeline_admire (%s) %s %s", |
| 608 | like ? "Like" : "Announce", id, admirer)); | 609 | like ? "Like" : "Announce", id, admirer)); |
| 609 | } | 610 | } |
| 611 | else | ||
| 612 | snac_log(snac, xs_fmt("timeline_admire ignored for unknown object %s", id)); | ||
| 610 | } | 613 | } |
| 611 | 614 | ||
| 612 | 615 | ||