aboutsummaryrefslogtreecommitdiff
path: root/html.c
diff options
context:
space:
mode:
authorhanchan <dev@hanchan.vip>2026-05-27 17:26:33 +0800
committerhanchan <dev@hanchan.vip>2026-05-27 17:26:33 +0800
commit5182a3384e80462e08713903c14b9cdecf56cdfb (patch)
tree7e1eba6b67fc3fcc71e6b91835cec247be8b2499 /html.c
parent0bde1abe67aee7e7840338afef1022bcec3a1bd8 (diff)
add keep_replied_posts and keep_replied_me feathers, and auto-mention post author when reply to a post
Diffstat (limited to 'html.c')
-rw-r--r--html.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/html.c b/html.c
index ecd7fd7..a553d8c 100644
--- a/html.c
+++ b/html.c
@@ -2035,6 +2035,27 @@ xs_str *build_mentions(snac *user, const xs_dict *msg)
}
}
+ /* also add the author of this post as a mention */
+ const char *atto = get_atto(msg);
+
+ if (xs_is_string(atto) && *atto && strcmp(atto, user->actor) != 0) {
+ /* check if this author is already in the mentions string */
+ xs *l = xs_split(atto, "/");
+
+ if (xs_list_len(l) > 3) {
+ xs *actor_o = NULL;
+ if (valid_status(object_get(atto, &actor_o))) {
+ const char *uname = xs_dict_get(actor_o, "preferredUsername");
+ if (!xs_is_null(uname) && *uname) {
+ xs *handle = xs_fmt("@%s@%s ", uname, xs_list_get(l, 2));
+ if (xs_str_in(s, handle) == -1) {
+ s = xs_str_cat(s, handle);
+ }
+ }
+ }
+ }
+ }
+
if (*s) {
xs *s1 = s;
s = xs_fmt("\n\n\nCC: %s", s1);