Bug 27311 - Allow WockyPubsub subclasses to extend create/delete; extend data forms code to support blind form submission
Summary: Allow WockyPubsub subclasses to extend create/delete; extend data forms code ...
Status: RESOLVED FIXED
Alias: None
Product: Wocky
Classification: Unclassified
Component: General (show other bugs)
Version: unspecified
Hardware: Other All
: medium normal
Assignee: Telepathy bugs list
QA Contact:
URL: http://git.collabora.co.uk/?p=user/wj...
Whiteboard: minor changes needed
Keywords: patch
Depends on:
Blocks:
 
Reported: 2010-03-25 08:27 UTC by Will Thompson
Modified: 2010-03-25 11:32 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments

Description Will Thompson 2010-03-25 08:27:28 UTC
This branch adds functions to give subclasses access to the create/delete stanzas, just like for other actions. It also extends the WockyDataForm class (and indeed renames it from WockyDataForms) to better support submitting forms blindly, without first retrieving the field definitions from the server. This is useful for forms with well-known fields, such as Pubsub node configuration forms!
Comment 1 Simon McVittie 2010-03-25 10:54:24 UTC
> +WockyXmppStanza *wocky_pubsub_service_create_create_node_stanza (

Rename to w_p_s_new_c_n_s or w_p_s_make_c_n_s? Or keep the current name for comedy value, either works :-)

> +WockyXmppStanza *
> +wocky_pubsub_node_make_delete_stanza (
> +    WockyPubsubNode *self,
> +    WockyXmppNode **pubsub_node,
> +    WockyXmppNode **delete_node)
...
> +  WockyXmppNode *p, *d; /* if we didn't have these, we'd have a great album */
...
> +        WOCKY_NODE_ASSIGN_TO, &p,
...
> +  if (pubsub_node != NULL)
> +    *pubsub_node = p;

Perhaps "WOCKY_NODE_ASSIGN_TO, NULL," should be defined to be a no-op, so that users of stanza_build don't have to do this dance every time?

> -  /* This stanza is inspired from Example 2 of XEP-0004: Data Forms */
> +  /* This stanza is inspired from Example 2 of XEP-0004: Data Form */

-1, over-zealous search and replace. Example 6 has the same problem.

> +data_form_set_value (WockyDataForm *form,
> +    const gchar *field_name,
> +    GValue *value,

Please say explicitly that the value must be slice-allocated.

Other than that, this all looks good.
Comment 2 Will Thompson 2010-03-25 11:03:20 UTC
(In reply to comment #1)
> > +WockyXmppStanza *wocky_pubsub_service_create_create_node_stanza (
> 
> Rename to w_p_s_new_c_n_s or w_p_s_make_c_n_s? Or keep the current name for
> comedy value, either works :-)

I'm pretty keen on the comedy value! Also, I'm increasingly convinced that the proliferation of create_foo_stanza() functions is sub-optimal, particularly when the extra information that needs stamping onto them is pretty uniform. I'm trying to think of better API for it, but haven't figured it out yet...

> > +WockyXmppStanza *
> > +wocky_pubsub_node_make_delete_stanza (
> > +    WockyPubsubNode *self,
> > +    WockyXmppNode **pubsub_node,
> > +    WockyXmppNode **delete_node)
> ...
> > +  WockyXmppNode *p, *d; /* if we didn't have these, we'd have a great album */
> ...
> > +        WOCKY_NODE_ASSIGN_TO, &p,
> ...
> > +  if (pubsub_node != NULL)
> > +    *pubsub_node = p;
> 
> Perhaps "WOCKY_NODE_ASSIGN_TO, NULL," should be defined to be a no-op, so that
> users of stanza_build don't have to do this dance every time?

Yeah, I wondered about this too. It's slightly counter-intuitive though: hey, please assign this node to ... oh actually, don't. But in practice it's probably harmless. I'll make a separate branch for this if that's okay?

> > -  /* This stanza is inspired from Example 2 of XEP-0004: Data Forms */
> > +  /* This stanza is inspired from Example 2 of XEP-0004: Data Form */
> 
> -1, over-zealous search and replace. Example 6 has the same problem.

Fixed.
 
> > +data_form_set_value (WockyDataForm *form,
> > +    const gchar *field_name,
> > +    GValue *value,
> 
> Please say explicitly that the value must be slice-allocated.

Fixed.
Comment 3 Will Thompson 2010-03-25 11:32:40 UTC
Merged on the assumption that my patches were okay. Filed bug 27317 about build.

http://git.collabora.co.uk/?p=wocky.git;a=commit;h=01a69bedb2b77e31c60c9e489e99b625c59b7959


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.