#947 API Documentation on events could be potentially misleading

Reporter nonfreepizza
Owner Nobody
Stars ★ (1)
  • Component-Docs
  • Priority-Medium
  • Status-Accepted
  • Type-Defect
  1. nonfreepizza on

    While writing a simple module which echoes a message sent to "host/test" I referenced the events documentation on https://prosody.im/doc/developers/events which says the message event fired has the following form: >NAME/DEST >Where NAME is one of 'message', 'presence' or 'iq'. DEST is the type of the destination JID, and may be 'full' (destination JID has a resource), 'bare' (destination JID has no resource) or 'host' (destination JID is a host, such as "example.com"). This lead me to believe the event I was looking for would be caught by hooking into "message/full" as the destination JID has a resource. However, the actual event for this is "message/host". The documentation should better reflect this.

  2. Zash on

    Thanks! I suppose the current text is written with the assumption that one assumes that the "default" JID is one with a username. Code dealing with host+resource events are in fact fairly rare these days. It was more popular in the earlier days of XMPP/Jabber. Most or many uses have since been replaced by Ad-Hoc commands which allow greater flexibility. Rewording to remove the hidden assumption should be doable, and should be done.

    • tags Status-Accepted
  3. Zash on

    • tags Component-Docs

New comment

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