package org.jogamp.jabot.irc; import java.util.Calendar; import java.util.GregorianCalendar; import java.util.Locale; import java.util.TimeZone; import org.jibble.pircbot.PircBot; import org.jogamp.jabot.util.TimeTool; public class CatOut extends PircBot { private final TimeZone timeZone; private final Locale locale; private final Calendar calendar; public CatOut() { this(TimeTool.getNearZuluTimeZone(), Locale.getDefault()); } public CatOut(TimeZone timeZone, Locale locale) { this.timeZone = timeZone; this.locale = locale; calendar = new GregorianCalendar(timeZone, locale); } public final TimeZone getTimeZone() { return timeZone; } public final Locale getLocale() { return locale; } /** Returns timestamp of internal Calendar: YYYYMMDD HH:MM:SS (TMZ) */ public final String getTimeStamp() { return TimeTool.getTimeStamp(calendar); } public final void setLoginAndName(String login, String nick) { super.setLogin(login); super.setName(nick); } /** Updates internal Calendar w/ current time */ public final void tick() { calendar.setTimeInMillis(System.currentTimeMillis()); } public void onMessage(String channel, String sender, String login, String hostname, String message) { tick(); System.out.println(getTimeStamp()+" <"+sender+"/"+login+">: "+message); } public static void main(String[] args) throws Exception { final String login, name, server, channel; final boolean verbose; { String _login=null, _name=null, _server=null, _channel=null; boolean _verbose=false; for(int i=0; i