Bug 38577 - Can't register handlers for stanzas of any type
Summary: Can't register handlers for stanzas of any type
Status: RESOLVED FIXED
Alias: None
Product: Wocky
Classification: Unclassified
Component: General (show other bugs)
Version: unspecified
Hardware: Other All
: medium normal
Assignee: Will Thompson
QA Contact: Telepathy bugs list
URL: http://cgit.collabora.com/git/user/wj...
Whiteboard: r+
Keywords: patch
Depends on:
Blocks: xmpp-console
  Show dependency treegraph
 
Reported: 2011-06-22 11:38 UTC by Will Thompson
Modified: 2011-11-18 03:50 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments
Porter: support matching STANZA_TYPE_NONE (10.87 KB, patch)
2011-06-27 11:48 UTC, Will Thompson
Details | Splinter Review

Description Will Thompson 2011-06-22 11:38:32 UTC
So I wrote an XML console, and I quickly looked at adding a signal for incoming stanzas. According to Wocky's docs:

 * wocky_porter_register_handler_from_anyone:
 * @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.
Comment 1 Will Thompson 2011-06-27 11:48:56 UTC
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?
Comment 2 Will Thompson 2011-11-18 03:03:10 UTC
hey there are a couple more patches in the referenced branch.
Comment 3 Simon McVittie 2011-11-18 03:23:41 UTC
Looks good to me
Comment 4 Will Thompson 2011-11-18 03:50:51 UTC
Cheers, merged to the master.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.