irc.dcc.prv
Class DCCChatServer

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

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

The DCCChat server. There is a distinct DCCChat server for each active DCCChat.


Field Summary
 
Fields inherited from class irc.IRCObject
_ircConfiguration
 
Constructor Summary
DCCChatServer(IRCConfiguration config, java.lang.String thisNick, java.lang.String remoteNick)
          Create a new DCCChat server.
 
Method Summary
 void addServerListener(ServerListener l)
          Add a server listener.
 void close()
          Close this communication.
 void connect()
          Try to connect to the server, using default configuration.
 void disconnect()
          Disconnect from the server.
 void enumerateSourcesAsCreated(ServerListener lis)
          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 openActive(java.lang.String ip, java.lang.String port)
          Open an active connection on the given chat.
 java.lang.String openPassive()
          Open a passive connection on the given chat.
 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.
 void sendStatusMessage(java.lang.String str)
          Send the given message to the server's status.
 void setDefaultSource(Source s)
          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

DCCChatServer

public DCCChatServer(IRCConfiguration config,
                     java.lang.String thisNick,
                     java.lang.String remoteNick)
Create a new DCCChat server.

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

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.

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 lis)
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:
lis - listener to call.

setDefaultSource

public void setDefaultSource(Source s)
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:
s - default source.

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

openActive

public void openActive(java.lang.String ip,
                       java.lang.String port)
Open an active connection on the given chat.

Parameters:
ip - the ip to contact.
port - the port to contact.

openPassive

public java.lang.String openPassive()
Open a passive connection on the given chat.

Returns:
the string to send to the remote peer to begin the communication.

run

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

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.

close

public void close()
Close this communication.


leave

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

Specified by:
leave in interface Server

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.