[Telepathy] tp-qt4 FileTransfer API proposal

George Goldberg george.goldberg at collabora.co.uk
Tue Sep 1 09:32:06 PDT 2009


Will Thompson wrote:
> George Goldberg wrote:
>   
>> However, I think the number of parameters there is
>> really frightening.
>>     
>
> Yes it is.
>
>   
>> If I understand the instructions below, you have to
>> call FileTransferChannel::provideFile() below anyway, so why does the
>> createFileTransfer method need all that information?
>>     
>
> Because when you Create a FT channel, the file is immediately offered to
> your peer. You have to call provideFile() before any data is sent, but
> the offer is sent immediately. So, any information you want to be in the
> offer (like the hash, so they can figure out if it's a file they've
> received part of before) has to be in the channel request.
>   
OK, so that's just the way it works.

I vaguely remember an IRC discussion a while back to do with the types
of hashes supported being protocol specific. Is this relevant here, or
am I just getting confused?
> The ridiculous number of arguments is kind of unfortunate. One way
> around this could be (pardon my poor C++, I forget how to specify
> defaults):
>
>   class FTProps {
>     public:
>       FTProps(fileName, contentType, size);
>
>       FileHashType contentHashType = (FileHashType) -1;
>       const QString &contentHash = QString();
>       const QString &description = QString();
>       QDateTime lastModificationTime = QDateTime();
>       QDateTime userActionTime = QDateTime::currentDateTime();
>   }
>
>    PendingChannelRequest *createFileTransfer(
>      const QString &contactIdentifier,
>      const FTProps &props,
>      const QString &preferredHandler = QString());
>
> Maybe this is not idiomatic C++? But something like this would make it
> easier to see which props are optional, and make the method easier to
> read.
>   
It scares me a lot less than the plain method with a billion parameters :)


George

--
George Goldberg


More information about the telepathy mailing list