changed Windows-corrupted line endings back to UNIX

This commit is contained in:
hypercubus
2004-08-15 07:17:13 +00:00
committed by zzz
parent e60b30ed44
commit 49573b9e72
4 changed files with 569 additions and 569 deletions

View File

@@ -1,348 +1,348 @@
/* /*
* bogobot - A simple join/part stats logger bot for I2P IRC. * bogobot - A simple join/part stats logger bot for I2P IRC.
* *
* Bogobot.java * Bogobot.java
* 2004 The I2P Project * 2004 The I2P Project
* This code is public domain. * This code is public domain.
*/ */
import java.io.File; import java.io.File;
import java.io.FileInputStream; import java.io.FileInputStream;
import java.io.IOException; import java.io.IOException;
import java.util.Timer; import java.util.Timer;
import java.util.TimerTask; import java.util.TimerTask;
import java.util.Properties; import java.util.Properties;
import org.apache.log4j.DailyRollingFileAppender; import org.apache.log4j.DailyRollingFileAppender;
import org.apache.log4j.Level; import org.apache.log4j.Level;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
import org.apache.log4j.PatternLayout; import org.apache.log4j.PatternLayout;
import org.jibble.pircbot.IrcException; import org.jibble.pircbot.IrcException;
import org.jibble.pircbot.NickAlreadyInUseException; import org.jibble.pircbot.NickAlreadyInUseException;
import org.jibble.pircbot.PircBot; import org.jibble.pircbot.PircBot;
import org.jibble.pircbot.User; import org.jibble.pircbot.User;
/** /**
* TODO 0.5 Add multi-server capability. * TODO 0.5 Add multi-server capability.
* *
* @author hypercubus, oOo * @author hypercubus, oOo
* @version 0.4 * @version 0.4
*/ */
public class Bogobot extends PircBot { public class Bogobot extends PircBot {
private static final String INTERVAL_DAILY = "daily"; private static final String INTERVAL_DAILY = "daily";
private static final String INTERVAL_MONTHLY = "monthly"; private static final String INTERVAL_MONTHLY = "monthly";
private static final String INTERVAL_WEEKLY = "weekly"; private static final String INTERVAL_WEEKLY = "weekly";
private boolean _isIntentionalDisconnect = false; private boolean _isIntentionalDisconnect = false;
private long _lastUserlistCommandTimestamp = 0; private long _lastUserlistCommandTimestamp = 0;
private Logger _logger = Logger.getLogger(Bogobot.class); private Logger _logger = Logger.getLogger(Bogobot.class);
private int _currentAutoRoundTripTag = 0; private int _currentAutoRoundTripTag = 0;
private long _lastAutoRoundTripSentTime = 0; private long _lastAutoRoundTripSentTime = 0;
private Timer _tickTimer; private Timer _tickTimer;
private String _configFile; private String _configFile;
private String _botPrimaryNick; private String _botPrimaryNick;
private String _botSecondaryNick; private String _botSecondaryNick;
private String _botNickservPassword; private String _botNickservPassword;
private String _botUsername; private String _botUsername;
private String _ownerPrimaryNick; private String _ownerPrimaryNick;
private String _ownerSecondaryNick; private String _ownerSecondaryNick;
private String _botShutdownPassword; private String _botShutdownPassword;
private String _ircChannel; private String _ircChannel;
private String _ircServer; private String _ircServer;
private int _ircServerPort; private int _ircServerPort;
private boolean _isLoggerEnabled; private boolean _isLoggerEnabled;
private String _loggedHostnamePattern; private String _loggedHostnamePattern;
private boolean _isUserlistCommandEnabled; private boolean _isUserlistCommandEnabled;
private String _logFilePrefix; private String _logFilePrefix;
private String _logFileRotationInterval; private String _logFileRotationInterval;
private long _commandAntiFloodInterval; private long _commandAntiFloodInterval;
private String _userlistCommandTrigger; private String _userlistCommandTrigger;
private boolean _isRoundTripDelayEnabled; private boolean _isRoundTripDelayEnabled;
private int _roundTripDelayPeriod; private int _roundTripDelayPeriod;
class BogobotTickTask extends TimerTask { class BogobotTickTask extends TimerTask {
private Bogobot _caller; private Bogobot _caller;
public BogobotTickTask(Bogobot caller) { public BogobotTickTask(Bogobot caller) {
_caller = caller; _caller = caller;
} }
public void run() { public void run() {
_caller.onTick(); _caller.onTick();
} }
} }
private void loadConfigFile(String configFileName) { private void loadConfigFile(String configFileName) {
_configFile = configFileName; _configFile = configFileName;
Properties config = new Properties(); Properties config = new Properties();
FileInputStream fis = null; FileInputStream fis = null;
try { try {
fis = new FileInputStream(configFileName); fis = new FileInputStream(configFileName);
config.load(fis); config.load(fis);
} catch (IOException ioe) { } catch (IOException ioe) {
System.err.println("Error loading configuration file"); System.err.println("Error loading configuration file");
System.exit(2); System.exit(2);
} finally { } finally {
if (fis != null) try { if (fis != null) try {
fis.close(); fis.close();
} catch (IOException ioe) { // nop } catch (IOException ioe) { // nop
} }
} }
_botPrimaryNick = config.getProperty("botPrimaryNick", "somebot"); _botPrimaryNick = config.getProperty("botPrimaryNick", "somebot");
_botSecondaryNick = config.getProperty("botSecondaryNick", "somebot_"); _botSecondaryNick = config.getProperty("botSecondaryNick", "somebot_");
_botNickservPassword = config.getProperty("botNickservPassword", ""); _botNickservPassword = config.getProperty("botNickservPassword", "");
_botUsername = config.getProperty("botUsername", "somebot"); _botUsername = config.getProperty("botUsername", "somebot");
_ownerPrimaryNick = config.getProperty("ownerPrimaryNick", "somenick"); _ownerPrimaryNick = config.getProperty("ownerPrimaryNick", "somenick");
_ownerSecondaryNick = config.getProperty("ownerSecondaryNick", "somenick_"); _ownerSecondaryNick = config.getProperty("ownerSecondaryNick", "somenick_");
_botShutdownPassword = config.getProperty("botShutdownPassword", "take off eh"); _botShutdownPassword = config.getProperty("botShutdownPassword", "take off eh");
_ircChannel = config.getProperty("ircChannel", "#i2p-chat"); _ircChannel = config.getProperty("ircChannel", "#i2p-chat");
_ircServer = config.getProperty("ircServer", "irc.duck.i2p"); _ircServer = config.getProperty("ircServer", "irc.duck.i2p");
_ircServerPort = Integer.parseInt(config.getProperty("ircServerPort", "6668")); _ircServerPort = Integer.parseInt(config.getProperty("ircServerPort", "6668"));
_isLoggerEnabled = Boolean.valueOf(config.getProperty("isLoggerEnabled", "true")).booleanValue(); _isLoggerEnabled = Boolean.valueOf(config.getProperty("isLoggerEnabled", "true")).booleanValue();
_loggedHostnamePattern = config.getProperty("loggedHostnamePattern", ""); _loggedHostnamePattern = config.getProperty("loggedHostnamePattern", "");
_logFilePrefix = config.getProperty("logFilePrefix", "irc.duck.i2p.i2p-chat"); _logFilePrefix = config.getProperty("logFilePrefix", "irc.duck.i2p.i2p-chat");
_logFileRotationInterval = config.getProperty("logFileRotationInterval", INTERVAL_DAILY); _logFileRotationInterval = config.getProperty("logFileRotationInterval", INTERVAL_DAILY);
_isRoundTripDelayEnabled = Boolean.valueOf(config.getProperty("isRoundTripDelayEnabled", "false")).booleanValue(); _isRoundTripDelayEnabled = Boolean.valueOf(config.getProperty("isRoundTripDelayEnabled", "false")).booleanValue();
_roundTripDelayPeriod = Integer.parseInt(config.getProperty("roundTripDelayPeriod", "300")); _roundTripDelayPeriod = Integer.parseInt(config.getProperty("roundTripDelayPeriod", "300"));
_isUserlistCommandEnabled = Boolean.valueOf(config.getProperty("isUserlistCommandEnabled", "true")).booleanValue(); _isUserlistCommandEnabled = Boolean.valueOf(config.getProperty("isUserlistCommandEnabled", "true")).booleanValue();
_userlistCommandTrigger = config.getProperty("userlistCommandTrigger", "!who"); _userlistCommandTrigger = config.getProperty("userlistCommandTrigger", "!who");
_commandAntiFloodInterval = Long.parseLong(config.getProperty("commandAntiFloodInterval", "60")); _commandAntiFloodInterval = Long.parseLong(config.getProperty("commandAntiFloodInterval", "60"));
} }
public Bogobot(String configFileName) { public Bogobot(String configFileName) {
loadConfigFile(configFileName); loadConfigFile(configFileName);
this.setName(_botPrimaryNick); this.setName(_botPrimaryNick);
this.setLogin(_botUsername); this.setLogin(_botUsername);
_tickTimer = new Timer(); _tickTimer = new Timer();
_tickTimer.scheduleAtFixedRate(new BogobotTickTask(this), 1000, 10 * 1000); _tickTimer.scheduleAtFixedRate(new BogobotTickTask(this), 1000, 10 * 1000);
} }
public static void main(String[] args) { public static void main(String[] args) {
Bogobot bogobot; Bogobot bogobot;
if (args.length > 1) { if (args.length > 1) {
System.err.println("Too many arguments, the only allowed parameter is configuration file name"); System.err.println("Too many arguments, the only allowed parameter is configuration file name");
System.exit(3); System.exit(3);
} }
if (args.length == 1) { if (args.length == 1) {
bogobot = new Bogobot(args[0]); bogobot = new Bogobot(args[0]);
} else { } else {
bogobot = new Bogobot("bogobot.config"); bogobot = new Bogobot("bogobot.config");
} }
bogobot.setVerbose(true); bogobot.setVerbose(true);
if (bogobot._isLoggerEnabled) if (bogobot._isLoggerEnabled)
bogobot.initLogger(); bogobot.initLogger();
bogobot.connectToServer(); bogobot.connectToServer();
} }
protected void onTick() { protected void onTick() {
// Tick about once every ten seconds // Tick about once every ten seconds
if (this.isConnected() && _isRoundTripDelayEnabled) { if (this.isConnected() && _isRoundTripDelayEnabled) {
if( ( (System.currentTimeMillis() - _lastAutoRoundTripSentTime) >= (_roundTripDelayPeriod * 1000) ) && (this.getOutgoingQueueSize() == 0) ) { if( ( (System.currentTimeMillis() - _lastAutoRoundTripSentTime) >= (_roundTripDelayPeriod * 1000) ) && (this.getOutgoingQueueSize() == 0) ) {
// Connected, sending queue is empty and last RoundTrip is more then 5 minutes old -> Send a new one // Connected, sending queue is empty and last RoundTrip is more then 5 minutes old -> Send a new one
_currentAutoRoundTripTag ++; _currentAutoRoundTripTag ++;
_lastAutoRoundTripSentTime = System.currentTimeMillis(); _lastAutoRoundTripSentTime = System.currentTimeMillis();
sendNotice(this.getNick(),"ROUNDTRIP " + _currentAutoRoundTripTag); sendNotice(this.getNick(),"ROUNDTRIP " + _currentAutoRoundTripTag);
} }
} }
} }
protected void onDisconnect() { protected void onDisconnect() {
if (_isIntentionalDisconnect) if (_isIntentionalDisconnect)
System.exit(0); System.exit(0);
if (_isLoggerEnabled) if (_isLoggerEnabled)
_logger.info(System.currentTimeMillis() + " quits *** " + this.getName() + " *** (Lost connection)"); _logger.info(System.currentTimeMillis() + " quits *** " + this.getName() + " *** (Lost connection)");
try { try {
Thread.sleep(60000); Thread.sleep(60000);
} catch (InterruptedException e) { } catch (InterruptedException e) {
// No worries. // No worries.
} }
connectToServer(); connectToServer();
} }
protected void onJoin(String channel, String sender, String login, String hostname) { protected void onJoin(String channel, String sender, String login, String hostname) {
if (_isLoggerEnabled) { if (_isLoggerEnabled) {
if (sender.equals(this.getName())) { if (sender.equals(this.getName())) {
_logger.info(System.currentTimeMillis() + " joins *** " + _botPrimaryNick + " ***"); _logger.info(System.currentTimeMillis() + " joins *** " + _botPrimaryNick + " ***");
} else { } else {
String prependedHostname = "@" + hostname; String prependedHostname = "@" + hostname;
if (prependedHostname.endsWith(_loggedHostnamePattern)) { if (prependedHostname.endsWith(_loggedHostnamePattern)) {
_logger.info(System.currentTimeMillis() + " joins " + sender); _logger.info(System.currentTimeMillis() + " joins " + sender);
} }
} }
} }
} }
protected void onMessage(String channel, String sender, String login, String hostname, String message) { protected void onMessage(String channel, String sender, String login, String hostname, String message) {
message = message.replaceFirst("<.+?> ", ""); message = message.replaceFirst("<.+?> ", "");
if (_isUserlistCommandEnabled && message.equals(_userlistCommandTrigger)) { if (_isUserlistCommandEnabled && message.equals(_userlistCommandTrigger)) {
if (System.currentTimeMillis() - _lastUserlistCommandTimestamp < _commandAntiFloodInterval * 1000) if (System.currentTimeMillis() - _lastUserlistCommandTimestamp < _commandAntiFloodInterval * 1000)
return; return;
Object[] users = getUsers(_ircChannel); Object[] users = getUsers(_ircChannel);
String output = "Userlist for " + _ircChannel + ": "; String output = "Userlist for " + _ircChannel + ": ";
for (int i = 0; i < users.length; i++) for (int i = 0; i < users.length; i++)
output += "[" + ((User) users[i]).getNick() + "] "; output += "[" + ((User) users[i]).getNick() + "] ";
sendMessage(_ircChannel, output); sendMessage(_ircChannel, output);
_lastUserlistCommandTimestamp = System.currentTimeMillis(); _lastUserlistCommandTimestamp = System.currentTimeMillis();
} }
} }
protected void onPart(String channel, String sender, String login, String hostname) { protected void onPart(String channel, String sender, String login, String hostname) {
if (_isLoggerEnabled) { if (_isLoggerEnabled) {
if (sender.equals(this.getName())) { if (sender.equals(this.getName())) {
_logger.info(System.currentTimeMillis() + " parts *** " + _botPrimaryNick + " ***"); _logger.info(System.currentTimeMillis() + " parts *** " + _botPrimaryNick + " ***");
} else { } else {
String prependedHostname = "@" + hostname; String prependedHostname = "@" + hostname;
if (prependedHostname.endsWith(_loggedHostnamePattern)) { if (prependedHostname.endsWith(_loggedHostnamePattern)) {
_logger.info(System.currentTimeMillis() + " parts " + sender); _logger.info(System.currentTimeMillis() + " parts " + sender);
} }
} }
} }
} }
protected void onPrivateMessage(String sender, String login, String hostname, String message) { protected void onPrivateMessage(String sender, String login, String hostname, String message) {
/* /*
* Nobody else except the bot's owner can shut it down, unless of * Nobody else except the bot's owner can shut it down, unless of
* course the owner's nick isn't registered and someone's spoofing it. * course the owner's nick isn't registered and someone's spoofing it.
*/ */
if ((sender.equals(_ownerPrimaryNick) || sender.equals(_ownerSecondaryNick)) && message.equals(_botShutdownPassword)) { if ((sender.equals(_ownerPrimaryNick) || sender.equals(_ownerSecondaryNick)) && message.equals(_botShutdownPassword)) {
if (_isLoggerEnabled) if (_isLoggerEnabled)
_logger.info(System.currentTimeMillis() + " quits *** " + this.getName() + " ***"); _logger.info(System.currentTimeMillis() + " quits *** " + this.getName() + " ***");
_isIntentionalDisconnect = true; _isIntentionalDisconnect = true;
disconnect(); disconnect();
} }
} }
protected void onQuit(String sourceNick, String sourceLogin, String sourceHostname, String reason) { protected void onQuit(String sourceNick, String sourceLogin, String sourceHostname, String reason) {
String prependedHostname = "@" + sourceHostname; String prependedHostname = "@" + sourceHostname;
if (sourceNick.equals(_botPrimaryNick)) if (sourceNick.equals(_botPrimaryNick))
changeNick(_botPrimaryNick); changeNick(_botPrimaryNick);
if (_isLoggerEnabled) { if (_isLoggerEnabled) {
if (prependedHostname.endsWith(_loggedHostnamePattern)) { if (prependedHostname.endsWith(_loggedHostnamePattern)) {
_logger.info(System.currentTimeMillis() + " quits " + sourceNick + " " + reason); _logger.info(System.currentTimeMillis() + " quits " + sourceNick + " " + reason);
} }
} }
} }
private void connectToServer() { private void connectToServer() {
int loginAttempts = 0; int loginAttempts = 0;
while (true) { while (true) {
try { try {
connect(_ircServer, _ircServerPort); connect(_ircServer, _ircServerPort);
break; break;
} catch (NickAlreadyInUseException e) { } catch (NickAlreadyInUseException e) {
if (loginAttempts == 1) { if (loginAttempts == 1) {
System.out.println("Sorry, the primary and secondary bot nicks are already taken. Exiting."); System.out.println("Sorry, the primary and secondary bot nicks are already taken. Exiting.");
System.exit(1); System.exit(1);
} }
loginAttempts++; loginAttempts++;
try { try {
Thread.sleep(5000); Thread.sleep(5000);
} catch (InterruptedException e1) { } catch (InterruptedException e1) {
// Hmph. // Hmph.
} }
if (getName().equals(_botPrimaryNick)) if (getName().equals(_botPrimaryNick))
setName(_botSecondaryNick); setName(_botSecondaryNick);
else else
setName(_botPrimaryNick); setName(_botPrimaryNick);
continue; continue;
} catch (IOException e) { } catch (IOException e) {
System.out.println("Error during login: "); System.out.println("Error during login: ");
e.printStackTrace(); e.printStackTrace();
System.exit(1); System.exit(1);
} catch (IrcException e) { } catch (IrcException e) {
System.out.println("Error during login: "); System.out.println("Error during login: ");
e.printStackTrace(); e.printStackTrace();
System.exit(1); System.exit(1);
} }
} }
joinChannel(_ircChannel); joinChannel(_ircChannel);
} }
protected void onNotice(String sourceNick, String sourceLogin, String sourceHostname, String target, String notice) { protected void onNotice(String sourceNick, String sourceLogin, String sourceHostname, String target, String notice) {
if (sourceNick.equals("NickServ") && (notice.indexOf("/msg NickServ IDENTIFY") >= 0) && (_botNickservPassword != "")) { if (sourceNick.equals("NickServ") && (notice.indexOf("/msg NickServ IDENTIFY") >= 0) && (_botNickservPassword != "")) {
sendRawLineViaQueue("NICKSERV IDENTIFY " + _botNickservPassword); sendRawLineViaQueue("NICKSERV IDENTIFY " + _botNickservPassword);
} }
if (sourceNick.equals(getNick()) && notice.equals( "ROUNDTRIP " + _currentAutoRoundTripTag)) { if (sourceNick.equals(getNick()) && notice.equals( "ROUNDTRIP " + _currentAutoRoundTripTag)) {
int delay = (int)((System.currentTimeMillis() - _lastAutoRoundTripSentTime) / 100); int delay = (int)((System.currentTimeMillis() - _lastAutoRoundTripSentTime) / 100);
// sendMessage(_ircChannel, "Round-trip delay = " + (delay / 10.0f) + " seconds"); // sendMessage(_ircChannel, "Round-trip delay = " + (delay / 10.0f) + " seconds");
if (_isLoggerEnabled) if (_isLoggerEnabled)
_logger.info(System.currentTimeMillis() + " roundtrip " + delay); _logger.info(System.currentTimeMillis() + " roundtrip " + delay);
} }
} }
private void initLogger() { private void initLogger() {
String logFilePath = "logs" + File.separator + _logFilePrefix; String logFilePath = "logs" + File.separator + _logFilePrefix;
DailyRollingFileAppender rollingFileAppender = null; DailyRollingFileAppender rollingFileAppender = null;
if (!(new File("logs").exists())) if (!(new File("logs").exists()))
(new File("logs")).mkdirs(); (new File("logs")).mkdirs();
try { try {
if (_logFileRotationInterval.equals("monthly")) if (_logFileRotationInterval.equals("monthly"))
rollingFileAppender = new DailyRollingFileAppender(new PatternLayout("%m%n"), logFilePath, "'.'yyyy-MM'.log'"); rollingFileAppender = new DailyRollingFileAppender(new PatternLayout("%m%n"), logFilePath, "'.'yyyy-MM'.log'");
else if (_logFileRotationInterval.equals("weekly")) else if (_logFileRotationInterval.equals("weekly"))
rollingFileAppender = new DailyRollingFileAppender(new PatternLayout("%m%n"), logFilePath, "'.'yyyy-ww'.log'"); rollingFileAppender = new DailyRollingFileAppender(new PatternLayout("%m%n"), logFilePath, "'.'yyyy-ww'.log'");
else else
rollingFileAppender = new DailyRollingFileAppender(new PatternLayout("%m%n"), logFilePath, "'.'yyyy-MM-dd'.log'"); rollingFileAppender = new DailyRollingFileAppender(new PatternLayout("%m%n"), logFilePath, "'.'yyyy-MM-dd'.log'");
rollingFileAppender.setThreshold(Level.INFO); rollingFileAppender.setThreshold(Level.INFO);
_logger.addAppender(rollingFileAppender); _logger.addAppender(rollingFileAppender);
} catch (IOException ex) { } catch (IOException ex) {
System.out.println("Error: Couldn't create or open an existing log file. Exiting."); System.out.println("Error: Couldn't create or open an existing log file. Exiting.");
System.exit(1); System.exit(1);
} }
} }
} }

View File

@@ -1,101 +1,101 @@
##### #####
# Bogobot user configuration # Bogobot user configuration
##### #####
### ###
# The bot's nick and backup nick. You will probably want to register these with # The bot's nick and backup nick. You will probably want to register these with
# the IRC server's NickServ.(a NickServ interface is forthcoming). # the IRC server's NickServ.(a NickServ interface is forthcoming).
# #
botPrimaryNick=somebot botPrimaryNick=somebot
botSecondaryNick=somebot_ botSecondaryNick=somebot_
### ###
# The bot's password required by Nickserv service's identify command. # The bot's password required by Nickserv service's identify command.
# You have to register the nickname yourself first, the bot will not. # You have to register the nickname yourself first, the bot will not.
# #
botNickservPassword= botNickservPassword=
### ###
# The bot's username. Appears in the whois replies # The bot's username. Appears in the whois replies
# #
botUsername=somebot botUsername=somebot
##### #####
# The bot owner's nick and backup nick. One of these must match the owner's # The bot owner's nick and backup nick. One of these must match the owner's
# currently-used nick or else remote shutdown will not be possible. You will # currently-used nick or else remote shutdown will not be possible. You will
# probably want to register these with the IRC server's NickServ. # probably want to register these with the IRC server's NickServ.
# #
ownerPrimaryNick=somenick ownerPrimaryNick=somenick
ownerSecondaryNick=somenick_ ownerSecondaryNick=somenick_
### ###
# The bot will disconnect and shut down when sent this password via private # The bot will disconnect and shut down when sent this password via private
# message (aka query) from either of the owner nicks specified above. DO NOT USE # message (aka query) from either of the owner nicks specified above. DO NOT USE
# THIS DEFAULT VALUE! # THIS DEFAULT VALUE!
# #
botShutdownPassword=take off eh botShutdownPassword=take off eh
### ###
# The server, channel, and port the bot will connect to. # The server, channel, and port the bot will connect to.
# #
ircChannel=#i2p-chat ircChannel=#i2p-chat
ircServer=irc.duck.i2p ircServer=irc.duck.i2p
ircServerPort=6668 ircServerPort=6668
### ###
# Set to "true" to enable logging, else "false" (but don't use quotation marks). # Set to "true" to enable logging, else "false" (but don't use quotation marks).
# #
isLoggerEnabled=true isLoggerEnabled=true
### ###
# Restrict logging of joins and parts on the user hostname. # Restrict logging of joins and parts on the user hostname.
# Leave empty to log all of them # Leave empty to log all of them
# Prepend with a @ for a perfect match # Prepend with a @ for a perfect match
# Otherwise, specify the required end of the user hostname # Otherwise, specify the required end of the user hostname
# #
loggedHostnamePattern=@free.duck.i2p loggedHostnamePattern=@free.duck.i2p
### ###
# The prefix to be used for the filenames of logs. # The prefix to be used for the filenames of logs.
# #
logFilePrefix=irc.duck.i2p.i2p-chat logFilePrefix=irc.duck.i2p.i2p-chat
### ###
# How often the logs should be rotated. Either "daily", "weekly", or "monthly" # How often the logs should be rotated. Either "daily", "weekly", or "monthly"
# (but don't use quotation marks). # (but don't use quotation marks).
# #
logFileRotationInterval=daily logFileRotationInterval=daily
### ###
# Set to "true" to enable the regular round-trip delay computation, # Set to "true" to enable the regular round-trip delay computation,
# else "false" (but don't use quotation marks). # else "false" (but don't use quotation marks).
# #
isRoundTripDelayEnabled=false isRoundTripDelayEnabled=false
### ###
# How often should the round-trip delay be recorded. # How often should the round-trip delay be recorded.
# (in seconds) # (in seconds)
# #
roundTripDelayPeriod=300 roundTripDelayPeriod=300
### ###
# Set to "true" to enable the userlist command, else "false" (but don't use # Set to "true" to enable the userlist command, else "false" (but don't use
# quotation marks). # quotation marks).
# #
isUserlistCommandEnabled=true isUserlistCommandEnabled=true
### ###
# The userlist trigger command to listen for. It is a good idea to prefix # The userlist trigger command to listen for. It is a good idea to prefix
# triggers with some non-alphanumeric character in order to avoid accidental # triggers with some non-alphanumeric character in order to avoid accidental
# trigger use during normal channel conversation. In most cases you will # trigger use during normal channel conversation. In most cases you will
# probably want to choose a unique trigger here that no other bots in the # probably want to choose a unique trigger here that no other bots in the
# channel will respond to. # channel will respond to.
# #
userlistCommandTrigger=!who userlistCommandTrigger=!who
### ###
# The number of seconds to rest after replying to a userlist command issued by # The number of seconds to rest after replying to a userlist command issued by
# a user in the channel. The bot will ignore subsequent userlist commands during # a user in the channel. The bot will ignore subsequent userlist commands during
# this period. This helps prevent flooding. # this period. This helps prevent flooding.
# #
commandAntiFloodInterval=60 commandAntiFloodInterval=60

View File

@@ -1,57 +1,57 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!-- ********************************************************** --> <!-- ********************************************************** -->
<!-- bogobot - A simple join/part stats logger bot for I2P IRC. --> <!-- bogobot - A simple join/part stats logger bot for I2P IRC. -->
<!-- --> <!-- -->
<!-- build-eclipse.xml --> <!-- build-eclipse.xml -->
<!-- 2004 The I2P Project --> <!-- 2004 The I2P Project -->
<!-- This code is public domain. --> <!-- This code is public domain. -->
<!-- --> <!-- -->
<!-- author hypercubus, oOo --> <!-- author hypercubus, oOo -->
<!-- version 0.4 --> <!-- version 0.4 -->
<!-- ********************************************************** --> <!-- ********************************************************** -->
<project basedir="." default="dist" name="Bogobot"> <project basedir="." default="dist" name="Bogobot">
<!-- init: <!-- init:
Create distribution directory if missing and initialize time stamp for Create distribution directory if missing and initialize time stamp for
archive naming --> archive naming -->
<target name="init"> <target name="init">
<mkdir dir="dist" /> <mkdir dir="dist" />
<tstamp> <tstamp>
<format pattern="yyyy-MM-dd" property="DSTAMP" /> <format pattern="yyyy-MM-dd" property="DSTAMP" />
</tstamp> </tstamp>
</target> </target>
<!-- dist.bin: <!-- dist.bin:
Create the binary distribution archive --> Create the binary distribution archive -->
<target depends="init" description="Create the binary distribution archive" name="dist.bin"> <target depends="init" description="Create the binary distribution archive" name="dist.bin">
<zip destfile="dist/Bogobot_${DSTAMP}.zip"> <zip destfile="dist/Bogobot_${DSTAMP}.zip">
<zipfileset dir="${basedir}" includes="bogobot.bat bogobot.config Bogobot.class bogobot.sh Bogoparser.class LICENSE_log4j.txt LICENSE_pircbot.txt log4j-1.2.8.jar pircbot.jar" /> <zipfileset dir="${basedir}" includes="bogobot.bat bogobot.config Bogobot.class bogobot.sh Bogoparser.class LICENSE_log4j.txt LICENSE_pircbot.txt log4j-1.2.8.jar pircbot.jar" />
</zip> </zip>
</target> </target>
<!-- dist.source: <!-- dist.source:
Create the source distribution archive --> Create the source distribution archive -->
<target depends="init" description="Create the source distribution archive" name="dist.source"> <target depends="init" description="Create the source distribution archive" name="dist.source">
<zip destfile="dist/Bogobot_source_${DSTAMP}.zip"> <zip destfile="dist/Bogobot_source_${DSTAMP}.zip">
<zipfileset dir="${basedir}" includes="bogobot.bat bogobot.config Bogobot.java bogobot.sh Bogoparser.java build.xml build_eclipse.xml LICENSE_log4j.txt LICENSE_pircbot.txt log4j-1.2.8.jar pircbot.jar" /> <zipfileset dir="${basedir}" includes="bogobot.bat bogobot.config Bogobot.java bogobot.sh Bogoparser.java build.xml build_eclipse.xml LICENSE_log4j.txt LICENSE_pircbot.txt log4j-1.2.8.jar pircbot.jar" />
</zip> </zip>
</target> </target>
<!-- dist: <!-- dist:
Create both the binary and source distribution archives --> Create both the binary and source distribution archives -->
<target depends="dist.bin,dist.source" description="Create both the binary and source distribution archives" name="dist"> <target depends="dist.bin,dist.source" description="Create both the binary and source distribution archives" name="dist">
<echo message="Successfully created binary and source distribution archives in directory &apos;dist&apos;." /> <echo message="Successfully created binary and source distribution archives in directory &apos;dist&apos;." />
</target> </target>
<!-- clean: <!-- clean:
Delete all class files and temporary directories --> Delete all class files and temporary directories -->
<target description="Delete all class files and temporary directories" name="clean"> <target description="Delete all class files and temporary directories" name="clean">
<delete> <delete>
<fileset dir="${basedir}" includes="**/*.class" /> <fileset dir="${basedir}" includes="**/*.class" />
</delete> </delete>
<echo message="Clean successful." /> <echo message="Clean successful." />
</target> </target>
</project> </project>

View File

@@ -1,63 +1,63 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!-- ********************************************************** --> <!-- ********************************************************** -->
<!-- bogobot - A simple join/part stats logger bot for I2P IRC. --> <!-- bogobot - A simple join/part stats logger bot for I2P IRC. -->
<!-- --> <!-- -->
<!-- build.xml --> <!-- build.xml -->
<!-- 2004 The I2P Project --> <!-- 2004 The I2P Project -->
<!-- This code is public domain. --> <!-- This code is public domain. -->
<!-- --> <!-- -->
<!-- author hypercubus, oOo --> <!-- author hypercubus, oOo -->
<!-- version 0.4 --> <!-- version 0.4 -->
<!-- ********************************************************** --> <!-- ********************************************************** -->
<project basedir="." default="compile" name="Bogobot"> <project basedir="." default="compile" name="Bogobot">
<!-- init: <!-- init:
Create distribution directory if missing and initialize time stamp for Create distribution directory if missing and initialize time stamp for
archive naming --> archive naming -->
<target name="init"> <target name="init">
<mkdir dir="dist" /> <mkdir dir="dist" />
<tstamp> <tstamp>
<format pattern="yyyy-MM-dd" property="DSTAMP" /> <format pattern="yyyy-MM-dd" property="DSTAMP" />
</tstamp> </tstamp>
</target> </target>
<!-- compile: <!-- compile:
Compile source code --> Compile source code -->
<target depends="init" description="Compile source code" name="compile"> <target depends="init" description="Compile source code" name="compile">
<javac classpath="${basedir};log4j-1.2.8.jar;pircbot.jar" source="1.4" srcdir="." /> <javac classpath="${basedir};log4j-1.2.8.jar;pircbot.jar" source="1.4" srcdir="." />
</target> </target>
<!-- dist.bin: <!-- dist.bin:
Create the binary distribution archive --> Create the binary distribution archive -->
<target depends="init,compile" description="Create the binary distribution archive" name="dist.bin"> <target depends="init,compile" description="Create the binary distribution archive" name="dist.bin">
<zip destfile="dist/Bogobot_${DSTAMP}.zip"> <zip destfile="dist/Bogobot_${DSTAMP}.zip">
<zipfileset dir="${basedir}" includes="bogobot.bat bogobot.config Bogobot.class Bogobot$BogobotTickTask.class bogobot.sh Bogoparser.class LICENSE_log4j.txt LICENSE_pircbot.txt log4j-1.2.8.jar pircbot.jar" /> <zipfileset dir="${basedir}" includes="bogobot.bat bogobot.config Bogobot.class Bogobot$BogobotTickTask.class bogobot.sh Bogoparser.class LICENSE_log4j.txt LICENSE_pircbot.txt log4j-1.2.8.jar pircbot.jar" />
</zip> </zip>
</target> </target>
<!-- dist.source: <!-- dist.source:
Create the source distribution archive --> Create the source distribution archive -->
<target depends="init" description="Create the source distribution archive" name="dist.source"> <target depends="init" description="Create the source distribution archive" name="dist.source">
<zip destfile="dist/Bogobot_source_${DSTAMP}.zip"> <zip destfile="dist/Bogobot_source_${DSTAMP}.zip">
<zipfileset dir="${basedir}" includes="bogobot.bat bogobot.config Bogobot.java bogobot.sh Bogoparser.java build.xml build_eclipse.xml LICENSE_log4j.txt LICENSE_pircbot.txt log4j-1.2.8.jar pircbot.jar" /> <zipfileset dir="${basedir}" includes="bogobot.bat bogobot.config Bogobot.java bogobot.sh Bogoparser.java build.xml build_eclipse.xml LICENSE_log4j.txt LICENSE_pircbot.txt log4j-1.2.8.jar pircbot.jar" />
</zip> </zip>
</target> </target>
<!-- dist: <!-- dist:
Create both the binary and source distribution archives --> Create both the binary and source distribution archives -->
<target depends="dist.bin,dist.source" description="Create both the binary and source distribution archives" name="dist"> <target depends="dist.bin,dist.source" description="Create both the binary and source distribution archives" name="dist">
<echo message="Successfully created binary and source distribution archives in directory &apos;dist&apos;." /> <echo message="Successfully created binary and source distribution archives in directory &apos;dist&apos;." />
</target> </target>
<!-- clean: <!-- clean:
Delete all class files and temporary directories --> Delete all class files and temporary directories -->
<target description="Delete all class files and temporary directories" name="clean"> <target description="Delete all class files and temporary directories" name="clean">
<delete> <delete>
<fileset dir="${basedir}" includes="**/*.class" /> <fileset dir="${basedir}" includes="**/*.class" />
</delete> </delete>
<echo message="Clean successful." /> <echo message="Clean successful." />
</target> </target>
</project> </project>