irc
Class ServerProtocol

java.lang.Object
  |
  +--irc.IRCObject
        |
        +--irc.ServerProtocol
All Implemented Interfaces:
java.lang.Runnable

public class ServerProtocol
extends IRCObject
implements java.lang.Runnable

The raw irc server protocol handler.


Field Summary
 
Fields inherited from class irc.IRCObject
_ircConfiguration
 
Constructor Summary
ServerProtocol(IRCConfiguration config)
          Create a new ServerProtocol.
 
Method Summary
 void addServerProtocolListener(ServerProtocolListener lis)
          Add a listener.
 void connect(java.lang.String host, int port)
          Connect to the server.
 boolean connected()
          Return connected status.
 boolean connecting()
          Return connecting status.
 void disconnect()
          Disconnect from server.
 int getLocalPort()
          Get the local, client-side tcp port for the current connection.
 void removeServerProtocolListener(ServerProtocolListener lis)
          Remove a listener.
 void run()
           
 void sendCommand(java.lang.String command, java.lang.String[] params)
          Send a formatted string to the server.
 void sendString(java.lang.String str)
          Send a raw string to the server.
 
Methods inherited from class irc.IRCObject
getColor, getIRCConfiguration, getText, getText, getText, getText, getTimeStamp, release
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ServerProtocol

public ServerProtocol(IRCConfiguration config)
Create a new ServerProtocol.

Parameters:
config - global irc configuration.
Method Detail

connect

public void connect(java.lang.String host,
                    int port)
Connect to the server.

Parameters:
host - server host.
port - server port.

connected

public boolean connected()
Return connected status.

Returns:
true if connected, false otherwise.

connecting

public boolean connecting()
Return connecting status.

Returns:
true if connecting, false otherwise.

disconnect

public void disconnect()
Disconnect from server.


getLocalPort

public int getLocalPort()
Get the local, client-side tcp port for the current connection.


run

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

addServerProtocolListener

public void addServerProtocolListener(ServerProtocolListener lis)
Add a listener.

Parameters:
lis - listener to add.

removeServerProtocolListener

public void removeServerProtocolListener(ServerProtocolListener lis)
Remove a listener.

Parameters:
lis - listener to remove.

sendString

public void sendString(java.lang.String str)
                throws java.lang.Exception
Send a raw string to the server.

Parameters:
str - string to send.
Throws:
java.lang.Exception - if something went wrong.

sendCommand

public void sendCommand(java.lang.String command,
                        java.lang.String[] params)
                 throws java.lang.Exception
Send a formatted string to the server.

Parameters:
command - comment to send.
params - parameters list. Only the last parameter can contain blanks.
Throws:
java.lang.Exception - if something went wrong.