Go to the latest version of this document.
search in docstrings

Search bar offers the following options:

- Term presence. The below example searches for documents that must contain “foo”, might contain “bar” and must not contain “baz”: `+foo bar -baz`
- Wildcards. The below example searches for documents with words beginning with “foo”: `foo*`
- Search in specific fields. The following search matches all objects in "twisted.mail" that matches “search”: `+qname:twisted.mail.* +search`

  Possible fields: 'name', 'qname' (fully qualified name), 'docstring', and 'kind'. Last two fields are only applicable if "search in docstrings" is enabled.

- Fuzzy matches. The following search matches all documents that have a word within 1 edit distance of “foo”: `foo~1`

Results provided by Lunr.js

# ``twisted`.`words`.`protocols`.`irc`.`DccFileReceive``

class documentation

`class DccFileReceive(DccFileReceiveBasic): (source)`

View In Hierarchy

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 | `__init__` | No summary
Method | `__repr__` | Undocumented
Method | `__str__` | Undocumented
Method | `connectionLost` | When the connection is lost, I close the file.
Method | `connectionMade` | Called when a connection is made.
Method | `dataReceived` | See: `protocol.Protocol.dataReceived`
Method | `set_directory` | Set the directory where the downloaded file will be placed.
Method | `set_filename` | Change the name of the file being transferred.
Method | `set_overwrite` | May I overwrite existing files?
Instance Variable | `connected` | Undocumented
Instance Variable | `destDir` | The destination directory for the file to be received.
Instance Variable | `file` | Undocumented
Instance Variable | `filename` | The name of the file to get.
Instance Variable | `fileSize` | The size of the file to get, which has a default value of `-1` if the size of the file was not specified in the DCC SEND request.
Instance Variable | `fromUser` | This is the hostmask of the requesting user and is found at index 0 of `queryData`.
Instance Variable | `overwrite` | An integer representing whether an existing file should be overwritten or not. This initially is an `int` but can be modified to be a `bool` using the `set_overwrite` method.
Instance Variable | `queryData` | queryData is a 3-tuple of (user, channel, data).
Instance Variable | `_resumeOffset` | Undocumented

Inherited from `DccFileReceiveBasic`:

Instance Variable | `bytesReceived` | An integer representing the number of bytes of data received.
Instance Variable | `resume` | Undocumented

Inherited from `Protocol` (via `DccFileReceiveBasic`):

Method | `logPrefix` | Return a prefix matching the class name, to identify log messages related to this protocol instance.
Class Variable | `factory` | Undocumented

Inherited from `BaseProtocol` (via `DccFileReceiveBasic`, `Protocol`):

Method | `makeConnection` | Make a connection to a transport and a server.
Instance Variable | `transport` | Undocumented

Inherited from `Ephemeral` (via `DccFileReceiveBasic`, `Protocol`, `BaseProtocol`):

Method | `__getstate__` | Undocumented
Method | `__reduce__` | Serialize any subclass of `Ephemeral` in a way which replaces it with `Ephemeral` itself.
Method | `__setstate__` | Undocumented
Instance Variable | `__class__` | Undocumented

def __init__(self, filename, fileSize=-1, queryData=None, destDir='.', resumeOffset=0): (source)
overrides `twisted.words.protocols.irc.DccFileReceiveBasic.__init__`

Parameters
filename | Undocumented
fileSize | Undocumented
queryData | Undocumented
destDir | Undocumented
resumeOffset:`int` | An integer representing the amount of bytes from where the transfer of data should be resumed.

def __repr__(self): (source)

Undocumented

Returns
`str` | Undocumented

def __str__(self): (source)

Undocumented

Returns
`str` | Undocumented

def connectionLost(self, reason): (source)
from `twisted.internet.interfaces.IProtocol`
overrides `twisted.internet.protocol.Protocol.connectionLost`

When the connection is lost, I close the file.

Parameters
reason:`Failure` | The reason why the connection was lost.

def connectionMade(self): (source)
from `twisted.internet.interfaces.IProtocol`
overrides `twisted.internet.protocol.BaseProtocol.connectionMade`

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.

def dataReceived(self, data): (source)
from `twisted.internet.interfaces.IProtocol`
overrides `twisted.words.protocols.irc.DccFileReceiveBasic.dataReceived`

See: `protocol.Protocol.dataReceived`

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.

def set_directory(self, directory): (source)

Set the directory where the downloaded file will be placed.

May raise OSError if the supplied directory path is not suitable.

Parameters
directory:`bytes` | The directory where the file to be received will be placed.

def set_filename(self, filename): (source)

Change the name of the file being transferred.

This replaces the file name provided by the sender.

Parameters
filename:`bytes` | The new name for the file.

def set_overwrite(self, boolean): (source)

May I overwrite existing files?

Parameters
boolean:`bool` | A boolean value representing whether existing files should be overwritten or not.

connected: `int` = (source)
overrides `twisted.internet.protocol.BaseProtocol.connected`

Undocumented

destDir: `bytes` = (source)

The destination directory for the file to be received.

file = (source)

Undocumented

filename: `bytes` = (source)

The name of the file to get.

fileSize: `int` = (source)

The size of the file to get, which has a default value of `-1` if the size of the file was not specified in the DCC SEND request.

fromUser: `bytes` = (source)

This is the hostmask of the requesting user and is found at index 0 of `queryData`.

overwrite: `int` or `bool` = (source)

An integer representing whether an existing file should be overwritten or not. This initially is an `int` but can be modified to be a `bool` using the `set_overwrite` method.

queryData: `tuple` = (source)

queryData is a 3-tuple of (user, channel, data).

_resumeOffset = (source)

Undocumented