Google

User (PircBot 1.0.3 - Paul's Java IRC Bot Framework)
PircBot Java IRC Bot

org.jibble.pircbot
Class User


java.lang.Object

  |

  +--org.jibble.pircbot.User

All Implemented Interfaces:
Comparable

public class User
extends Object
implements Comparable

This class is used to represent a user on an IRC server. Instances of this class are returned by the getUsers method in the PircBot class.

This class implements Comparable, so it is possible to sort lists of User objects into case-insensitive alphabetical order.

Since:
1.0.0
Version:
1.0.3 (Build time: Sat Jan 18 23:29:54 2003)
Author:
Paul James Mutton, http://www.jibble.org/

Constructor Summary
User(String prefix, String nick)
          Constructs a User object with a known prefix and nick.
 
Method Summary
 int compareTo(Object o)
          Returns the result of calling the compareTo method on lowercased nicks.
 boolean equals(Object o)
          Returns true if the nick represented by this User object is the same as the nick of the User object given as an argument.
 boolean equals(String nick)
          Returns true if the nick represented by this User object is the same as the argument.
 String getNick()
          Returns the nick of the user.
 String getPrefix()
          Returns the prefix of the user.
 int hashCode()
          Returns the hash code of this User object.
 boolean hasVoice()
          Returns whether or not the user represented by this object has voice.
 boolean isOp()
          Returns whether or not the user represented by this object is an operator.
 String toString()
          Returns the nick of the user complete with their prefix if they have one, e.g.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

User


public User(String prefix,
            String nick)
Constructs a User object with a known prefix and nick.

Parameters:
prefix - The status of the user, for example, "@".
nick - The nick of the user.
Method Detail

getPrefix


public String getPrefix()
Returns the prefix of the user. If the User object has been obtained from a list of users in a channel, then this will reflect the user's status in that channel.

Returns:
The prefix of the user. If there is no prefix, then an empty String is returned.

isOp


public boolean isOp()
Returns whether or not the user represented by this object is an operator. If the User object has been obtained from a list of users in a channel, then this will reflect the user's operator status in that channel.

Returns:
true if the user is an operator in the channel.

hasVoice


public boolean hasVoice()
Returns whether or not the user represented by this object has voice. If the User object has been obtained from a list of users in a channel, then this will reflect the user's voice status in that channel.

Returns:
true if the user has voice in the channel.

getNick


public String getNick()
Returns the nick of the user.

Returns:
The user's nick.

toString


public String toString()
Returns the nick of the user complete with their prefix if they have one, e.g. "@Dave".

Overrides:
toString in class Object
Returns:
The user's prefix and nick.

equals


public boolean equals(String nick)
Returns true if the nick represented by this User object is the same as the argument. A case insensitive comparison is made.

Returns:
true if the nicks are identical (case insensitive).

equals


public boolean equals(Object o)
Returns true if the nick represented by this User object is the same as the nick of the User object given as an argument. A case insensitive comparison is made.

Overrides:
equals in class Object
Returns:
true if o is a User object with a matching lowercase nick.

hashCode


public int hashCode()
Returns the hash code of this User object.

Overrides:
hashCode in class Object
Returns:
the hash code of the User object.

compareTo


public int compareTo(Object o)
Returns the result of calling the compareTo method on lowercased nicks. This is useful for sorting lists of User objects.

Specified by:
compareTo in interface Comparable
Returns:
the result of calling compareTo on lowercased nicks.

PircBot Java IRC Bot