DOKK / manpages / debian 12 / sympa / Sympa::Message::Plugin.3sympa.en
Sympa::Message::Plugin(3Sympa) sympa 6.2.70 Sympa::Message::Plugin(3Sympa)

Sympa::Message::Plugin - process hooks

    Sympa::Message::Plugin::execute('post_archive', $message);

Sympa::Message::Plugin provides hook mechanism to intervene in processing by Sympa. Each hook may modify objects (messages and so on) or may break ordinary processing.

Notice: Hook mechanism is experimental. Module names and interfaces may be changed in the future.

Process message hook.

Currently, following hooks are supported:

Message hook. Message had been approved distribution (by scenario or by moderator), however, it has not been decorated (adding custom subject etc.) nor archived yet.
Message hook. Message had been archived, however, it has not been distributed to users including digest spool; message has not been signed nor encrypted (if necessary).

First, write your hook module:

  package My::Hook;
  use constant gettext_id => 'My message hook';
  
  sub post_archive {
      my $module  = shift;    # module name: "My::Hook"
      my $name    = shift;    # handler name: "post_archive"
      my $message = shift;    # Message object
      my %options = @_;
  
      # Processing, possibly changing $message...
  
      # Return suitable result.
      # If unrecoverable error occurred, you may return undef or simply die.
      return 1;
  }
  
  1;

Then activate hook handler in your list config:

  message_hook
    post_archive My::Hook

Sympa::Message::Plugin::FixEncoding - An example module for message hook.

Sympa::Message::Plugin appeared on Sympa 6.2. It was initially written by IKEDA Soji <ikeda@conversion.co.jp>.

2023-01-26 6.2.70