Part of twisted.words.protocols.irc View Source View In Hierarchy
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||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?|
|Method||connectionMade||Called when a connection is made.|
|Method||dataReceived||Called when data is received.|
|Method||connectionLost||When the connection is lost, I close the file.|
|Method||logPrefix||Return a prefix matching the class name, to identify log messages related to this protocol instance.|
|Method||makeConnection||Make a connection to a transport and a server.|
May raise OSError if the supplied directory path is not suitable.
This replaces the file name provided by the sender.
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.
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.