org.relayirc.chatengine
Class Channel

java.lang.Object
  extended by org.relayirc.chatengine.Channel
All Implemented Interfaces:
java.io.Serializable, IChatObject

public class Channel
extends java.lang.Object
implements IChatObject, java.io.Serializable

An IRC channel class that includes methods for joining, parting, kicking, banning, adding/removing channel listeners and property change support.

Version:
$Revision: 1.1.2.9 $

The contents of this file are subject to the Mozilla Public License Version 1.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.mozilla.org/MPL/

Original Code: Relay IRC Chat Engine
Initial Developer: David M. Johnson
Contributor(s): No contributors to this file
Copyright (C) 1997-2000 by David M. Johnson
All Rights Reserved.
See Also:
Serialized Form

Constructor Summary
Channel(java.lang.String name)
          Construct channel with name alone.
Channel(java.lang.String name, Server server)
          Construct channel with server.
Channel(java.lang.String name, java.lang.String topic, int ucount, Server server)
          Channel with name, topic, user count and a server.
 
Method Summary
 void activate()
          Request that this channel be activated, given-focus or brought-to-front.
 void addChannelListener(ChannelListener listener)
          Channel listener support.
 void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
          Property change support.
 void connect()
          Connect/join this channel, does nothing if channel has no server.
 void disconnect(java.lang.String message)
          Request channel disconnection by sending PART command with the message to server.
 boolean equals(java.lang.Object object)
           
 java.lang.String getDescription()
          Get object's description.
 int getMaxNumBufferedUnsentMessages()
           
 java.lang.String getName()
          Get name of channel (e.g.
 Server getServer()
          Get the channel's server, which may be null.
 java.lang.String getTopic()
          Get channel's topic.
 int getUserCount()
          Number of users currently on channel.
 boolean isConnected()
          True if channel is connected/joined.
 void removeChannelListener(ChannelListener listener)
          Channel listener support.
 void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
          Property change support.
 void sendAction(java.lang.String msg)
          Send an action to this channel.
 void sendBan(java.lang.String nick)
          Ban a user from this channel.
 void sendDeOp(java.lang.String nick)
          Take operator rights from a user.
 void sendJoin()
          Join this channel, requires a server.
 void sendKick(java.lang.String nick)
          Kick a user from the channel.
 void sendMessage(java.lang.String message)
          Send a one line or multiline message to this channel.
 void sendNames()
          Send a NAMES request to this channel.
 void sendNotice(java.lang.String msg)
          Send a NOTICE to this channel.
 void sendOp(java.lang.String nick)
          Give operator rights to a user.
 void sendPart(java.lang.String message)
          Part (leave) this channel.
 void sendPrivMsg(java.lang.String str)
          Send PRIVMSG to this channel.
 void setDescription(java.lang.String desc)
          Set object's description.
 void setMaxNumBufferedUnsentMessages(int newMaxNumBufferedUnsentMessages)
          Insert the method's description here.
 void setName(java.lang.String name)
          Set channel name, with property change support.
 void setServer(Server server)
          Set the server to be used by this channel.
 void setTopic(java.lang.String topic)
          Set channel topic, with property change support.
 void setUserCount(int count)
          Set channel user count, with property change support.
 java.lang.String toString()
          String representation is channel name.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Channel

public Channel(java.lang.String name)
Construct channel with name alone.


Channel

public Channel(java.lang.String name,
               Server server)
Construct channel with server.


Channel

public Channel(java.lang.String name,
               java.lang.String topic,
               int ucount,
               Server server)
Channel with name, topic, user count and a server.

Method Detail

equals

public boolean equals(java.lang.Object object)
Overrides:
equals in class java.lang.Object

addChannelListener

public void addChannelListener(ChannelListener listener)
Channel listener support.


removeChannelListener

public void removeChannelListener(ChannelListener listener)
Channel listener support.


addPropertyChangeListener

public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
Property change support.


removePropertyChangeListener

public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
Property change support.


isConnected

public boolean isConnected()
True if channel is connected/joined.


getServer

public Server getServer()
Get the channel's server, which may be null.


getMaxNumBufferedUnsentMessages

public int getMaxNumBufferedUnsentMessages()
Returns:
int

connect

public void connect()
Connect/join this channel, does nothing if channel has no server.


disconnect

public void disconnect(java.lang.String message)
Request channel disconnection by sending PART command with the message to server.

Parameters:
message - The PART message.

getName

public java.lang.String getName()
Get name of channel (e.g. #java or #raleigh


setServer

public void setServer(Server server)
Set the server to be used by this channel.


setName

public void setName(java.lang.String name)
Set channel name, with property change support. Property change event will include new and old values.


getTopic

public java.lang.String getTopic()
Get channel's topic.


getDescription

public java.lang.String getDescription()
Description copied from interface: IChatObject
Get object's description.

Specified by:
getDescription in interface IChatObject

setDescription

public void setDescription(java.lang.String desc)
Description copied from interface: IChatObject
Set object's description.

Specified by:
setDescription in interface IChatObject

setTopic

public void setTopic(java.lang.String topic)
Set channel topic, with property change support. Property change event will include new and old values.


getUserCount

public int getUserCount()
Number of users currently on channel.


setUserCount

public void setUserCount(int count)
Set channel user count, with property change support. Property change event will include new and old values as java.lang.Integer objects.


toString

public java.lang.String toString()
String representation is channel name.

Overrides:
toString in class java.lang.Object

activate

public void activate()
Request that this channel be activated, given-focus or brought-to-front.


sendNotice

public void sendNotice(java.lang.String msg)
Send a NOTICE to this channel.


sendAction

public void sendAction(java.lang.String msg)
Send an action to this channel.


sendBan

public void sendBan(java.lang.String nick)
Ban a user from this channel.


sendDeOp

public void sendDeOp(java.lang.String nick)
Take operator rights from a user.


sendJoin

public void sendJoin()
Join this channel, requires a server. Before you call this method, make sure you have set the server for this channel.


sendKick

public void sendKick(java.lang.String nick)
Kick a user from the channel.


sendNames

public void sendNames()
Send a NAMES request to this channel.


sendMessage

public void sendMessage(java.lang.String message)
Send a one line or multiline message to this channel. Every line to be sent must end in a newline character. Lines not ending in a newline character are buffered until a newline is received.


sendOp

public void sendOp(java.lang.String nick)
Give operator rights to a user.


sendPart

public void sendPart(java.lang.String message)
Part (leave) this channel.

Parameters:
message - The PART message.

sendPrivMsg

public void sendPrivMsg(java.lang.String str)
Send PRIVMSG to this channel.


setMaxNumBufferedUnsentMessages

public void setMaxNumBufferedUnsentMessages(int newMaxNumBufferedUnsentMessages)
Insert the method's description here. Creation date: (14/08/00 14:30:58)

Parameters:
newMaxNumBufferedUnsentMessages - i int 0 is don't buffer, -1 is umlimited size, n is number of lines buffered