Package twisted :: Package protocols :: Module irc :: Class DccFileReceive |
[show private | hide private]
[frames | no frames]

## Class DccFileReceive

    BaseProtocol --+
                   |
            Protocol --+
                       |
           Ephemeral --+
                       |
     DccFileReceiveBasic --+
                           |
                          DccFileReceive

Higher-level coverage for getting a file from DCC SEND.

I allow you to change the file's name and destination directory. I won't overwrite an existing file unless I've been told it's okay to do so. If passed the resumeOffset keyword argument I will attempt to resume the file from that amount of bytes.

XXX: I need to let the client know when I am finished. XXX: I need to decide how to keep a progress indicator updated. XXX: Client needs a way to tell me "Do not finish until I say so." XXX: I need to make sure the client understands if the file cannot be written.

Method Summary
| `__init__(self, filename, fileSize, queryData, destDir, resumeOffset)`
| `__getstate__(self)` (inherited from `Ephemeral`)
| `__repr__(self)`
| `__setstate__(self, state)` (inherited from `Ephemeral`)
| `__str__(self)`
| ``connectionFailed`(self)` (Deprecated) (inherited from `Protocol`)
| ``connectionLost`(self, reason)` When the connection is lost, I close the file.
| ``connectionMade`(self)` Called when a connection is made.
| ``dataReceived`(self, data)` Called when data is received.
| ``set_directory`(self, directory)` Set the directory where the downloaded file will be placed.
| ``set_filename`(self, filename)` Change the name of the file being transferred.
| ``set_overwrite`(self, boolean)` May I overwrite existing files?

Class Variable Summary
`str` | `destDir`
`str` | `filename`
`int` | `fileSize`
`NoneType` | `fromUser`
`int` | `overwrite`
`NoneType` | `queryData`

Method Details

### connectionLost(self, reason) When the connection is lost, I close the file.

### connectionMade(self) Called when a connection is made. This may be considered the initializer of the protocol, because it is called when the connection is completed. For clients, this is called once the connection to the server has been established; for servers, this is called after an accept() call stops blocking and a socket has been received. If you need to send any greeting or initial message, do it here. Overrides: `twisted.internet.protocol.BaseProtocol.connectionMade` (inherited documentation)

### dataReceived(self, data) Called when data is received. Warning: This just acknowledges to the remote host that the data has been received; it doesn't *do* anything with the data, so you'll want to override this. Overrides: `twisted.protocols.irc.DccFileReceiveBasic.dataReceived` (inherited documentation)

### set_directory(self, directory) Set the directory where the downloaded file will be placed. May raise OSError if the supplied directory path is not suitable.

### set_filename(self, filename) Change the name of the file being transferred. This replaces the file name provided by the sender.

### set_overwrite(self, boolean) May I overwrite existing files?

Class Variable Details

    ### destDir Type: `str` Value:
        '.'

    ### filename Type: `str` Value:
        'dcc'

    ### fileSize Type: `int` Value:
        -1

    ### fromUser Type: `NoneType` Value:
        None

    ### overwrite Type: `int` Value:
        0

    ### queryData Type: `NoneType` Value:
        None

Generated by Epydoc 1.1 on Thu May 8 13:16:39 2003 | http://epydoc.sf.net