From 4529bf562834b6929faa41813988934e7b8854f9 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Thu, 17 Jan 2013 03:33:31 +0100 Subject: Initial Commit --- .classpath | 7 +++ .project | 17 ++++++ LICENSE.txt | 11 ++++ build.xml | 51 ++++++++++++++++++ lib/pircbot-1.5.0-java.zip | Bin 0 -> 45683 bytes lib/pircbot-1.5.0.jar | Bin 0 -> 32258 bytes scripts/jogamp-log01.sh | 3 ++ src/org/jogamp/jabot/irc/CatOut.java | 92 ++++++++++++++++++++++++++++++++ src/org/jogamp/jabot/util/TimeTool.java | 55 +++++++++++++++++++ 9 files changed, 236 insertions(+) create mode 100644 .classpath create mode 100644 .project create mode 100644 LICENSE.txt create mode 100644 build.xml create mode 100644 lib/pircbot-1.5.0-java.zip create mode 100644 lib/pircbot-1.5.0.jar create mode 100755 scripts/jogamp-log01.sh create mode 100644 src/org/jogamp/jabot/irc/CatOut.java create mode 100644 src/org/jogamp/jabot/util/TimeTool.java diff --git a/.classpath b/.classpath new file mode 100644 index 0000000..7aea4af --- /dev/null +++ b/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/.project b/.project new file mode 100644 index 0000000..785ea16 --- /dev/null +++ b/.project @@ -0,0 +1,17 @@ + + + JABot + + + + + + org.eclipse.jdt.core.javabuilder + + + + + + org.eclipse.jdt.core.javanature + + diff --git a/LICENSE.txt b/LICENSE.txt new file mode 100644 index 0000000..cff016e --- /dev/null +++ b/LICENSE.txt @@ -0,0 +1,11 @@ +JABot + Copyright 2013 JogAmp Community. All rights reserved. + + Licence: This software product is licensed under the GNU General Public License (GPL) Version 3. + http://www.gnu.org/licenses/gpl.html + +Using following components: + + PircBot 1.5.0 + URL: http://www.jibble.org/pircbot.php + Licence: This software product is OSI Certified Open Source Software, available under the GNU General Public License (GPL). diff --git a/build.xml b/build.xml new file mode 100644 index 0000000..f21afdf --- /dev/null +++ b/build.xml @@ -0,0 +1,51 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/lib/pircbot-1.5.0-java.zip b/lib/pircbot-1.5.0-java.zip new file mode 100644 index 0000000..cdf89b9 Binary files /dev/null and b/lib/pircbot-1.5.0-java.zip differ diff --git a/lib/pircbot-1.5.0.jar b/lib/pircbot-1.5.0.jar new file mode 100644 index 0000000..dcc0a7e Binary files /dev/null and b/lib/pircbot-1.5.0.jar differ diff --git a/scripts/jogamp-log01.sh b/scripts/jogamp-log01.sh new file mode 100755 index 0000000..918b3b9 --- /dev/null +++ b/scripts/jogamp-log01.sh @@ -0,0 +1,3 @@ +#! /bin/sh + +java -cp build/jabot.jar org.jogamp.jabot.irc.CatOut -login jogamp -name CatOut -server irc.freenode.net -channel "#jogamp" diff --git a/src/org/jogamp/jabot/irc/CatOut.java b/src/org/jogamp/jabot/irc/CatOut.java new file mode 100644 index 0000000..af2f04d --- /dev/null +++ b/src/org/jogamp/jabot/irc/CatOut.java @@ -0,0 +1,92 @@ +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 0 ) { + int min_len = Integer.MAX_VALUE; + int min_idx = -1; + for(int i=0; i