Bug 69466 - Haze: fix connection interfaces we claim to support
Summary: Haze: fix connection interfaces we claim to support
Status: RESOLVED FIXED
Alias: None
Product: Telepathy
Classification: Unclassified
Component: haze (show other bugs)
Version: unspecified
Hardware: Other All
: medium normal
Assignee: Telepathy bugs list
QA Contact: Telepathy bugs list
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 31757
  Show dependency treegraph
 
Reported: 2013-09-17 13:29 UTC by Guillaume Desmottes
Modified: 2013-09-18 11:10 UTC (History)
2 users (show)

See Also:
i915 platform:
i915 features:


Attachments
connection: factor out protocol_info_supports_{avatar,blocking} (1.75 KB, patch)
2013-09-17 13:30 UTC, Guillaume Desmottes
Details | Splinter Review
connection: claim to support MailNotification if supported (1.43 KB, patch)
2013-09-17 13:30 UTC, Guillaume Desmottes
Details | Splinter Review
connection: factor out add_optionnal_connection_interfaces() (2.75 KB, patch)
2013-09-17 13:30 UTC, Guillaume Desmottes
Details | Splinter Review
factor out add_always_present_connection_interfaces() (1.38 KB, patch)
2013-09-17 13:30 UTC, Guillaume Desmottes
Details | Splinter Review
protocol: fix 'ConnectionInterfaces' (4.25 KB, patch)
2013-09-17 13:31 UTC, Guillaume Desmottes
Details | Splinter Review
protocol: fix 'ConnectionInterfaces' (4.19 KB, patch)
2013-09-17 13:51 UTC, Guillaume Desmottes
Details | Splinter Review
protocol: fix 'ConnectionInterfaces' (4.60 KB, patch)
2013-09-17 14:58 UTC, Guillaume Desmottes
Details | Splinter Review
85991: protocol: fix 'ConnectionInterfaces' (4.55 KB, patch)
2013-09-18 06:16 UTC, Guillaume Desmottes
Details | Splinter Review
86039: 85991: protocol: fix 'ConnectionInterfaces' (4.70 KB, patch)
2013-09-18 10:18 UTC, Guillaume Desmottes
Details | Splinter Review

Description Guillaume Desmottes 2013-09-17 13:29:06 UTC
- Connection doesn't claim to support MailNotifications even when it does
- Protocol['ConnectionInterfaces'] could be smarter and return the interfaces actually implemented for this protocol
Comment 1 Guillaume Desmottes 2013-09-17 13:30:18 UTC
Created attachment 85977 [details] [review]
connection: factor out protocol_info_supports_{avatar,blocking}
Comment 2 Guillaume Desmottes 2013-09-17 13:30:31 UTC
Created attachment 85978 [details] [review]
connection: claim to support MailNotification if supported
Comment 3 Guillaume Desmottes 2013-09-17 13:30:45 UTC
Created attachment 85979 [details] [review]
connection: factor out add_optionnal_connection_interfaces()
Comment 4 Guillaume Desmottes 2013-09-17 13:30:59 UTC
Created attachment 85980 [details] [review]
factor out add_always_present_connection_interfaces()
Comment 5 Guillaume Desmottes 2013-09-17 13:31:11 UTC
Created attachment 85981 [details] [review]
protocol: fix 'ConnectionInterfaces'
Comment 6 Simon McVittie 2013-09-17 13:33:30 UTC
Comment on attachment 85977 [details] [review]
connection: factor out protocol_info_supports_{avatar,blocking}

Review of attachment 85977 [details] [review]:
-----------------------------------------------------------------

++
Comment 7 Simon McVittie 2013-09-17 13:34:20 UTC
Comment on attachment 85978 [details] [review]
connection: claim to support MailNotification if supported

Review of attachment 85978 [details] [review]:
-----------------------------------------------------------------

Yes (but also, this interface was standardized - we should implement the standard version)
Comment 8 Simon McVittie 2013-09-17 13:35:31 UTC
Comment on attachment 85979 [details] [review]
connection: factor out add_optionnal_connection_interfaces()

Review of attachment 85979 [details] [review]:
-----------------------------------------------------------------

r+ with a spelling fix

::: src/connection.c
@@ +174,4 @@
>  }
>  
>  static void
> +add_optionnal_connection_interfaces (GPtrArray *ifaces,

"optional"
Comment 9 Simon McVittie 2013-09-17 13:36:01 UTC
Comment on attachment 85980 [details] [review]
factor out add_always_present_connection_interfaces()

Review of attachment 85980 [details] [review]:
-----------------------------------------------------------------

++
Comment 10 Simon McVittie 2013-09-17 13:39:07 UTC
Comment on attachment 85981 [details] [review]
protocol: fix 'ConnectionInterfaces'

Review of attachment 85981 [details] [review]:
-----------------------------------------------------------------

::: src/connection.c
@@ +140,5 @@
> +
> +    ifaces = g_ptr_array_new ();
> +    add_always_present_connection_interfaces (ifaces);
> +    add_optionnal_connection_interfaces (ifaces, prpl_info);
> +    g_ptr_array_add (ifaces, NULL);

Please either comment that it returns an array with NULL at the end, or just return a (transfer full) gchar **. I think I'd prefer the latter.
Comment 11 Guillaume Desmottes 2013-09-17 13:46:54 UTC
(In reply to comment #7)
> Comment on attachment 85978 [details] [review] [review]
> connection: claim to support MailNotification if supported
> 
> Review of attachment 85978 [details] [review] [review]:
> -----------------------------------------------------------------
> 
> Yes (but also, this interface was standardized - we should implement the
> standard version)

I opened bug #69468.

(In reply to comment #8)
> Comment on attachment 85979 [details] [review] [review]
> connection: factor out add_optionnal_connection_interfaces()
> 
> Review of attachment 85979 [details] [review] [review]:
> -----------------------------------------------------------------
> 
> r+ with a spelling fix
> 
> ::: src/connection.c
> @@ +174,4 @@
> >  }
> >  
> >  static void
> > +add_optionnal_connection_interfaces (GPtrArray *ifaces,
> 
> "optional"

fixed.
Comment 12 Guillaume Desmottes 2013-09-17 13:51:00 UTC
Created attachment 85986 [details] [review]
protocol: fix 'ConnectionInterfaces'
Comment 13 Guillaume Desmottes 2013-09-17 14:49:09 UTC
(In reply to comment #10)
> Comment on attachment 85981 [details] [review] [review]
> protocol: fix 'ConnectionInterfaces'
> 
> Review of attachment 85981 [details] [review] [review]:
> -----------------------------------------------------------------
> 
> ::: src/connection.c
> @@ +140,5 @@
> > +
> > +    ifaces = g_ptr_array_new ();
> > +    add_always_present_connection_interfaces (ifaces);
> > +    add_optionnal_connection_interfaces (ifaces, prpl_info);
> > +    g_ptr_array_add (ifaces, NULL);
> 
> Please either comment that it returns an array with NULL at the end, or just
> return a (transfer full) gchar **. I think I'd prefer the latter.

Humm actually "(transfer full) gchar **" is annoying because TpBaseConnection->get_interfaces_always_present is supposed to return a (transfer container) GPtrArray while TpBaseProtocol->get_connection_details returns a (transfer full) gchar **.

I'd like to reuse the same function for both so I'll go with the former option.
Comment 14 Guillaume Desmottes 2013-09-17 14:58:25 UTC
Created attachment 85991 [details] [review]
protocol: fix 'ConnectionInterfaces'
Comment 15 Simon McVittie 2013-09-17 15:06:11 UTC
(In reply to comment #13)
> Humm actually "(transfer full) gchar **" is annoying because
> TpBaseConnection->get_interfaces_always_present is supposed to return a
> (transfer container) GPtrArray while TpBaseProtocol->get_connection_details
> returns a (transfer full) gchar **.

g_i_a_p isn't meant to have the NULL at the end, though? So you'll have to have a conversion step either way, even if it's as simple as "copy each string, and append NULL".
Comment 16 Xavier Claessens 2013-09-17 16:03:14 UTC
I wish GPtrArray could handle the terminal NULL itself:
https://bugzilla.gnome.org/show_bug.cgi?id=631210
Comment 17 Guillaume Desmottes 2013-09-18 06:16:16 UTC
(In reply to comment #15)
> (In reply to comment #13)
> > Humm actually "(transfer full) gchar **" is annoying because
> > TpBaseConnection->get_interfaces_always_present is supposed to return a
> > (transfer container) GPtrArray while TpBaseProtocol->get_connection_details
> > returns a (transfer full) gchar **.
> 
> g_i_a_p isn't meant to have the NULL at the end, though? So you'll have to
> have a conversion step either way, even if it's as simple as "copy each
> string, and append NULL".

You're right:
- TpBaseProtocolGetConnectionDetailsFunc returns a transfer full NULL terminated gchar **.
- get_interfaces_always_present returns a transfer container not-NULL terminated GPtrArray.

haze_connection_dup_implemented_interfaces now returns (transfer container) and I dup the strings and append NULL afterward.
Comment 18 Guillaume Desmottes 2013-09-18 06:16:52 UTC
Created attachment 86039 [details] [review]
85991: protocol: fix 'ConnectionInterfaces'
Comment 19 Simon McVittie 2013-09-18 09:16:12 UTC
Comment on attachment 86039 [details] [review]
85991: protocol: fix 'ConnectionInterfaces'

Review of attachment 86039 [details] [review]:
-----------------------------------------------------------------

::: src/protocol.c
@@ +910,5 @@
> +      ifaces = haze_connection_dup_implemented_interfaces (
> +          self->priv->prpl_info);
> +      /* @connection_interfaces takes a NULL terminated (transfer full)
> +       * gchar ** so we have to dup each string and append NULL. */
> +      g_ptr_array_foreach (ifaces, (GFunc) g_strdup, NULL);

No, this copies the string, throws away the copy, and leaves the original in the array. Use a "for" loop.
Comment 20 Guillaume Desmottes 2013-09-18 10:18:03 UTC
Created attachment 86059 [details] [review]
86039: 85991: protocol: fix 'ConnectionInterfaces'

I blame me waking up at 7am for the previous patch. :)
Comment 21 Simon McVittie 2013-09-18 10:23:33 UTC
Comment on attachment 86059 [details] [review]
86039: 85991: protocol: fix 'ConnectionInterfaces'

Review of attachment 86059 [details] [review]:
-----------------------------------------------------------------

better!
Comment 22 Guillaume Desmottes 2013-09-18 11:10:55 UTC
Merged to 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.