zombie.chat
Class IRCClient.Listener

java.lang.Object
  extended by zombie.chat.IRCClient.Listener
All Implemented Interfaces:
java.util.EventListener, org.schwering.irc.lib.IRCConstants, org.schwering.irc.lib.IRCEventListener
Enclosing class:
IRCClient

public class IRCClient.Listener
extends java.lang.Object
implements org.schwering.irc.lib.IRCEventListener

Treats IRC events. The most of them are just printed.


Field Summary
 
Fields inherited from interface org.schwering.irc.lib.IRCConstants
ACTION_INDICATOR, BOLD_INDICATOR, COLOR_END_INDICATOR, COLOR_INDICATOR, COLOR_REVERSE_INDICATOR, ERR_ALREADYREGISTRED, ERR_BADCHANMASK, ERR_BADCHANNELKEY, ERR_BANNEDFROMCHAN, ERR_CANNOTSENDTOCHAN, ERR_CANTKILLSERVER, ERR_CHANNELISFULL, ERR_CHANOPRIVSNEEDED, ERR_ERRONEUSNICKNAME, ERR_FILEERROR, ERR_INVITEONLYCHAN, ERR_KEYSET, ERR_NEEDMOREPARAMS, ERR_NICKCOLLISION, ERR_NICKNAMEINUSE, ERR_NOADMININFO, ERR_NOLOGIN, ERR_NOMOTD, ERR_NONICKNAMEGIVEN, ERR_NOOPERHOST, ERR_NOORIGIN, ERR_NOPERMFORHOST, ERR_NOPRIVILEGES, ERR_NORECIPIENT, ERR_NOSERVICEHOST, ERR_NOSUCHCHANNEL, ERR_NOSUCHNICK, ERR_NOSUCHSERVER, ERR_NOTEXTTOSEND, ERR_NOTONCHANNEL, ERR_NOTOPLEVEL, ERR_NOTREGISTERED, ERR_PASSWDMISMATCH, ERR_SUMMONDISABLED, ERR_TOOMANYCHANNELS, ERR_TOOMANYTARGETS, ERR_UMODEUNKNOWNFLAG, ERR_UNKNOWNCOMMAND, ERR_UNKNOWNMODE, ERR_USERNOTINCHANNEL, ERR_USERONCHANNEL, ERR_USERSDISABLED, ERR_USERSDONTMATCH, ERR_WASNOSUCHNICK, ERR_WILDTOPLEVEL, ERR_YOUREBANNEDCREEP, ERR_YOUWILLBEBANNED, RPL_ADMINEMAIL, RPL_ADMINLOC1, RPL_ADMINLOC2, RPL_ADMINME, RPL_AUTHNAME, RPL_AWAY, RPL_BANLIST, RPL_CHANNELMODEIS, RPL_CLOSEEND, RPL_CLOSING, RPL_CREATED, RPL_ENDOFBANLIST, RPL_ENDOFINFO, RPL_ENDOFLINKS, RPL_ENDOFMOTD, RPL_ENDOFNAMES, RPL_ENDOFSERVICES, RPL_ENDOFSTATS, RPL_ENDOFUSERS, RPL_ENDOFWHO, RPL_ENDOFWHOIS, RPL_ENDOFWHOWAS, RPL_INFO, RPL_INFOSTART, RPL_INVITING, RPL_ISON, RPL_ISUPPORT, RPL_KILLDONE, RPL_LINKS, RPL_LIST, RPL_LISTEND, RPL_LISTSTART, RPL_LUSERCHANNELS, RPL_LUSERCLIENT, RPL_LUSERME, RPL_LUSEROP, RPL_LUSERUNKNOWN, RPL_MOTD, RPL_MOTDSTART, RPL_MYINFO, RPL_MYPORTIS, RPL_NAMREPLY, RPL_NONE, RPL_NOTOPIC, RPL_NOUSERS, RPL_NOWAWAY, RPL_REHASHING, RPL_SERVICE, RPL_SERVICEINFO, RPL_SERVLIST, RPL_SERVLISTEND, RPL_STATSCLINE, RPL_STATSCOMMANDS, RPL_STATSHLINE, RPL_STATSILINE, RPL_STATSKLINE, RPL_STATSLINKINFO, RPL_STATSLLINE, RPL_STATSNLINE, RPL_STATSOLINE, RPL_STATSQLINE, RPL_STATSUPTIME, RPL_STATSYLINE, RPL_SUMMONING, RPL_TIME, RPL_TOPIC, RPL_TOPICINFO, RPL_TRACECLASS, RPL_TRACECONNECTING, RPL_TRACEHANDSHAKE, RPL_TRACELINK, RPL_TRACELOG, RPL_TRACENEWTYPE, RPL_TRACEOPERATOR, RPL_TRACESERVER, RPL_TRACEUNKNOWN, RPL_TRACEUSER, RPL_UMODEIS, RPL_UNAWAY, RPL_USERHOST, RPL_USERS, RPL_USERSSTART, RPL_VERSION, RPL_WELCOME, RPL_WHOISCHANNELS, RPL_WHOISCHANOP, RPL_WHOISIDLE, RPL_WHOISOPERATOR, RPL_WHOISSERVER, RPL_WHOISUSER, RPL_WHOREPLY, RPL_WHOWASUSER, RPL_YOUREOPER, RPL_YOURHOST, UNDERLINE_INDICATOR
 
Constructor Summary
IRCClient.Listener()
           
 
Method Summary
 void onDisconnected()
          Fired when the own connection is broken.
 void onError(int num, java.lang.String msg)
          Fired when a numeric error is received.
 void onError(java.lang.String msg)
          Fired when an ERROR command is received.
 void onInvite(java.lang.String chan, org.schwering.irc.lib.IRCUser u, java.lang.String nickPass)
          Fired when somebody is invited to a channel.
 void onJoin(java.lang.String chan, org.schwering.irc.lib.IRCUser u)
          Fired when somebody joins a channel.
 void onKick(java.lang.String chan, org.schwering.irc.lib.IRCUser u, java.lang.String nickPass, java.lang.String msg)
          Fired when somebody is kicked from a channel.
 void onMode(org.schwering.irc.lib.IRCUser u, java.lang.String nickPass, java.lang.String mode)
          Fired when somebody changes somebody's usermodes.
 void onMode(java.lang.String chan, org.schwering.irc.lib.IRCUser u, org.schwering.irc.lib.IRCModeParser mp)
          Fired when an operator changes the modes of a channel.
 void onNick(org.schwering.irc.lib.IRCUser u, java.lang.String nickNew)
          Fired when somebody changes his nickname successfully.
 void onNotice(java.lang.String target, org.schwering.irc.lib.IRCUser u, java.lang.String msg)
          Fired when somebody sends a NOTICE to a user or a group.
 void onPart(java.lang.String chan, org.schwering.irc.lib.IRCUser u, java.lang.String msg)
          Fired when somebody parts from a channel.
 void onPing(java.lang.String p)
          Fired when a PING comes in.
 void onPrivmsg(java.lang.String chan, org.schwering.irc.lib.IRCUser u, java.lang.String msg)
          Fired when a user sends a PRIVMSG to a user or to a group.
 void onQuit(org.schwering.irc.lib.IRCUser u, java.lang.String msg)
          Fired when somebody quits from the network.
 void onRegistered()
          Fired when the own connection is successfully established.
 void onReply(int num, java.lang.String value, java.lang.String msg)
          Fired when a numeric reply is received.
 void onTopic(java.lang.String chan, org.schwering.irc.lib.IRCUser u, java.lang.String topic)
          Fired when the topic is changed by operators.
 void unknown(java.lang.String a, java.lang.String b, java.lang.String c, java.lang.String d)
          This event is fired when the incoming line can not be identified as a known event.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IRCClient.Listener

public IRCClient.Listener()
Method Detail

onRegistered

public void onRegistered()
Description copied from interface: org.schwering.irc.lib.IRCEventListener
Fired when the own connection is successfully established. This is the case when the first PING? is received.
This happens between the connection is opened with a socket and the connection is registered: The client sends his information to the server (nickname, username). The server says hello to you by sending you some NOTICEs. And if your nickname is invalid or in use or anything else is wrong with your nickname, it asks you for a new one.

Specified by:
onRegistered in interface org.schwering.irc.lib.IRCEventListener

onDisconnected

public void onDisconnected()
Description copied from interface: org.schwering.irc.lib.IRCEventListener
Fired when the own connection is broken.

Specified by:
onDisconnected in interface org.schwering.irc.lib.IRCEventListener

onError

public void onError(java.lang.String msg)
Description copied from interface: org.schwering.irc.lib.IRCEventListener
Fired when an ERROR command is received.

Specified by:
onError in interface org.schwering.irc.lib.IRCEventListener
Parameters:
msg - The message of the error.

onError

public void onError(int num,
                    java.lang.String msg)
Description copied from interface: org.schwering.irc.lib.IRCEventListener
Fired when a numeric error is received. The server often sends numeric errors (wrong nickname etc.). The msg's format is different for every reply. All replies' formats are described in the IRCUtil.

Specified by:
onError in interface org.schwering.irc.lib.IRCEventListener
Parameters:
num - The identifier (usually a 3-digit number).
msg - The message of the error.

onInvite

public void onInvite(java.lang.String chan,
                     org.schwering.irc.lib.IRCUser u,
                     java.lang.String nickPass)
Description copied from interface: org.schwering.irc.lib.IRCEventListener
Fired when somebody is invited to a channel.

Specified by:
onInvite in interface org.schwering.irc.lib.IRCEventListener
Parameters:
chan - The channel the user is invited to.
u - The user who invites another. Contains nick, username and host.
nickPass - The nickname of the user who is invited by another user (passive).

onJoin

public void onJoin(java.lang.String chan,
                   org.schwering.irc.lib.IRCUser u)
Description copied from interface: org.schwering.irc.lib.IRCEventListener
Fired when somebody joins a channel.

Specified by:
onJoin in interface org.schwering.irc.lib.IRCEventListener
Parameters:
chan - The channel the person joins.
u - The user who joins. Contains nick, username and host.

onKick

public void onKick(java.lang.String chan,
                   org.schwering.irc.lib.IRCUser u,
                   java.lang.String nickPass,
                   java.lang.String msg)
Description copied from interface: org.schwering.irc.lib.IRCEventListener
Fired when somebody is kicked from a channel.

Specified by:
onKick in interface org.schwering.irc.lib.IRCEventListener
Parameters:
chan - The channel somebody is kicked from.
u - The user who kicks another user from a channel. Contains nick, username and host.
nickPass - The nickname of the user who is kicked from a channel (passive).
msg - The message the active user has set. This is "" if no message was set.

onMode

public void onMode(org.schwering.irc.lib.IRCUser u,
                   java.lang.String nickPass,
                   java.lang.String mode)
Description copied from interface: org.schwering.irc.lib.IRCEventListener
Fired when somebody changes somebody's usermodes. Note that this event is not fired when a channel-mode is set, for example when someone sets another user as operator or the mode moderated.

Specified by:
onMode in interface org.schwering.irc.lib.IRCEventListener
Parameters:
u - The user who changes the modes of another user or himself. Contains nick, username and host.
nickPass - The nickname of the person whose modes are changed by another user or himself.
mode - The changed modes which are set.

onMode

public void onMode(java.lang.String chan,
                   org.schwering.irc.lib.IRCUser u,
                   org.schwering.irc.lib.IRCModeParser mp)
Description copied from interface: org.schwering.irc.lib.IRCEventListener
Fired when an operator changes the modes of a channel. For example, he can set somebody as an operator, too, or take him the oper-status. Also keys, moderated and other channelmodes are fired here.

Specified by:
onMode in interface org.schwering.irc.lib.IRCEventListener
Parameters:
chan - The channel in which the modes are changed.
u - The user who changes the modes. Contains nick, username and host.
mp - The IRCModeParser object which contains the parsed information about the modes which are changed.

onNick

public void onNick(org.schwering.irc.lib.IRCUser u,
                   java.lang.String nickNew)
Description copied from interface: org.schwering.irc.lib.IRCEventListener
Fired when somebody changes his nickname successfully.

Specified by:
onNick in interface org.schwering.irc.lib.IRCEventListener
Parameters:
u - The user who changes his nickname. Contains nick, username and host.
nickNew - The new nickname of the user who changes his nickname.

onNotice

public void onNotice(java.lang.String target,
                     org.schwering.irc.lib.IRCUser u,
                     java.lang.String msg)
Description copied from interface: org.schwering.irc.lib.IRCEventListener
Fired when somebody sends a NOTICE to a user or a group.

Specified by:
onNotice in interface org.schwering.irc.lib.IRCEventListener
Parameters:
target - The channel or nickname the user sent a NOTICE to.
u - The user who notices another person or a group. Contains nick, username and host.
msg - The message.

onPart

public void onPart(java.lang.String chan,
                   org.schwering.irc.lib.IRCUser u,
                   java.lang.String msg)
Description copied from interface: org.schwering.irc.lib.IRCEventListener
Fired when somebody parts from a channel.

Specified by:
onPart in interface org.schwering.irc.lib.IRCEventListener
Parameters:
chan - The channel somebody parts from.
u - The user who parts from a channel. Contains nick, username and host.
msg - The part-message which is optionally. If it's empty, msg is "".

onPrivmsg

public void onPrivmsg(java.lang.String chan,
                      org.schwering.irc.lib.IRCUser u,
                      java.lang.String msg)
Description copied from interface: org.schwering.irc.lib.IRCEventListener
Fired when a user sends a PRIVMSG to a user or to a group.

Specified by:
onPrivmsg in interface org.schwering.irc.lib.IRCEventListener
Parameters:
chan - The channel or nickname the user sent a PRIVMSG to.
u - The user who sent the PRIVMSG. Contains nick, username and host.
msg - The message the user transmits.

onQuit

public void onQuit(org.schwering.irc.lib.IRCUser u,
                   java.lang.String msg)
Description copied from interface: org.schwering.irc.lib.IRCEventListener
Fired when somebody quits from the network.

Specified by:
onQuit in interface org.schwering.irc.lib.IRCEventListener
Parameters:
u - The user who quits. Contains nick, username and host.
msg - The optional message. "" if no message is set by the user.

onReply

public void onReply(int num,
                    java.lang.String value,
                    java.lang.String msg)
Description copied from interface: org.schwering.irc.lib.IRCEventListener
Fired when a numeric reply is received. For example, WHOIS queries are answered by the server with numeric replies. The msg's format is different for every reply. All replies' formats are described in the IRCUtil. The first word in the value is always your own nickname!

Specified by:
onReply in interface org.schwering.irc.lib.IRCEventListener
Parameters:
num - The numeric reply.
value - The first part of the message.
msg - The main part of the message.

onTopic

public void onTopic(java.lang.String chan,
                    org.schwering.irc.lib.IRCUser u,
                    java.lang.String topic)
Description copied from interface: org.schwering.irc.lib.IRCEventListener
Fired when the topic is changed by operators. Note that the topic is given as a numeric reply fired in onReply when you join a channel.

Specified by:
onTopic in interface org.schwering.irc.lib.IRCEventListener
Parameters:
chan - The channel where the topic is changed.
u - The user who changes the topic. Contains nick, username and host.
topic - The new topic.

onPing

public void onPing(java.lang.String p)
Description copied from interface: org.schwering.irc.lib.IRCEventListener
Fired when a PING comes in. The IRC server tests in different periods if the client is still there by sending PING <ping>. The client must response PONG <ping>.

Specified by:
onPing in interface org.schwering.irc.lib.IRCEventListener
Parameters:
p - The ping which is received from the server.

unknown

public void unknown(java.lang.String a,
                    java.lang.String b,
                    java.lang.String c,
                    java.lang.String d)
Description copied from interface: org.schwering.irc.lib.IRCEventListener
This event is fired when the incoming line can not be identified as a known event.

Specified by:
unknown in interface org.schwering.irc.lib.IRCEventListener
Parameters:
a - The prefix of the incoming line.
b - The command of the incoming line.
c - The part until the colon (:).
d - The part behind the colon (:).