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

Class DccFileReceive

       Ephemeral --+    
                   |    
BaseProtocol --+   |    
               |   |    
        Protocol --+    
                   |    
 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)
  __repr__(self)
  __str__(self)
  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?
    Inherited from Protocol
  connectionFailed(self)
(Deprecated)
    Inherited from BaseProtocol
  makeConnection(self, transport)
Make a connection to a transport and a server.
    Inherited from Ephemeral
  __getstate__(self)
  __setstate__(self, state)

Class Variable Summary
str destDir = '.'
str filename = 'dcc'
int fileSize = -1                                                                    
NoneType fromUser = None                                                                  
int overwrite = 0                                                                     
NoneType queryData = None                                                                  
    Inherited from DccFileReceiveBasic
int bytesReceived = 0                                                                     
    Inherited from Protocol
tuple __implements__ = (<class twisted.internet.interfaces.IPr...
    Inherited from BaseProtocol
int connected = 0                                                                     
NoneType transport = None                                                                  

Method Details

connectionLost(self, reason)

When the connection is lost, I close the file.
Overrides:
twisted.internet.protocol.Protocol.connectionLost

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 2.0 on Sat May 15 20:08:56 2004 http://epydoc.sf.net