Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hooks rework #3174

Merged
merged 14 commits into from
Jul 16, 2021
Merged

Hooks rework #3174

merged 14 commits into from
Jul 16, 2021

Commits on Jul 6, 2021

  1. Configuration menu
    Copy the full SHA
    b5b25d5 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    32a68ff View commit details
    Browse the repository at this point in the history

Commits on Jul 12, 2021

  1. Configuration menu
    Copy the full SHA
    10a116d View commit details
    Browse the repository at this point in the history
  2. updating mongoose_hooks

    DenysGonchar committed Jul 12, 2021
    Configuration menu
    Copy the full SHA
    8f71a78 View commit details
    Browse the repository at this point in the history
  3. making dialyzer happy

    DenysGonchar committed Jul 12, 2021
    Configuration menu
    Copy the full SHA
    8badc48 View commit details
    Browse the repository at this point in the history
  4. allowing only external function references in gen_hook interfaces

    for OTP versions prior to 23, local function references in format like fun some_fun/2 behave in the same way as anonymous functions. different places in code generate different references. in addition to that local fun references are not code-reload safe, so it’s better to use external fun references only.
    
    It's still a good idea to use function references, because it allows dialyzer to check the handler function specs.
    DenysGonchar committed Jul 12, 2021
    Configuration menu
    Copy the full SHA
    69f755c View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    25d2679 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    b2404f2 View commit details
    Browse the repository at this point in the history
  7. getting rid of ejabberd_hooks:run_fold/4 interface and converting a f…

    …ew hooks used in testing
    DenysGonchar committed Jul 12, 2021
    Configuration menu
    Copy the full SHA
    75b93b1 View commit details
    Browse the repository at this point in the history

Commits on Jul 13, 2021

  1. Configuration menu
    Copy the full SHA
    2ec4c5d View commit details
    Browse the repository at this point in the history

Commits on Jul 14, 2021

  1. Configuration menu
    Copy the full SHA
    9e2d73c View commit details
    Browse the repository at this point in the history

Commits on Jul 16, 2021

  1. Configuration menu
    Copy the full SHA
    2514a43 View commit details
    Browse the repository at this point in the history
  2. changes according to the review comment.

    This branch introduces initial rework of the hooks framework
    
    The key changes:
    * hook handler functions now have fixed number of arguments:
       - Acc - the same meaning as before
       - Parameters map - input parameters are now provided in a form of map instead of variable number of handler function arguments
       - Extra map - every hook handler now can have a static context, in the same way as packet handlers. This map is automatically extended with 'hook_name' and 'hook_tag' ('global' or HostType) parameters on hook registration, so there is no need to add HostType into Parameters map any more.
    * the old format of hook handlers is still supported (until the full conversion of all the hook handlers is done)
    * conversion of the hooks can be done hook by hook, the following steps must be done to convert the hook:
       - convert hook execution function at 'mongoose_hooks' module.
       - convert all the handlers of the hook (they must be registered using gen_hook interface instead of ejabberd_hook).
       - also, it's possible to mix old & new hook handlers formats (see example at mongoose_hooks:push_notifications/4).
    * note that 'gen_hook' accepts only external function references (in format "fun Module:Function/Arity', e.g. "fun erlang:is_function/1") as hook handler function parameter.
    DenysGonchar committed Jul 16, 2021
    Configuration menu
    Copy the full SHA
    43a4064 View commit details
    Browse the repository at this point in the history
  3. fixing xref issues

    DenysGonchar committed Jul 16, 2021
    Configuration menu
    Copy the full SHA
    9463958 View commit details
    Browse the repository at this point in the history