[Telepathy] tp-qt4 FileTransfer API proposal

Will Thompson will.thompson at collabora.co.uk
Tue Sep 1 09:21:23 PDT 2009


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.

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.

Regards,

-- 
Will

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 260 bytes
Desc: OpenPGP digital signature
Url : http://lists.freedesktop.org/archives/telepathy/attachments/20090901/f5bfea8c/attachment.pgp 


More information about the telepathy mailing list