#947 API Documentation on events could be potentially misleading
Reporter
nonfreepizza
Owner
Nobody
Created
Updated
Stars
★ (1)
Tags
Status-Accepted
Priority-Medium
Type-Defect
Component-Docs
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.
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.
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.
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.
Changes