Automatically setting a Keywords: header in Gnus' follow ups #gnus #activitypub #elisp #nntp
I have added support for "Mention" "tag"s in my little ActivityPub/NNTP-server, so now I just need to actually follow the convention of setting such a tag when replying.
How to do that? A message hook to the rescue:
(defun illuminant-follow-up-keywords ()
"Add the From: user id to Keywords:"
(let ((group (or gnus-newsgroup-name "")))
(when (and (string-match "nntp.illuminant" group) message-reply-headers)
(let ((from (mail-header-from message-reply-headers)))
(when from
(let ((userid (cdr (gnus-extract-address-components from))))
(when userid
(message-add-header (format "Keywords: @%s" (car userid))))))))))
(add-hook 'message-setup-hook 'illuminant-follow-up-keywords)
If the newsgroup is from illuminant, it is a follow up, and there is a fediverse user name to extract in From:, add a Keywords: header with that user id, for a mention.
To keep all the mentions of the parent article, what I really need is to grab Keywords: from there and add the From:, so this is the hook needed:
- Adam Sjøgren 🕜︎ - 2023-07-05