irc
Class Channel

java.lang.Object
  |
  +--irc.IRCObject
        |
        +--irc.Source
              |
              +--irc.IRCSource
                    |
                    +--irc.Channel
All Implemented Interfaces:
ReplyServerListener

public class Channel
extends IRCSource
implements ReplyServerListener

A channel source.


Field Summary
 
Fields inherited from class irc.Source
_in, _server
 
Fields inherited from class irc.IRCObject
_ircConfiguration
 
Constructor Summary
Channel(IRCConfiguration config, java.lang.String name, IRCServer s)
          Create a new Channel.
 
Method Summary
 void addChannelListener(ChannelListener lis)
          Add a channel listener.
 void applyMode(java.lang.String mode, java.lang.String from)
          Notify this channel its mode has changed.
 void applyUserMode(java.lang.String nick, java.lang.String mode, java.lang.String from)
          Notify this channel a nick mode has changed.
 void changeNick(java.lang.String oldNick, java.lang.String newNick)
          Notify this channel a nick has been renamed.
 java.lang.String getMode()
          Get this channel mode.
 java.lang.String getName()
          Get this source name.
 java.lang.String getNickMode(java.lang.String nick)
          Get the nick mode associated with the given nick.
 java.lang.String[] getNicks()
          Get all the nicks in this channel.
 java.lang.String getTopic()
          Get this channel topic.
 java.lang.String getType()
          Get this source type.
 boolean hasNick(java.lang.String nick)
          Test wether this channel has the given nickname.
 void joinNick(java.lang.String nick, java.lang.String mode)
          Notify this channel the given nick has joined, with the given options.
 void kickNick(java.lang.String nick, java.lang.String by, java.lang.String reason)
          Notify this channel the given nick has been kicked.
 void leave()
          Request to leave (close) this source.
 void partNick(java.lang.String nick, java.lang.String reason)
          Notify this channel the given nick has left the channel.
 void quitNick(java.lang.String nick, java.lang.String reason)
          Notify this channel the given nick has quit.
 void release()
          Release this object.
 void removeChannelListener(ChannelListener lis)
          Remove a channel listener.
 void replyReceived(java.lang.String prefix, java.lang.String id, java.lang.String[] params)
          A new numeric reply has been received from the irc server.
 void setNicks(java.lang.String[] nicks, java.lang.String[] modes)
          Notify this channel it should change its hole nick list.
 void setTopic(java.lang.String topic, java.lang.String by)
          Notify this channel its topic has changed.
 boolean talkable()
          Test wether this source can accept messages from user.
 java.lang.String whois(java.lang.String nick)
          Get bufferised whois data for the given nick.
 
Methods inherited from class irc.IRCSource
getIRCServer
 
Methods inherited from class irc.Source
action, activate, addSourceListener, clear, getInterpretor, getServer, isActive, mayDefault, messageReceived, noticeReceived, removeSourceListener, report, sendString, setCTCPFilter, setInterpretor
 
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

Channel

public Channel(IRCConfiguration config,
               java.lang.String name,
               IRCServer s)
Create a new Channel.

Parameters:
config - the global configuration.
name - channel name.
s - the source server.
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 Source

addChannelListener

public void addChannelListener(ChannelListener lis)
Add a channel listener.

Parameters:
lis - listener to add.

removeChannelListener

public void removeChannelListener(ChannelListener lis)
Remove a channel listener.

Parameters:
lis - listener to remove.

getType

public java.lang.String getType()
Description copied from class: Source
Get this source type.

Specified by:
getType in class Source
Returns:
source type.

getName

public java.lang.String getName()
Description copied from class: Source
Get this source name.

Specified by:
getName in class Source
Returns:
source name.

talkable

public boolean talkable()
Description copied from class: Source
Test wether this source can accept messages from user.

Specified by:
talkable in class Source
Returns:
true if this source accepts user input, false otherwise.

leave

public void leave()
Description copied from class: Source
Request to leave (close) this source.

Specified by:
leave in class Source

hasNick

public boolean hasNick(java.lang.String nick)
Test wether this channel has the given nickname.

Parameters:
nick - nickname to test.
Returns:
true if nick is present on this channel, false otherwise.

joinNick

public void joinNick(java.lang.String nick,
                     java.lang.String mode)
Notify this channel the given nick has joined, with the given options.

Parameters:
nick - new nick.
mode - nick mode.

setNicks

public void setNicks(java.lang.String[] nicks,
                     java.lang.String[] modes)
Notify this channel it should change its hole nick list.

Parameters:
nicks - new nicks.
modes - new modes. There is a one to one mapping between nicks and modes.

partNick

public void partNick(java.lang.String nick,
                     java.lang.String reason)
Notify this channel the given nick has left the channel.

Parameters:
nick - the nick.
reason - the reason.

kickNick

public void kickNick(java.lang.String nick,
                     java.lang.String by,
                     java.lang.String reason)
Notify this channel the given nick has been kicked.

Parameters:
nick - the kicked nick.
by - the nick who kicked nick.
reason - the kick reason.

quitNick

public void quitNick(java.lang.String nick,
                     java.lang.String reason)
Notify this channel the given nick has quit.

Parameters:
nick - the nick who quit.
reason - reason.

getNicks

public java.lang.String[] getNicks()
Get all the nicks in this channel.

Returns:
array of all nick names.

getNickMode

public java.lang.String getNickMode(java.lang.String nick)
Get the nick mode associated with the given nick.

Parameters:
nick - nickname to get mode.
Returns:
nick mode or null if nick not found.

setTopic

public void setTopic(java.lang.String topic,
                     java.lang.String by)
Notify this channel its topic has changed.

Parameters:
topic - new topic.
by - nickname who changed topic.

applyUserMode

public void applyUserMode(java.lang.String nick,
                          java.lang.String mode,
                          java.lang.String from)
Notify this channel a nick mode has changed.

Parameters:
nick - the nick.
mode - the applied mode.
from - the nick who changed mode.

applyMode

public void applyMode(java.lang.String mode,
                      java.lang.String from)
Notify this channel its mode has changed.

Parameters:
mode - applied mode.
from - user who changed mode.

getMode

public java.lang.String getMode()
Get this channel mode.

Returns:
channel mode.

getTopic

public java.lang.String getTopic()
Get this channel topic.

Returns:
channel topic.

changeNick

public void changeNick(java.lang.String oldNick,
                       java.lang.String newNick)
Notify this channel a nick has been renamed.

Parameters:
oldNick - old nickname.
newNick - new nickname.

whois

public java.lang.String whois(java.lang.String nick)
Get bufferised whois data for the given nick.

Parameters:
nick - nickname.
Returns:
whois data for nick, or "" if not found.

replyReceived

public void replyReceived(java.lang.String prefix,
                          java.lang.String id,
                          java.lang.String[] params)
Description copied from interface: ReplyServerListener
A new numeric reply has been received from the irc server.

Specified by:
replyReceived in interface ReplyServerListener
Parameters:
prefix - reply prefix.
id - reply id.
params - reply parameters.