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.
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.
Methods
|
|
__init__
__repr__
__str__
connectionLost
connectionMade
dataReceived
set_directory
set_filename
set_overwrite
|
|
__init__
|
__init__ (
self,
filename,
fileSize=-1,
queryData=None,
destDir='.',
)
|
|
__repr__
|
__repr__ ( self )
|
|
__str__
|
__str__ ( self )
|
|
connectionLost
|
connectionLost ( self )
When the connection is lost, I close the file.
|
|
connectionMade
|
connectionMade ( self )
Exceptions
|
|
OSError( errno.EEXIST, "There's a file in the way. " "Perhaps that's why you cannot open it.", dst )
|
|
|
dataReceived
|
dataReceived ( self, data )
|
|
set_directory
|
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.
Exceptions
|
|
OSError( errno.EACCES, "This directory is too hard to write in to.", directory )
OSError( errno.ENOENT, "You see no directory there.", directory )
OSError( errno.ENOTDIR, "You cannot put a file into " "something which is not a directory.", directory )
|
|
|
set_filename
|
set_filename ( self, filename )
Change the name of the file being transferred.
This replaces the file name provided by the sender.
|
|
set_overwrite
|
set_overwrite ( self, boolean )
May I overwrite existing files?
|
|