[Telepathy] File transfer spec: need for advice

Emanuele Aina faina.mail at tiscali.it
Thu Aug 23 15:06:48 PDT 2007

Marco Barisione ipotizzò:

> I'm going to add a new CLOSED state to the existing ones
> (LOCAL_PENDING, REMOTE_PENDING and OPEN), but then FileTransferClosed
> signal would become a duplicate of FileTransferStateChanged so I'm going
> to remove it.
> The problem is that FieTransferClosed has a reason argument specifying
> why the file transfer was closed (local/remote error, local/remote
> stopped and success). What do you suggest to do? I want to remove
> FileTransferClosed but I need the reason argument. My ideas are:
> - Add a reason argument to FileTransferStateChanged and pass a
> NOT_CLOSED value when the new state is not CLOSED.
> - Add a reason argument to FileTransferStateChanged and pass something
> like ACCEPTED when the state changes from LOCAL/REMOTE_PENDING to OPEN
> (other transitions are not possible at the moment). The enumeration
> could be renamed from File_Transfer_Close_Reason to something like
> File_Transfer_State_Change_Reason.
> - Do not add a reason argument but add a GetCloseReason() method, this
> is what I would do in a normal API but here we have a DBUS call and I
> don't like adding a roundtrip only to get the reason.

What about getting rid of the Reason enum entirely and represent it with 
the status?

Instead of adding a new CLOSED state we can add the COMPLETED, 

It would make the client a little bit more complex, as it is not 
immediately clear that those states all means that the file transfer is 
ended, but I think that is true only if you don't care about the reason 
and that should not happen a lot, as you are effectively ignoring if the 
file transfer was succesfull or not.

Another alternative could me a mixed approach: add the COMPLETED and 
INTERRUPTED states and then use GetInterruptionReason() only when an 
error occur.

This should give a roundtrip only in the (hopefully not so frequent) 
error case and a simpler API.

Complimenti per l'ottima scelta.

More information about the Telepathy mailing list