[Telepathy] tp-qt4 FileTransfer API proposal

Will Thompson will.thompson at collabora.co.uk
Tue Sep 1 11:36:24 PDT 2009


Andre Moreira Magalhaes wrote:
> So changing it won't make much difference from what we have now. We 
> would have a class with the constructor containing all the default 
> values. Why let in the constructor? As they can't be changed after creation.
> 
> Ps.: Making the members public accessible is not an option, neither 
> having setters methods for them, as they can't change after creation.

I didn't envisage the FTProps object sticking around once you call
createFileTransfer(). This was just a proposed way to fake Python-style
keyword arguments, which are really what we want here:

    def createFileTransfer(contact, fileName, contentType, size,
                           contentHashType=-1,
                           contentHash="",
                           description="",
                           lastModificationTime=0,
                           userActionTime=0,
                           preferredHandler=""):
        # ...


    # Now applications can write:

    createFileTransfer("foo at bar.com", "cat.jpg", "image/jpeg", 5000,
        lastModificationTime=47547)

    # omitting any arguments they don't care about.

So in C++ this would become:

    FTProps p("cat.jpg", "image/jpeg", 5000);

    p.lastModificationTime(47547);
    cr = account.createFileTransfer("foo at bar.com", p)

    // and never use 'p' again.

-- 
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/50beeb39/attachment.pgp 


More information about the telepathy mailing list