Haraka icon indicating copy to clipboard operation
Haraka copied to clipboard

Fix Haraka help

Open lnedry opened this issue 1 year ago • 3 comments

Fixed issue #3212 - the help option for plugin execution order was sometimes displaying hooks in the wrong order.

Haraka help now displays plugin hooks in the correct order of execution.

There may be a better way to get a list of the hooks and their order of execution but it was not obvious to me. So I grabbed them from the Plugin.md file.

lnedry avatar Feb 04 '24 20:02 lnedry

Putting them inline is a reasonable approach, but requires modifying both the docs and the help file in the future, which is likely to get missed. Something more automated seems prudent to me:

awk '/## Available/,/## rcpt/{ if (/^\*/) print $2 }' docs/Plugins.md | tr -d '\'
init_master
init_child
init_http
init_wss
connect_init
lookup_rdns
connect
capabilities
unrecognized_command
disconnect
helo
ehlo
quit
vrfy
noop
rset
mail
rcpt
rcpt_ok
data
data_post
max_data_exceeded
queue
queue_outbound
queue_ok
reset_transaction
deny
get_mx
deferred
bounce
delivered
send_email
pre_send_trans_email

Annotated

awk '/## Available/,/## rcpt/{ if (/^\*/) print $2 }' docs/Plugins.md | tr -d '\'
  • for the contents between the markers that starts with ## Available and ends with ## rcpt ...
  • print the 2nd word of lines that start with * (the first is *)
  • use tr to delete the \ escape characters

msimerson avatar Feb 04 '24 21:02 msimerson

When I said that there may be a better way to get a list of the hooks, I was referring to programmatically getting a list from within Haraka.

What are the chances that a new hook will be added in the future? If that is a possibility, I could add some code to print a warning when someone uses a hook that is not in this help list. Or throw an error.

lnedry avatar Feb 05 '24 11:02 lnedry

When I said that there may be a better way to get a list of the hooks, I was referring to programmatically getting a list from within Haraka.

I didn't see a straight forward way to do that. Hence, grabbing them from the docs.

What are the chances that a new hook will be added in the future?

Probably somewhere around 100%, eventually. We do require new features to be documented, so if another hook was added, I'd expect it to be documented in docs/Plugins.md, same as the rest of them.

msimerson avatar Feb 08 '24 03:02 msimerson