Closed Slawutich closed 3 years ago
Thanks a lot.
This is something I had on my radar for a while. It's looking good, I'm slightly busy right now but I will take the time to review and release ASAP.
Very cool, thanks.
@Slawutich after giving it more thoughts, I'm not sure this is as useful as I thought it would.
For message and presence stanzas filtering by type and or child is either not what you want or not enough to be helpful.
For iq stanzas, https://github.com/xmppjs/xmpp.js/tree/master/packages/iq#callee already provides a convenient API
That's also more or less how prosody exposes it https://prosody.im/doc/developers/events#stanzas
What do you think? Can you elaborate on your use case?
Closing due to inactivity.
The main motivation is to get rid of the checks in the middleware handler. This pattern is traced in many parts of the code
for example https://github.com/xmppjs/xmpp.js/blob/f0dd463102143cdc3dacdcab7a1921bab0ff0cd7/packages/iq/callee.js#L109 https://github.com/xmppjs/xmpp.js/blob/f0dd463102143cdc3dacdcab7a1921bab0ff0cd7/packages/stream-features/index.js#L13
and also regularly have to write conditions in their logic
backward compatibility fully preserved