From 5182a3384e80462e08713903c14b9cdecf56cdfb Mon Sep 17 00:00:00 2001 From: hanchan Date: Wed, 27 May 2026 17:26:33 +0800 Subject: add keep_replied_posts and keep_replied_me feathers, and auto-mention post author when reply to a post --- html.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'html.c') 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); -- cgit