On 10/23/23 20:37, Thomas Ward via Mailman-users wrote:
I want to add a custom handler that implements customized thread IDs in the system. I already have the DB logic worked out, but the documentation for plugins is NOT clear on how to define a handler in a plugin, nor does the example plugin in the documentation on Gitlab have any custom handlers.
I'm looking to add a custom handler so that the private pipeline for threaded-subject-list can use thread-subject (the custom handler) instead of subject-prefix (builtin).
https://gitlab.com/mailman/mailman/-/tree/master/src/mailman/plugins/testing...
https://docs.mailman3.org/projects/mailman/en/latest/src/mailman/plugins/doc...
These are two places you can find docs for an example plugin that ships with Mailman's code. Adding a new "component", like a Handler, works very similar to the "rules" in the example shown above.
You will probably need a directory tree like:
example/
__init__.py
hooks.py
handlers/
__init__.py
handlers.py
Installing the handler is same as per shown in docs using below (do note that the above example is the name of the package that is importable):
[plugin.example]
class: example.hooks.ExamplePlugin
enabled: yes
[logging.plugins]
propagate: yes
Finally, you can verify that your handler was loaded properly using something along the lines of:
$ mailman shell
Welcome to the GNU Mailman shell
Use commit() to commit changes.
Use abort() to discard changes since the last commit.
Exit with ctrl+D does an implicit commit() but exit() does not.
>>> for each in config.handlers:
... print(each)
...
member-recipients
to-archive
cleanse-dkim
file-recipients
to-outgoing
mime-delete
after-delivery
decorate
to-digest
avoid-duplicates
arc-sign
cook-headers
replybot
tagger
acknowledge
dmarc
subject-prefix
validate-authenticity
owner-recipients
to-usenet
cleanse
rfc-2369
-- thanks, Abhilash Raj (maxking)