f00f.net.irc.martyr.clientstate
Class Channel

java.lang.Object
  extended by f00f.net.irc.martyr.clientstate.Channel

public class Channel
extends java.lang.Object

Channel is simply a repository for information about a channel. Contains channel name, topic, who created the topic, when the topic was created, who is in the channel, mode, etc.

If a user of the framework wishes to use their own Member object (to trap events like setting/removing ops), then subclass Channel and add a method as follows.

 public Member makeMember( String member )
 {
     return MyMemberSubClass( member ) );
 }
 

Each of the methods in Channel that need to create a Member object (many are just temporary members, for the enhanced 'equals') calls makeMember instead of new Member(...). That is why this version of addMember is protected, so that a part of the framework won't do something silly like:

      ...
      channel.addMember( new Member( member ) );
      ...
 


Constructor Summary
Channel(java.lang.String chanName)
           
 
Method Summary
 void addMember(FullNick nick, Command why)
          Deprecated. Use addMember( FullNick, InCommand ) intead.
 void addMember(FullNick nick, InCommand why)
           
protected  void addMember(Member member)
           
 void addMember(java.lang.String member, Command why)
          Deprecated. Use addMember( String, InCommand ) instead.
 void addMember(java.lang.String member, InCommand why)
          Adds the member to the channel.
static boolean areEqual(java.lang.String one, java.lang.String two)
          Compares the two channel names for equality.
protected  Member findMember(Member member)
           
 Member findMember(java.lang.String nick)
          Finds the Member object associated with a specific nick.
 java.util.Date getCreationDate()
           
 java.util.Enumeration getMembers()
          Returns an enumeration of Member objects, in no particular order.
 java.util.Iterator getModes()
           
 java.lang.String getName()
           
 java.lang.String getTopic()
           
 java.lang.String getTopicAuthor()
           
 java.util.Date getTopicDate()
           
static boolean isChannel(java.lang.String str)
          Determines if the string represents a channel name or not.
protected  boolean isMemberInChannel(Member member)
          Determines if the member is in this channel.
 boolean isMemberInChannel(java.lang.String nick)
          Determines if the nick is in the channel.
protected  Member makeMember(java.lang.String nick)
          To use a customized Member class, override this.
 void removeMember(FullNick member, Command why)
          Deprecated. Use removeMember( FullNick, InCommand ) instead.
 void removeMember(FullNick nick, InCommand why)
          Simply a wrapper to allow FullNicks to be used.
protected  void removeMember(Member compareTo)
           
 void removeMember(java.lang.String member, Command why)
          Deprecated. Use removeMember( String, InCommand ) instead.
 void removeMember(java.lang.String member, InCommand why)
          Removes the user from the channel.
 void setCreationDate(java.util.Date date)
           
 void setMode(Mode mode)
          Informs the channel of a mode change.
 void setTopic(java.lang.String topic)
           
 void setTopicAuthor(java.lang.String author)
           
 void setTopicDate(java.util.Date date)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Channel

public Channel(java.lang.String chanName)
Method Detail

getName

public java.lang.String getName()

addMember

protected void addMember(Member member)

addMember

public void addMember(java.lang.String member,
                      Command why)
Deprecated. Use addMember( String, InCommand ) instead.

Adds the member to the channel.

Parameters:
member - Member to add to the channel
why - Command that caused the member to be added

addMember

public void addMember(java.lang.String member,
                      InCommand why)
Adds the member to the channel.

Parameters:
member - Nick to add to the channel
why - Command that caused the member to be added

addMember

public void addMember(FullNick nick,
                      Command why)
Deprecated. Use addMember( FullNick, InCommand ) intead.

Parameters:
nick - Nick to add to the channel
why - Command that caused the member to be added

addMember

public void addMember(FullNick nick,
                      InCommand why)
Parameters:
nick - Nick to add to the channel
why - Command that caused the member to be added Adds the member to the channel. Just calls nick.getNick().

removeMember

public void removeMember(java.lang.String member,
                         InCommand why)
Removes the user from the channel. Ignores leading @ or + symbols. This is the cononical version of removeMember.

Parameters:
member - Nick of the person leaving.
why - Command issed that caused this action.

removeMember

public void removeMember(java.lang.String member,
                         Command why)
Deprecated. Use removeMember( String, InCommand ) instead.

Parameters:
member - Nick to remove from channel
why - Command that caused removal

removeMember

public void removeMember(FullNick member,
                         Command why)
Deprecated. Use removeMember( FullNick, InCommand ) instead.

Parameters:
member - Member to remove from channel
why - Command that caused removal

removeMember

public void removeMember(FullNick nick,
                         InCommand why)
Simply a wrapper to allow FullNicks to be used. Calls the string version of removeMember with nick.getNick().

Parameters:
nick - Nick to remove from channel
why - Command that caused removal

removeMember

protected void removeMember(Member compareTo)

setMode

public void setMode(Mode mode)
Informs the channel of a mode change. A mode change might be for the channel (such as l, n, or t) or for a user on this channel (such as o).

Parameters:
mode - Mode to set on the channel

getModes

public java.util.Iterator getModes()

getMembers

public java.util.Enumeration getMembers()
Returns an enumeration of Member objects, in no particular order.

Returns:
List of members in the channel

isMemberInChannel

public boolean isMemberInChannel(java.lang.String nick)
Determines if the nick is in the channel. Nick can be in the form "@sork" or "+sork" or just "sork", for example.

Parameters:
nick - Nick of member to check
Returns:
True or false if the member is in this channel.

isMemberInChannel

protected boolean isMemberInChannel(Member member)
Determines if the member is in this channel.

Parameters:
member - Member to check
Returns:
True or false if the member is in this channel.

findMember

public Member findMember(java.lang.String nick)
Finds the Member object associated with a specific nick. Ignores prefixed + or @.

Parameters:
nick - Nick to check whether it's a member of the channel or not
Returns:
Member object for specified nick, if it exists (null if not)

findMember

protected Member findMember(Member member)

setTopic

public void setTopic(java.lang.String topic)

getTopic

public java.lang.String getTopic()

getTopicDate

public java.util.Date getTopicDate()

setTopicDate

public void setTopicDate(java.util.Date date)

getCreationDate

public java.util.Date getCreationDate()

setCreationDate

public void setCreationDate(java.util.Date date)

getTopicAuthor

public java.lang.String getTopicAuthor()

setTopicAuthor

public void setTopicAuthor(java.lang.String author)

makeMember

protected Member makeMember(java.lang.String nick)
To use a customized Member class, override this.

Parameters:
nick - Nickname to create a member object for
Returns:
Member object for nick

isChannel

public static boolean isChannel(java.lang.String str)
Determines if the string represents a channel name or not.

Parameters:
str - String to test if it's a channel or not
Returns:
True or false if a string looks like a channel

areEqual

public static boolean areEqual(java.lang.String one,
                               java.lang.String two)
Compares the two channel names for equality. Returns false if either are null.

Parameters:
one - Left side of comparison
two - Right side of comparison
Returns:
True or false whether two channels are equal, false of either are null/


Copyright © 2000-2007 Ben Damm, Daniel Henninger, et al.