public void respondToIrcEvent(IIrcEvent event) { log.info("Responding to event " + event); IIrcMessage command = event.getIRCMessage(); if (command.getCommand().equalsIgnoreCase("PING")) { consecutiveErrors = 0; log.info("Sending pong"); String self = hostname; if (command.getEscapedParams() != null && command.getEscapedParams().length() > 0) self = command.getEscapedParams(); enqueueCommand(irc.pong(self)); } else if (command.getCommand().equalsIgnoreCase("ERROR")) { consecutiveErrors++; if (consecutiveErrors > 1) { nextServer(); } reconnect("IRC Error!"); } else if (command.getCommand().equals("433")) { // nick collision log.info("Nick collision. Cycling nicks"); currentNick++; if (currentNick == nicks.size()) { currentNick = 0; } myNick = (String) nicks.get(currentNick); enqueueCommand(irc.nick(myNick)); log.info("(Re)Joining channels"); for (IChannel c : channels) { c.join(); } } else if (command.getCommand().equalsIgnoreCase("CTCP_VERSION")) { enqueueCommand(irc.ctcpVersion(command.getPrefixNick(), description, version, environment)); } else if (command.getCommand().equalsIgnoreCase("CTCP_PING")) { enqueueCommand(irc.ctcpPing(command.getPrefixNick(), command.getEscapedParams())); } else if (command.getCommand().equalsIgnoreCase("CTCP_TIME")) { String dateTime = df.format(new Date(System.currentTimeMillis())); enqueueCommand(irc.ctcpTime(command.getPrefixNick(), dateTime)); } }