diff options
author | Sven Gothel <[email protected]> | 2013-01-19 21:24:22 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2013-01-19 21:24:22 +0100 |
commit | 821d52e3694fac0b907ec240e264f4d52d352966 (patch) | |
tree | ac79120fb5550e0e4e6bc7688cb3597b36096698 /src/org/jogamp/jabot/irc/LogBot.java | |
parent | 60ccfc5ff7dee58740ba1302626e3ccea35259b9 (diff) |
Allow 'joinMessage' to include actual log URL, notify @ each logrotate
- joinMessage configurable
- Add config: urlprefix (same as logprefix, but in URL space)
- Set bot's joinMessage: joinMessage + urlprefix + current logfile
- Notify new logfile via logged joinMessage in old and new logfile and channel itself
Diffstat (limited to 'src/org/jogamp/jabot/irc/LogBot.java')
-rw-r--r-- | src/org/jogamp/jabot/irc/LogBot.java | 32 |
1 files changed, 29 insertions, 3 deletions
diff --git a/src/org/jogamp/jabot/irc/LogBot.java b/src/org/jogamp/jabot/irc/LogBot.java index 9c085a2..a4d143f 100644 --- a/src/org/jogamp/jabot/irc/LogBot.java +++ b/src/org/jogamp/jabot/irc/LogBot.java @@ -31,7 +31,7 @@ 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 final Pattern urlPattern = Pattern.compile("(?i:\\b((http|https|ftp|irc|file)://[^\\s]+))");
private static String ANONYMOUS = "anon";
private final boolean showHostname;
@@ -58,6 +58,13 @@ public class LogBot extends PircBot { this.lineCount = 0;
}
+ public final void setJoinMessage(String joinMessage) {
+ this.joinMessage = joinMessage;
+ }
+ public final String getJoinMessage() {
+ return joinMessage;
+ }
+
public final void setLoginAndName(String login, String nick) {
super.setLogin(login);
super.setName(nick);
@@ -141,6 +148,26 @@ public class LogBot extends PircBot { }
+ /**
+ * Log a notice
+ *
+ * @param notice The notice to log.
+ */
+ public final void logNotice(String notice) {
+ append(BROWN, "-" + getNick() + "- " + notice);
+ }
+
+ /**
+ * Sends a logged notice to the channel or to a user.
+ *
+ * @param target The name of the channel or user nick to send to.
+ * @param notice The notice to send.
+ */
+ public final void sendLoggedNotice(String target, String notice) {
+ super.sendNotice(target, notice);
+ append(BROWN, "-" + getNick() + "- " + notice);
+ }
+
public void onAction(String sender, String login, String hostname, String target, String action) {
append(BRICK, "* " + sender + " " + action);
}
@@ -149,8 +176,7 @@ public class LogBot extends PircBot { append(GREEN, "* " + sender + " (" + login + "@" + ( showHostname ? hostname : ANONYMOUS ) + ") has joined " + channel);
if (sender.equals(getNick())) {
sendNotice(channel, joinMessage);
- }
- else {
+ } else {
sendNotice(sender, joinMessage);
}
}
|