summaryrefslogtreecommitdiffstats
path: root/src/org/jogamp/jabot/irc/LogBot.java
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2013-01-17 18:41:38 +0100
committerSven Gothel <[email protected]>2013-01-17 18:41:38 +0100
commit6a64f0358cc24cc9b6e344c99d7fa0c36ca86839 (patch)
treecfa2cbd6ea7c60fca538c45a5797ab9edfa50614 /src/org/jogamp/jabot/irc/LogBot.java
parenta1020970b8afa2dd0d97813280f44580f0372bf9 (diff)
LobBot: Customize 'showHostname' / CatOut: Don't show hostname
Diffstat (limited to 'src/org/jogamp/jabot/irc/LogBot.java')
-rw-r--r--src/org/jogamp/jabot/irc/LogBot.java26
1 files changed, 14 insertions, 12 deletions
diff --git a/src/org/jogamp/jabot/irc/LogBot.java b/src/org/jogamp/jabot/irc/LogBot.java
index 4afee5d..e334ae8 100644
--- a/src/org/jogamp/jabot/irc/LogBot.java
+++ b/src/org/jogamp/jabot/irc/LogBot.java
@@ -24,9 +24,6 @@ import org.jibble.pircbot.PircBot;
import org.jogamp.jabot.util.TimeTool;
public class LogBot extends PircBot {
-
- private static final Pattern urlPattern = Pattern.compile("(?i:\\b((http|https|ftp|irc)://[^\\s]+))");
-
public static final String GREEN = "irc-green";
public static final String BLACK = "irc-black";
public static final String BROWN = "irc-brown";
@@ -34,6 +31,12 @@ public class LogBot extends PircBot {
public static final String BRICK = "irc-brick";
public static final String RED = "irc-red";
+ private static final Pattern urlPattern = Pattern.compile("(?i:\\b((http|https|ftp|irc)://[^\\s]+))");
+ private static String ANONYMOUS = "anon";
+
+ private final boolean showHostname;
+ private String joinMessage;
+
private final Calendar calendar;
private final Object timeSync = new Object();
@@ -41,14 +44,13 @@ public class LogBot extends PircBot {
private final Object outSync = new Object();
private PrintStream out;
- private String joinMessage;
-
- public LogBot(String joinMessage, boolean xmlOut) {
- this(joinMessage, TimeTool.getNearZuluTimeZone(), Locale.getDefault(), System.out, xmlOut);
+ public LogBot(boolean showHostname, String joinMessage, boolean xmlOut) {
+ this(showHostname, joinMessage, TimeTool.getNearZuluTimeZone(), Locale.getDefault(), System.out, xmlOut);
}
- public LogBot(String joinMessage, TimeZone timeZone, Locale locale, PrintStream out, boolean xmlOut) {
- calendar = new GregorianCalendar(timeZone, locale);
+ public LogBot(boolean showHostname, String joinMessage, TimeZone timeZone, Locale locale, PrintStream out, boolean xmlOut) {
+ this.showHostname = showHostname;
+ this.calendar = new GregorianCalendar(timeZone, locale);
this.xmlOut = xmlOut;
this.out = out;
this.joinMessage = joinMessage;
@@ -129,7 +131,7 @@ public class LogBot extends PircBot {
}
public void onJoin(String channel, String sender, String login, String hostname) {
- append(GREEN, "* " + sender + " (" + login + "@" + hostname + ") has joined " + channel);
+ append(GREEN, "* " + sender + " (" + login + "@" + ( showHostname ? hostname : ANONYMOUS ) + ") has joined " + channel);
if (sender.equals(getNick())) {
sendNotice(channel, joinMessage);
}
@@ -160,7 +162,7 @@ public class LogBot extends PircBot {
}
public void onPart(String channel, String sender, String login, String hostname) {
- append(GREEN, "* " + sender + " (" + login + "@" + hostname + ") has left " + channel);
+ append(GREEN, "* " + sender + " (" + login + "@" + ( showHostname ? hostname : ANONYMOUS ) + ") has left " + channel);
}
public void onPing(String sourceNick, String sourceLogin, String sourceHostname, String target, String pingValue) {
@@ -172,7 +174,7 @@ public class LogBot extends PircBot {
}
public void onQuit(String sourceNick, String sourceLogin, String sourceHostname, String reason) {
- append(NAVY, "* " + sourceNick + " (" + sourceLogin + "@" + sourceHostname + ") Quit (" + reason + ")");
+ append(NAVY, "* " + sourceNick + " (" + sourceLogin + "@" + ( showHostname ? sourceHostname : ANONYMOUS ) + ") Quit (" + reason + ")");
}
public void onTime(String sourceNick, String sourceLogin, String sourceHostname, String target) {