|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.jackofalltrades.irc.IrcPrefix
Represents the prefix of an IRC command. Prefixes are used by the IRC
server to indicate whom sent the message. A prefix is in the format of
nickname[[!identName]@hostname]
(brackets indicate optional
data), or a hostname
.
According to RFC 2812, a nickname and hostname could possibly match in
format. However, ONLY hostnames may contain the period (".")
character. If the prefix fails a check for
nickname!identname@hostname
and nickname@hostname
,
then a check for periods is executed. If the period check fails, then a
domain name resolution is executed, and if this fails, the prefix is
considered a nickname.
Prefixes are cached internally, so once an IrcPrefix
is created,
it not be created again. This allows for equality checking using the "=="
operator, and also saves on domain name resolution checks.
Method Summary | |
java.lang.String |
getHostname()
Returns the hostname portion of the prefix. |
java.lang.String |
getIdentName()
Returns the username given by the user's ident server. |
static IrcPrefix |
getInstance(java.lang.String prefix)
Returns an IrcPrefix representing the passed in string. |
static IrcPrefix |
getInstance(java.lang.String nickname,
java.lang.String hostname)
Returns an nickname and hostname . |
static IrcPrefix |
getInstance(java.lang.String nickname,
java.lang.String identName,
java.lang.String hostname)
Returns an nickname , identName , and
hostname . |
java.lang.String |
getNickname()
Returns the nickname portion of the command prefix. |
boolean |
isServer()
Returns true if the prefix is a hostname, false otherwise. |
static void |
removeInstance(java.lang.String prefix)
Removes an IrcPrefix from the cache. |
java.lang.String |
toString()
Returns a representation of the current object. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Method Detail |
public java.lang.String getNickname()
null
if the prefix is a hostname.public java.lang.String getIdentName()
null
if the ident name
is not included in the prefix.public java.lang.String getHostname()
null
if the prefix is a nickname.public boolean isServer()
public java.lang.String toString()
nickname[[!identName]@hostname]
(the brackets indicate
a section is optional).
public static IrcPrefix getInstance(java.lang.String prefix)
IrcPrefix
representing the passed in string.
prefix
- either a single nickname, or full prefix.
IrcPrefix
object, if prefix is properly
formatter, or null, if the prefix is not valid.public static IrcPrefix getInstance(java.lang.String nickname, java.lang.String hostname)
nickname
and hostname
.
nickname
- an IRC nickname.hostname
- a hostname.
java.lang.IllegalArgumentException
- if nickname, or hostname, are
null, or blank.public static IrcPrefix getInstance(java.lang.String nickname, java.lang.String identName, java.lang.String hostname)
nickname
, identName
, and
hostname
.
nickname
- an IRC nickname.identName
- a name returned from an ident server.hostname
- a hostname.
java.lang.IllegalArgumentException
- if nickname, or hostname, are
null, or blank.public static void removeInstance(java.lang.String prefix)
IrcPrefix
from the cache.
prefix
- the prefix to remove.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |