Fallback stanza listener

Is there an easy way to identify incoming packages that are not handled by another stanza listener? Im currently doing this:


            new NotFilter(

                    new OrFilter(

                          <all my listeners






But it obviously doesn’t work well when constantly adding/removing listeners. I just want to know if there are incoming packages which are unexpected and not handled in any way.

I see that one may want to know about not handled stanzas, and think that it’s possible to add such a feature, it has a low priority for me (of course, patches are always welcome).

Let’s have a look about what kind of stanzas we have: IQ, Presence, and Message.

IQ set/get for whose there is no handler registered will be automatically replied with a service-unavailable error IQ. And obviously you would notice that you are not handling those when you thought you would. For IQ results/errors there is either someone listening, because you made an IQ request awaiting a response, or you don’t care either.

Presences are mostly handled automatically by Smack. It is possible that there are some high level API callbacks missing, but I can’t come up with an example right now (so likely nothing important).

And for messages you usually want to have a catch all handler anyway.

ok, thanks for clarification. Yes, all messages are handled and presence stanzas are not that important.

Whats left are IQ stanzas and errors can be coming in from other clients or the server at any time. So, I will simply use a listener with IQTypeFilter.ERROR here and guess that’s enough.

So, I will simply use a listener with IQTypeFilter.ERROR here and guess that’s enough.

Why would you want to do that? If there is an error IQ incoming then there is very likely someone waiting for that IQ response: The one who sent the IQ request in the first place.

well, if an IQ request is sent, I also register a listener for the response. But I’m unsure about the XMPP specification here: is it guaranteed that IQ errors are only sent in response to a request (and within a timeout)?

Short answer: yes (but no one guarantees that)