mirror of
https://github.com/mailscope/kumomta.git
synced 2026-08-21 03:48:17 +00:00
d063c96b5f
A number of our lua event handlers allow registering multiple implementations to facilitate modular use. For that to work, we must know ahead of the user lua call running that any given handle is allowed to register multiple times. This is so that we can report a meaningful error when incorrectly using a singleton handler multiple times, and so that we can record a list of handlers for the multiple case. Prior to this commit, if we forgot to arrange to register the signature as part of the context setup the consequence was that the event handler would get registered as a singleton and when we went to call it, because the signature is marked as allowing multiple but was not registered as multiple, we would skate through and do nothing without reporting an error because we assumed that the signature was registered consistently. In hindsight, that's a terrible idea because it results in silently ignoring the registration issue, and not calling the event handler at all. This commit consolidates the multiple/single value resolution into the same flow, then adds a check to confirm that we have a list of handlers registered for the allow_multiple case, raising an error otherwise that will hopefully encourage users to report this problem to us if it manifests again in the future. This commit includes fixing two event handlers that we missing their signature registration. One of them was broken anyway by being registered with a name that didn't match the docs. refs: https://github.com/KumoCorp/kumomta/issues/236