jirc
Class JIRC

java.lang.Object
  extended by java.lang.Thread
      extended by jirc.JIRC
All Implemented Interfaces:
java.lang.Runnable

public abstract class JIRC
extends java.lang.Thread

JIRC is a easy way to implement irc functionality in your programs. Create an implementation, then use JIRC.start() to start the irc connection

Author:
ricky

Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
protected  java.io.BufferedReader sin
          A variable holding System.in
protected  java.io.PrintStream sout
          A variable holding System.out
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
JIRC(java.lang.String IRCServerName, java.lang.String IRCNickName, java.lang.String IRCRealName)
           
 
Method Summary
 void changeNick(java.lang.String nick)
          Changes the current nickname of the connection
 void deOpChannelMember(java.lang.String channel, java.lang.String name)
          Removes operator status on the given channel member, assuming you have operator status
 Channel[] getChannelArray()
          Gets an array version of the List of Channel objects used by JIRC
 java.util.List<Channel> getChannelList()
          Gets the List of Channel objects used by JIRC
 java.lang.String getNick()
          Gets the current nickname of the connection
static int inChannelArray(Channel[] arr, java.lang.String match)
           
static int inChannelList(java.util.List<Channel> list, java.lang.String match)
           
 void joinChannel(java.lang.String channel)
          Joins the specified channel, allowing you to send and receive messages from it
Note: channels are passed around sans-pound, so you would pass the channel "test", not the channel "#test"
protected abstract  void onChannelMemberJoin(java.lang.String channel, java.lang.String nick)
           
protected abstract  void onChannelMemberPart(java.lang.String channel, java.lang.String nick)
           
protected abstract  void onChannelMemberQuit(java.lang.String nick, java.lang.String message)
           
protected abstract  void onChannelMessageReceive(java.lang.String channel, java.lang.String nick, java.lang.String message)
           
protected abstract  void onConnect()
           
protected abstract  void onPingged(java.lang.String server)
           
protected abstract  void onPrivateMessageReceive(java.lang.String nick, java.lang.String message)
           
protected abstract  void onServerMessage(java.lang.String message)
           
 void opChannelMember(java.lang.String channel, java.lang.String name)
          Sets operator status on the given channel member, assuming you have operator status
 void partChannel(java.lang.String channel)
          Parts the specified channel, meaning you can no longer get and receive messages from it
Note: channels are passed around sans-pound, so you would pass the channel "test", not the channel "#test"
 void run()
           
 void sendMessage(java.lang.String channel, java.lang.String msg)
          Sends a message to the specified channel
Note: channels are passed around sans-pound, so you would pass the channel "test", not the channel "#test"
 void sendPrivateMessage(java.lang.String person, java.lang.String msg)
          Sends a message to the specified person
 void sendRawMessage(java.lang.String message)
          Sends raw text to the server.
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

sout

protected java.io.PrintStream sout
A variable holding System.out


sin

protected java.io.BufferedReader sin
A variable holding System.in

Constructor Detail

JIRC

public JIRC(java.lang.String IRCServerName,
            java.lang.String IRCNickName,
            java.lang.String IRCRealName)
Parameters:
IRCServerName - Name of the server to connect to (eg efnet.xs4all.nl or 127.0.0.1)
IRCNickName - Nick name to connect to the server with
IRCRealName - "Real" name to show tho the server
Method Detail

onConnect

protected abstract void onConnect()

onPingged

protected abstract void onPingged(java.lang.String server)

onServerMessage

protected abstract void onServerMessage(java.lang.String message)

onChannelMessageReceive

protected abstract void onChannelMessageReceive(java.lang.String channel,
                                                java.lang.String nick,
                                                java.lang.String message)

onPrivateMessageReceive

protected abstract void onPrivateMessageReceive(java.lang.String nick,
                                                java.lang.String message)

onChannelMemberPart

protected abstract void onChannelMemberPart(java.lang.String channel,
                                            java.lang.String nick)

onChannelMemberJoin

protected abstract void onChannelMemberJoin(java.lang.String channel,
                                            java.lang.String nick)

onChannelMemberQuit

protected abstract void onChannelMemberQuit(java.lang.String nick,
                                            java.lang.String message)

run

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

sendMessage

public void sendMessage(java.lang.String channel,
                        java.lang.String msg)
Sends a message to the specified channel
Note: channels are passed around sans-pound, so you would pass the channel "test", not the channel "#test"

Parameters:
channel - The channel to send the message to
msg - The message to send

sendRawMessage

public void sendRawMessage(java.lang.String message)
Sends raw text to the server. Useful for sending things not yet implemented

Parameters:
message - the message to send (eg NICK newnick)

sendPrivateMessage

public void sendPrivateMessage(java.lang.String person,
                               java.lang.String msg)
Sends a message to the specified person

Parameters:
person - The person to send the message to
msg - The message to send

joinChannel

public void joinChannel(java.lang.String channel)
Joins the specified channel, allowing you to send and receive messages from it
Note: channels are passed around sans-pound, so you would pass the channel "test", not the channel "#test"

Parameters:
channel - The channel to join

partChannel

public void partChannel(java.lang.String channel)
Parts the specified channel, meaning you can no longer get and receive messages from it
Note: channels are passed around sans-pound, so you would pass the channel "test", not the channel "#test"

Parameters:
channel - The channel to join

changeNick

public void changeNick(java.lang.String nick)
Changes the current nickname of the connection

Parameters:
nick - What to change the nickname to

getNick

public java.lang.String getNick()
Gets the current nickname of the connection

Returns:
The current nickname

opChannelMember

public void opChannelMember(java.lang.String channel,
                            java.lang.String name)
Sets operator status on the given channel member, assuming you have operator status

Parameters:
channel - The channel to change the person is in
name - The name of the person to give operator status to

deOpChannelMember

public void deOpChannelMember(java.lang.String channel,
                              java.lang.String name)
Removes operator status on the given channel member, assuming you have operator status

Parameters:
channel - The channel to change the person is in
name - The name of the person to remove operator status from

getChannelArray

public Channel[] getChannelArray()
Gets an array version of the List of Channel objects used by JIRC

Returns:
The array of Channels

getChannelList

public java.util.List<Channel> getChannelList()
Gets the List of Channel objects used by JIRC

Returns:
The List of Channels

inChannelList

public static int inChannelList(java.util.List<Channel> list,
                                java.lang.String match)
Parameters:
list -
match -
Returns:

inChannelArray

public static int inChannelArray(Channel[] arr,
                                 java.lang.String match)
Parameters:
arr -
match -
Returns: