irc.dcc.prv
Class DCCFileHandler

java.lang.Object
  |
  +--irc.IRCObject
        |
        +--irc.dcc.prv.DCCFileHandler
All Implemented Interfaces:
java.lang.Runnable, Server

public class DCCFileHandler
extends IRCObject
implements Server, java.lang.Runnable

The dcc file handler. There is a handler for each file transfert.


Field Summary
 
Fields inherited from class irc.IRCObject
_ircConfiguration
 
Constructor Summary
DCCFileHandler(IRCConfiguration config, java.lang.String remoteNick, java.io.File f)
          Create a new DCCFileHandler.
 
Method Summary
 void addServerListener(ServerListener l)
          Add a server listener.
 void close()
          Close the current transfert.
 void connect()
          Try to connect to the server, using default configuration.
 void disconnect()
          Disconnect from the server.
 void enumerateSourcesAsCreated(ServerListener l)
          Enumerate all sources, as if they were created and notified to the given listener.
 void execute(java.lang.String str)
          Execute the given command on the remote server.
 java.lang.String getNick()
          Get the nickname on this server.
 java.util.Enumeration getSources()
          Get an enumeration of all the sources associated with this server.
 java.lang.String getUserName()
          Get the username on this server.
 boolean isConnected()
          Test whether the server is connected.
 void leave()
          Leave all sources, then leave the server.
 void receive(java.lang.String ip, java.lang.String port, java.lang.String size)
          Receive the file.
 void release()
          Release this object.
 void removeServerListener(ServerListener l)
          Remove a listener.
 void run()
           
 void say(java.lang.String destination, java.lang.String str)
          Say the specified string.
 java.lang.String send()
          Send the file in passive mode.
 void sendStatusMessage(java.lang.String str)
          Send the given message to the server's status.
 void setDefaultSource(Source source)
          Set the default output source this server should use if the destination source is undefined.
 
Methods inherited from class irc.IRCObject
getColor, getIRCConfiguration, getText, getText, getText, getText, getTimeStamp
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DCCFileHandler

public DCCFileHandler(IRCConfiguration config,
                      java.lang.String remoteNick,
                      java.io.File f)
Create a new DCCFileHandler.

Parameters:
config - the global configuration.
remoteNick - the remote nick.
Method Detail

release

public void release()
Description copied from class: IRCObject
Release this object. No further method call can be performed on this object.

Overrides:
release in class IRCObject

receive

public void receive(java.lang.String ip,
                    java.lang.String port,
                    java.lang.String size)
Receive the file.

Parameters:
ip - the remote ip.
port - the remote port.
size - the file size.

send

public java.lang.String send()
Send the file in passive mode.

Returns:
the string to send to the remote peer to initiate the transfert.

run

public void run()
Specified by:
run in interface java.lang.Runnable

close

public void close()
Close the current transfert.


say

public void say(java.lang.String destination,
                java.lang.String str)
Description copied from interface: Server
Say the specified string. This string is sent as it to the remote server.

Specified by:
say in interface Server
Parameters:
destination - message destination.
str - message itself.

execute

public void execute(java.lang.String str)
Description copied from interface: Server
Execute the given command on the remote server.

Specified by:
execute in interface Server
Parameters:
str - the command to execute.

sendStatusMessage

public void sendStatusMessage(java.lang.String str)
Description copied from interface: Server
Send the given message to the server's status.

Specified by:
sendStatusMessage in interface Server
Parameters:
str - string to send to the status.

getNick

public java.lang.String getNick()
Description copied from interface: Server
Get the nickname on this server.

Specified by:
getNick in interface Server
Returns:
the nickname on the server.

getUserName

public java.lang.String getUserName()
Description copied from interface: Server
Get the username on this server.

Specified by:
getUserName in interface Server
Returns:
the username on this server.

connect

public void connect()
Description copied from interface: Server
Try to connect to the server, using default configuration.

Specified by:
connect in interface Server

disconnect

public void disconnect()
Description copied from interface: Server
Disconnect from the server.

Specified by:
disconnect in interface Server

isConnected

public boolean isConnected()
Description copied from interface: Server
Test whether the server is connected.

Specified by:
isConnected in interface Server
Returns:
true if server is connected, false otherwise.

getSources

public java.util.Enumeration getSources()
Description copied from interface: Server
Get an enumeration of all the sources associated with this server.

Specified by:
getSources in interface Server
Returns:
an enumeration of Source.

enumerateSourcesAsCreated

public void enumerateSourcesAsCreated(ServerListener l)
Description copied from interface: Server
Enumerate all sources, as if they were created and notified to the given listener.

Specified by:
enumerateSourcesAsCreated in interface Server
Parameters:
l - listener to call.

setDefaultSource

public void setDefaultSource(Source source)
Description copied from interface: Server
Set the default output source this server should use if the destination source is undefined.

Specified by:
setDefaultSource in interface Server
Parameters:
source - default source.

addServerListener

public void addServerListener(ServerListener l)
Description copied from interface: Server
Add a server listener.

Specified by:
addServerListener in interface Server
Parameters:
l - listener to add.

removeServerListener

public void removeServerListener(ServerListener l)
Description copied from interface: Server
Remove a listener.

Specified by:
removeServerListener in interface Server
Parameters:
l - listener to remove.

leave

public void leave()
Description copied from interface: Server
Leave all sources, then leave the server.

Specified by:
leave in interface Server