So I wrote an XML console, and I quickly looked at adding a signal for incoming stanzas. According to Wocky's docs:
* @self: A #WockyPorter instance (passed to @callback).
* @type: The type of stanza to be handled, or WOCKY_STANZA_TYPE_NONE to match
* any type of stanza.
But you can't actually pass WOCKY_STANZA_TYPE_NONE, because the implementation winds up calling wocky_stanza_new_with_sub_type() which calls check_sub_type() which asserts that type != NONE for obvious reasons: the type name is the name of the root element, so of course it needs a non-NONE one.
I suspect that the porter ought really to special-case NONE, and assert in itself that sub_type is also NONE and that the varargs are empty, and not build a stanza at all.
Created attachment 48480 [details] [review]
Porter: support matching STANZA_TYPE_NONE
For really specialised cases, like an XML console in Gabble, you want to
be able to match stanzas of any type. The docs claim you can do this,
but they lie.
I could be convinced that the correct way to do this is to add a fourth
method, wocky_porter_register_handler_for_any_stanza (), and that the
server/anyone/from variants are unnecessary. Thoughts?
hey there are a couple more patches in the referenced branch.
Looks good to me
Cheers, merged to the master.