#605 module:context(host):hook() doesn't work if host hasn't been activated yet

Reporter Daurnimator
Owner MattJ
Created
Updated
Stars ★ (1)
Tags
  • Priority-Medium
  • Type-Defect
  • Status-Fixed
  1. Daurnimator on

    `module:context(host):hook()` doesn't work if host hasn't been activated yet. ```lua function api:hook(event, handler, priority) return self:hook_object_event((hosts[self.host] or prosody).events, event, handler, priority); end ``` If the host hasn't been activated yet (e.g. during startup) it ends up attaching the event to the global `prosody` object instead.

  2. MattJ on

    Fixed in e6c6f58dfda1 and 622790951285, nearly 10 years later :) Also updated https://prosody.im/doc/developers/moduleapi#modulecontext_host with a note about the behaviour and to caution against general use.

    Changes
    • tags Status-Fixed
    • owner MattJ

New comment

Not published. Used for spam prevention and optional update notifications.