de.berlios.suzy.irc
Class IrcClient

java.lang.Object
  extended by de.berlios.suzy.irc.IrcClient
All Implemented Interfaces:
IrcSender

public class IrcClient
extends java.lang.Object
implements IrcSender

This class is an IRC client. It will connect to the specified host and port. The client will try to reconnect if it gets disconnected.
Plugins are used to handle commands that start with the COMMAND_MODIFIER.

Author:
honk

Constructor Summary
IrcClient(java.lang.String network, java.lang.String server, int port, java.lang.String nickName, java.lang.String adminChannel, java.lang.String adminChannelPassword, int timeout, java.lang.String commandModifier)
          Creates a new IrcClient which will cause plugins to be loaded.
 
Method Summary
 void send(java.lang.String text)
          Sends this text to the irc server.
 void sendMessageTo(java.lang.String target, MessageTypes type, java.lang.String text)
          Sends this text to the target (user/channel) specified.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IrcClient

public IrcClient(java.lang.String network,
                 java.lang.String server,
                 int port,
                 java.lang.String nickName,
                 java.lang.String adminChannel,
                 java.lang.String adminChannelPassword,
                 int timeout,
                 java.lang.String commandModifier)
Creates a new IrcClient which will cause plugins to be loaded.

Parameters:
network - name of the network (used for config files e.g.)
server - address of the irc server
port - port of the irc server
nickName - the bot's name on irc
adminChannel - a channel which is used for determining administrator status
adminChannelPassword - the password for the adminChannel
timeout - timeout after which the bot will reconnect to the irc server in seconds (120 seconds should be a good value)
commandModifier - prefix the bot will look for when searching for commands from users (e.g. "!" if you want the bot to react to "!help")
Method Detail

send

public void send(java.lang.String text)
Sends this text to the irc server. If the text has more than 511 chars, it will be cut off. A linefeed will be added to the end of the String.

Specified by:
send in interface IrcSender
Parameters:
text - text to send

sendMessageTo

public void sendMessageTo(java.lang.String target,
                          MessageTypes type,
                          java.lang.String text)
Sends this text to the target (user/channel) specified. If the text has more than 511 chars, it will be cut off. A linefeed will be added to the end of the String.

Specified by:
sendMessageTo in interface IrcSender
Parameters:
target - specifies where the text should be send to
type - type of the message to send (message or notice)
text - text to send