Class User

java.lang.Object
  |
  +--User

public class User
extends java.lang.Object

The user class holds some information about a user in a channel.


Constructor Summary
User(int code, java.lang.String ip)
          Creates a new user.
User(java.lang.String name, java.lang.String realname, java.lang.String ip, java.lang.String host)
          Creates a new user.
 
Method Summary
static java.lang.String createIdent(java.lang.String ip)
          Creates an ident String from the given ip.
 boolean equals(java.lang.Object object)
          Used to compare this User with another object.
 int getCode()
          Used to get the unique id of the user.
 java.util.Date getDate()
          Used to get the date the user logged on.
 java.lang.String getHost()
          Used to get the host from which the user is connecting.
 java.lang.String getIdent()
          Used to get the ident String for this user.
 java.lang.String getIP()
          Used to get the ip from which the user is connecting.
 int getLag()
          Used to get the lag of the user (in seconds).
 java.lang.String getName()
          Used to get the nickname of the user.
 java.lang.String getRealName()
          Used to get the real name of the user.
 int hashCode()
          Used internally when searching for User objects.
 void setLag(int lag)
          Used to set the lag of user (in seconds).
 void setName(java.lang.String nick)
          Used to set the nickname of the user.
 java.lang.String toString()
          Used to get a String representation of this User object.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

User

public User(java.lang.String name,
            java.lang.String realname,
            java.lang.String ip,
            java.lang.String host)
Creates a new user. This constructor uses all the information about a user.
Parameters:
name - The nickname of the user.
realname - The real name of the user.
ip - The ip the user is connecting from.
host - The host the user is connecting from.

User

public User(int code,
            java.lang.String ip)
Creates a new user. This constructor uses only the information used when comparing two users.
Parameters:
code - The unique user identification code.
ip - The ip the user is connecting from.
Method Detail

createIdent

public static java.lang.String createIdent(java.lang.String ip)
Creates an ident String from the given ip.
Parameters:
ip - The ip address of the user (eg, 123.123.42.17).
Returns:
The ident String (eg, 7b7b2a11)

hashCode

public int hashCode()
Used internally when searching for User objects.
Overrides:
hashCode in class java.lang.Object
Returns:
The hash code for this User object.

getCode

public int getCode()
Used to get the unique id of the user.
Returns:
The unique id of the user.

getName

public java.lang.String getName()
Used to get the nickname of the user.
Returns:
The nickname of the user.

setName

public void setName(java.lang.String nick)
Used to set the nickname of the user.
Parameters:
nick - The nickname of the user.

getHost

public java.lang.String getHost()
Used to get the host from which the user is connecting.
Returns:
The host the user is connecting from.

getIP

public java.lang.String getIP()
Used to get the ip from which the user is connecting.
Returns:
The ip the user is connecting from.

getRealName

public java.lang.String getRealName()
Used to get the real name of the user. An empty String is allowed for the real name.
Returns:
The real name of the user.

getDate

public java.util.Date getDate()
Used to get the date the user logged on.
Returns:
The date the user logged on.

getIdent

public java.lang.String getIdent()
Used to get the ident String for this user. The ident is the ip in hexadecimal form.
Returns:
The ip in hexadecimal form (8 chars).

getLag

public int getLag()
Used to get the lag of the user (in seconds).
Returns:
The number of seconds the user is lagged.

setLag

public void setLag(int lag)
Used to set the lag of user (in seconds).
Parameters:
lag - The number of seconds the user is lagged.

toString

public java.lang.String toString()
Used to get a String representation of this User object.
Overrides:
toString in class java.lang.Object
Returns:
A String representation of this User object.

equals

public boolean equals(java.lang.Object object)
Used to compare this User with another object.
Overrides:
equals in class java.lang.Object
Parameters:
object - If the passed object is another User they are considered to be the same user if they have the same code and connect from the same host.
Returns:
true or false.