[Bug 42909] New: Add a file transfer helper

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Mon Nov 14 12:37:02 CET 2011


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

             Bug #: 42909
           Summary: Add a file transfer helper
    Classification: Unclassified
           Product: Telepathy
           Version: git master
          Platform: Other
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: medium
         Component: tp-glib
        AssignedTo: telepathy-bugs at lists.freedesktop.org
        ReportedBy: jonny.lamb at collabora.co.uk
         QAContact: telepathy-bugs at lists.freedesktop.org


from bug #39188:

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?

(Guillaume said)
> (In reply to comment #1)
> > Let's say it's called TpFTHelper for now. Perhaps something like this:
> 
> Looks good to me.

-- 
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