[Bug 39188] TpFileTransferChannel: add API to send and receive the file
bugzilla-daemon at freedesktop.org
bugzilla-daemon at freedesktop.org
Thu Nov 10 14:19:56 CET 2011
https://bugs.freedesktop.org/show_bug.cgi?id=39188
--- Comment #11 from Jonny Lamb <jonny.lamb at collabora.co.uk> 2011-11-10 05:19:56 PST ---
(In reply to comment #7)
> (In reply to comment #3)
> > It doesn't do any hashing at all. I spoke to Guillaume about this and it really
> > needs to be another utility class unfortunately. This only really implements
> > {Offer,Provide}File.
>
> I'd like to have a rough idea of how this API will look like, just to be sure
> that yours will work with it.
> Especially, we have to be sure that we provide any info/state changes to feed
> to Empathy's file transfer dialog.
Let's say it's called TpFTHelper for now. Perhaps something like this:
TpFTHelper * tp_ft_helper_new_outgoing (
TpAccount *);
void tp_ft_helper_send_file_async (
TpFTHelper *,
GFile *source,
GHashTable *asv,
GAsyncReadyCallback,
gpointer);
gboolean tp_ft_helper_send_file_finish (
TpFTHelper *,
GAsyncResult *,
GError **);
GObject properties:
guint64: transferred-bytes (including change notification)
TpFTHelperState: state (including change notification)
send_file should do this:
1. Hash the GFile;
2. request the channel with additional properties given in the asv
argument (like Metadata.ServiceName, Metadata.Metadata);
3. call provide_file at the right time;
4. call the callback once the transfer is complete.
Empathy's file transfer window only needs to know a few things:
1. When the file gets accepted (this is currently not done by a state
change but when the transferred bytes property "changes" to zero).
2. When hashing has started and when hashing has stopped.
2. When bytes are sent. notify::transferred-bytes is fine for this.
3. When the transfer is complete. notify::state is fine for this too.
This feels a lot like EmpathyFTHandler.
(I have actually already ported Empathy to use the new TpFTChannel
methods; see https://bugzilla.gnome.org/show_bug.cgi?id=663682)
TpFTHelper * tp_ft_helper_new_incoming (
TpFileTransferChannel *);
void tp_ft_helper_receive_file_async (
TpFTHelper *,
GFile *destination,
GAsyncReadyCallback, gpointer);
gboolean tp_ft_helper_receive_file_finish (
TpFTHelper *,
GAsyncResult *,
GError **);
receive_file should do this:
* Call accept_file on the TpFTChannel;
* hash the file either on the way in (ideally), or hash the file
after the transfer is complete (less cool);
* call the callback when the transfer is complete.
The same properties and change notification can work for incoming too.
The _new_* functions could take the GFile instead of waiting and
giving it to send/receive?
What do you think?
> Also, like I said in Comment 2, hashing of the incoming file should be done by
> the FT chan, but that shouldn't be a problem to add internal API to pass the
> hashing to the higher level object I guess.
Yeah I don't think this'll be a big problem.
--
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