[Bug 39188] TpFileTransferChannel: add API to send and receive the file

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Thu Nov 10 13:13:31 CET 2011


https://bugs.freedesktop.org/show_bug.cgi?id=39188

--- Comment #9 from Jonny Lamb <jonny.lamb at collabora.co.uk> 2011-11-10 04:13:31 PST ---
(In reply to comment #4)
> I'm lost in a sea of green pluses, but here's a few initial thoughts:
> 
> + * To send a file to a contact, one should create a File Transfer
> + * channel with the appropriate D-Bus properties set by specifying
> + * their values in the channel creation method call. The file transfer
> + * invitation will be sent to the remote contact when the channel is
> + * created.
> 
> It would be much more helpful to give a code example here.

le done.

> +static void
> +operation_failed (TpFileTransferChannel *self,
> +    const GError *error)
> +{
> +  g_simple_async_result_set_from_error (self->priv->result, error);
> 
> It comes to my attention that we do now depend on a new enough GLib that we
> could use _take_error where appropriate. (Almost every place that calls
> operation_failed calls g_error_free right afterwards.)

OK, done.

> +static void
> +client_socket_connected (TpFileTransferChannel *self)
> +{
> +  GSocketConnection *conn;
> +  GError *error = NULL;
> +
> +  conn = g_socket_connection_factory_create_connection (
> +      self->priv->client_socket);
> +  if (conn == NULL)
> +    {
> +      DEBUG ("Failed to create client connection: %s", error->message);
> +      operation_failed (self, error);
> +      return;
> +    }
> 
> but here, error will always be NULL on the error path and we'll crash.

Good point.

(In reply to comment #5)
> I don't think this is safe. TpProxy's _dispose() method, which is called after
> TpFileTransferChannel's, emits invalidated if the proxy wasn't already
> invalidated. But by that time, self->priv->cancellable will have been freed by
> TpFTChannel's _dispose() implementation.

Okay, I'll add a check for cancellable being NULL. I want the splicing to stop
soon after the channel closes. This is the best way, right?

(In reply to comment #6)
> The stray newline here offends me.

Get out more.

> If the CM erroneously emits this signal when URI was already defined, this
> leaks.

Good point, fixed.

-- 
Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA Contact for the bug.
You are the assignee for the bug.



More information about the telepathy-bugs mailing list