diff --git a/buildnum.properties b/buildnum.properties
index a697dd6..2e54031 100644
--- a/buildnum.properties
+++ b/buildnum.properties
@@ -1,3 +1,3 @@
#ANT Task: ch.oscg.jreleaseinfo.BuildNumberHandler
-#Thu Dec 29 01:58:01 PST 2005
-build.num.last=43
+#Fri Jun 02 16:51:45 PDT 2006
+build.num.last=63
diff --git a/lib/delicious-1.12.jar b/lib/delicious-1.12.jar
new file mode 100644
index 0000000..803449d
Binary files /dev/null and b/lib/delicious-1.12.jar differ
diff --git a/lib/delicious-2.0.jar b/lib/delicious-2.0.jar
deleted file mode 100644
index 2eaf28a..0000000
Binary files a/lib/delicious-2.0.jar and /dev/null differ
diff --git a/mobibot.iml b/mobibot.iml
index 5f2d3ec..691ea12 100644
--- a/mobibot.iml
+++ b/mobibot.iml
@@ -108,15 +108,6 @@
-
-
-
-
-
-
-
-
-
@@ -156,7 +147,16 @@
-
+
+
+
+
+
+
+
+
+
+
diff --git a/mobibot.ipr b/mobibot.ipr
index 8665459..2c8ea91 100644
--- a/mobibot.ipr
+++ b/mobibot.ipr
@@ -21,10 +21,10 @@
false
-
+
diff --git a/mobibot.iws b/mobibot.iws
index 4d9f01c..2b5eb06 100644
--- a/mobibot.iws
+++ b/mobibot.iws
@@ -13,6 +13,8 @@
+
+
@@ -56,9 +58,9 @@
@@ -68,9 +70,6 @@
-
-
-
@@ -97,6 +96,21 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -120,28 +134,10 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-
+
@@ -149,64 +145,28 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
@@ -224,6 +184,10 @@
+
+
+
+
@@ -233,6 +197,15 @@
+
+
+
+
+
+
+
+
+
@@ -274,9 +247,7 @@
-
-
@@ -340,7 +311,65 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -349,7 +378,7 @@
-
+
@@ -440,6 +469,39 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -456,18 +518,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
@@ -477,27 +527,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -565,32 +594,34 @@
-
+
-
-
+
-
+
-
+
-
+
-
-
+
+
+
-
-
+
+
+
-
+
+
@@ -607,7 +638,6 @@
-
@@ -662,7 +692,7 @@
-
+
@@ -673,27 +703,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -708,37 +717,9 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
@@ -750,36 +731,64 @@
-
+
-
-
-
-
+
+
-
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/net/thauvin/erik/mobibot/DeliciousPoster.java b/src/net/thauvin/erik/mobibot/DeliciousPoster.java
index 961ef78..b63c5f6 100644
--- a/src/net/thauvin/erik/mobibot/DeliciousPoster.java
+++ b/src/net/thauvin/erik/mobibot/DeliciousPoster.java
@@ -42,100 +42,113 @@ import del.icio.us.Delicious;
/**
* The class to handle posts to del.icio.us.
*
- * @author Erik C. Thauvin
- * @version $Revision$, $Date$
- * @created Mar 5, 2005
- * @since 1.0
+ * @author Erik C. Thauvin
+ * @version $Revision$, $Date$
+ * @created Mar 5, 2005
+ * @since 1.0
+ * @noinspection UnnecessaryBoxing
*/
public class DeliciousPoster
{
- private final Delicious _delicious;
- private final String _ircServer;
+ private final Delicious _delicious;
+ private final String _ircServer;
- /**
- * Creates a new DeliciousPoster instance.
- *
- * @param username The del.icio.us username.
- * @param password The del.icio.us password.
- * @param ircServer The IRC server.
- */
- public DeliciousPoster(String username, String password, String ircServer)
- {
- _delicious = new Delicious(username, password);
- _ircServer = ircServer;
- }
+ /**
+ * Creates a new DeliciousPoster instance.
+ *
+ * @param username The del.icio.us username.
+ * @param password The del.icio.us password.
+ * @param ircServer The IRC server.
+ */
+ public DeliciousPoster(String username, String password, String ircServer)
+ {
+ _delicious = new Delicious(username, password);
+ _ircServer = ircServer;
+ }
- /**
- * Adds a post to del.icio.us.
- *
- * @param entry The entry to add.
- */
- public final void addPost(final EntryLink entry)
- {
- final SwingWorker worker = new SwingWorker()
- {
- public Object construct()
- {
- return Boolean.valueOf(_delicious.addPost(entry.getLink(), entry.getTitle(), postedBy(entry),
- entry.getDeliciousTags(), entry.getDate()));
- }
- };
+ /**
+ * Adds a post to del.icio.us.
+ *
+ * @param entry The entry to add.
+ */
+ public final void addPost(final EntryLink entry)
+ {
+ final SwingWorker worker =
+ new SwingWorker()
+ {
+ public Object construct()
+ {
+ return Boolean.valueOf(_delicious.addPost(entry.getLink(), entry.getTitle(), postedBy(entry),
+ entry.getDeliciousTags(), entry.getDate()));
+ }
+ };
- worker.start();
- }
+ worker.start();
+ }
- /**
- * Deletes a post to del.icio.us.
- *
- * @param entry The entry to delete.
- */
- public final void deletePost(EntryLink entry)
- {
- final String link = entry.getLink();
+ /**
+ * Deletes a post to del.icio.us.
+ *
+ * @param entry The entry to delete.
+ */
+ public final void deletePost(EntryLink entry)
+ {
+ final String link = entry.getLink();
- final SwingWorker worker = new SwingWorker()
- {
- public Object construct()
- {
- return Boolean.valueOf(_delicious.deletePost(link));
- }
- };
+ final SwingWorker worker =
+ new SwingWorker()
+ {
+ public Object construct()
+ {
+ return Boolean.valueOf(_delicious.deletePost(link));
+ }
+ };
- worker.start();
- }
+ worker.start();
+ }
- /**
- * Updates a post to del.icio.us.
- *
- * @param oldUrl The old post URL.
- * @param entry The entry to add.
- */
- public final void updatePost(final String oldUrl, final EntryLink entry)
- {
- final SwingWorker worker = new SwingWorker()
- {
- public Object construct()
- {
- _delicious.deletePost(oldUrl);
+ /**
+ * Updates a post to del.icio.us.
+ *
+ * @param oldUrl The old post URL.
+ * @param entry The entry to add.
+ */
+ public final void updatePost(final String oldUrl, final EntryLink entry)
+ {
+ final SwingWorker worker =
+ new SwingWorker()
+ {
+ public Object construct()
+ {
+ if (!oldUrl.equals(entry.getLink()))
+ {
+ _delicious.deletePost(oldUrl);
- return Boolean.valueOf(_delicious.addPost(entry.getLink(), entry.getTitle(), postedBy(entry),
- entry.getDeliciousTags(), entry.getDate()));
- }
- };
+ return Boolean.valueOf(_delicious.addPost(entry.getLink(), entry.getTitle(), postedBy(entry),
+ entry.getDeliciousTags(), entry.getDate()));
+ }
+ else
+ {
+ return Boolean.valueOf(_delicious.addPost(entry.getLink(), entry.getTitle(), postedBy(entry),
+ entry.getDeliciousTags(), entry.getDate(), true,
+ true));
+ }
+ }
+ };
- worker.start();
- }
+ worker.start();
+ }
- /**
- * Returns he del.icio.us extended attribution line.
- *
- * @param entry The entry.
- *
- * @return The extended attribution line.
- */
- private String postedBy(EntryLink entry)
- {
- return "Posted by " + entry.getNick() + " on " + entry.getChannel() + " (" + _ircServer + ')';
- }
+ /**
+ * Returns he del.icio.us extended attribution line.
+ *
+ * @param entry The entry.
+ *
+ * @return The extended attribution line.
+ */
+ private String postedBy(EntryLink entry)
+ {
+ return "Posted by " + entry.getNick() + " on " + entry.getChannel() + " (" + _ircServer + ')';
+ }
}
diff --git a/src/net/thauvin/erik/mobibot/EntryLink.java b/src/net/thauvin/erik/mobibot/EntryLink.java
index f4ea17b..1276e61 100644
--- a/src/net/thauvin/erik/mobibot/EntryLink.java
+++ b/src/net/thauvin/erik/mobibot/EntryLink.java
@@ -435,4 +435,25 @@ public class EntryLink implements Serializable
{
_title = title;
}
+
+ /**
+ * Returns a string representation of the object.
+ *
+ * @return A string representation of the object.
+ */
+ public final String toString()
+ {
+ final StringBuffer sb = new StringBuffer(super.toString());
+ sb.append("[ channel -> '").append(_channel).append('\'');
+ sb.append(", comments -> ").append(_comments);
+ sb.append(", date -> ").append(_date);
+ sb.append(", link -> '").append(_link).append('\'');
+ sb.append(", login -> '").append(_login).append('\'');
+ sb.append(", nick -> '").append(_nick).append('\'');
+ sb.append(", tags -> ").append(_tags);
+ sb.append(", title -> '").append(_title).append('\'');
+ sb.append(" ]");
+
+ return sb.toString();
+ }
}
diff --git a/src/net/thauvin/erik/mobibot/Mobibot.java b/src/net/thauvin/erik/mobibot/Mobibot.java
index ad392b5..e8e34ac 100644
--- a/src/net/thauvin/erik/mobibot/Mobibot.java
+++ b/src/net/thauvin/erik/mobibot/Mobibot.java
@@ -86,10 +86,10 @@ public class Mobibot extends PircBot
* The info strings.
*/
private static final String[] INFO_STRS =
- {
- "Mobibot v" + ReleaseInfo.getVersion() + '.' + ReleaseInfo.getBuildNumber() +
- " by Erik C. Thauvin (erik@thauvin.net)", "http://www.mobitopia.org/mobibot/"
- };
+ {
+ "Mobibot v" + ReleaseInfo.getVersion() + '.' + ReleaseInfo.getBuildNumber() +
+ " by Erik C. Thauvin (erik@thauvin.net)", "http://www.mobitopia.org/mobibot/"
+ };
/**
* Debug command line argument.
@@ -274,7 +274,8 @@ public class Mobibot extends PircBot
/**
* The date/time format for the {@link #TIME_CMD time} command.
*/
- private static final SimpleDateFormat TIME_SDF = new SimpleDateFormat("'The time is 'HH:mm' on 'EEE, d MMM yyyy' in '");
+ private static final SimpleDateFormat TIME_SDF =
+ new SimpleDateFormat("'The time is 'HH:mm' on 'EEE, d MMM yyyy' in '");
/**
* The beats (Internet Time) keyword.
@@ -424,7 +425,7 @@ public class Mobibot extends PircBot
/**
* The entries array.
*/
- private final List _entries = new Vector(0);
+ private final List _entries = new ArrayList(0);
/**
* The feed info cache.
@@ -445,7 +446,7 @@ public class Mobibot extends PircBot
/**
* The history/backlogs array.
*/
- private final List _history = new Vector(0);
+ private final List _history = new ArrayList(0);
/**
* The ident message.
@@ -461,7 +462,7 @@ public class Mobibot extends PircBot
/**
* The ignored nicks array.
*/
- private final List _ignoredNicks = new Vector(0);
+ private final List _ignoredNicks = new ArrayList(0);
/**
* The IRC port.
@@ -571,7 +572,9 @@ public class Mobibot extends PircBot
/**
* The Truth Is Out There...
*
- * @param args The command line arguments.
+ * @param args The command line arguments.
+ *
+ * @noinspection UseOfSystemOutOrSystemErr,ACCESS_STATIC_VIA_INSTANCE
*/
public static void main(String[] args)
{
@@ -580,7 +583,8 @@ public class Mobibot extends PircBot
options.addOption(HELP_ARG.substring(0, 1), HELP_ARG, false, "print this help message");
options.addOption(DEBUG_ARG.substring(0, 1), DEBUG_ARG, false,
"print debug & logging data directly to the console");
- options.addOption(PROPS_ARG.substring(0, 1), PROPS_ARG, true, "use alternate properties file");
+ options.addOption(OptionBuilder.withArgName("file").hasArg().withDescription("use alternate properties file")
+ .withLongOpt(PROPS_ARG).create(PROPS_ARG.substring(0, 1)));
// Parse the command line
final CommandLineParser parser = new PosixParser();
@@ -655,8 +659,9 @@ public class Mobibot extends PircBot
try
{
- stdout = new PrintStream(new FileOutputStream(logsDir + channel.substring(1) + '.' + today() +
- ".log", true));
+ stdout =
+ new PrintStream(new FileOutputStream(logsDir + channel.substring(1) + '.' + today() + ".log",
+ true));
}
catch (IOException e)
{
@@ -1009,15 +1014,12 @@ public class Mobibot extends PircBot
send(sender, "For more information on specific command, type:");
send(sender, DOUBLE_INDENT + bold(getNick() + ": " + HELP_CMD + " "));
send(sender, "The commands are:");
- send(sender,
- DOUBLE_INDENT +
+ send(sender, DOUBLE_INDENT +
bold(CALC_CMD + ' ' + CURRENCY_CMD + ' ' + DICE_CMD + ' ' + GOOGLE_CMD + ' ' + IGNORE_CMD));
- send(sender,
- DOUBLE_INDENT +
+ send(sender, DOUBLE_INDENT +
bold(INFO_CMD + ' ' + getChannel().substring(1) + ' ' + LOOKUP_CMD + ' ' + HELP_POSTING_KEYWORD + ' ' +
RECAP_CMD));
- send(sender,
- DOUBLE_INDENT +
+ send(sender, DOUBLE_INDENT +
bold(SPELL_CMD + ' ' + STOCK_CMD + ' ' + HELP_TAGS_KEYWORD + ' ' + TIME_CMD + ' ' + USERS_CMD + ' ' +
VIEW_CMD));
send(sender, DOUBLE_INDENT + bold(WEATHER_CMD));
@@ -1092,6 +1094,8 @@ public class Mobibot extends PircBot
/**
* This method carries out the actions to be performed when the PircBot gets disconnected.
+ *
+ * @noinspection UseOfSystemOutOrSystemErr
*/
protected final void onDisconnect()
{
@@ -1123,8 +1127,12 @@ public class Mobibot extends PircBot
{
if (retries == MAX_RECONNECT)
{
- _logger.debug("Unable to reconnect to " + _ircServer + " after " + MAX_RECONNECT + " retries.",
- ex);
+ if (_logger.isDebugEnabled())
+ {
+ _logger.debug("Unable to reconnect to " + _ircServer + " after " + MAX_RECONNECT +
+ " retries.", ex);
+ }
+
e.printStackTrace(System.err);
System.exit(1);
}
@@ -1259,13 +1267,13 @@ public class Mobibot extends PircBot
else if (cmd.equals(PING_CMD))
{
final String[] pings =
- {
- "is barely alive.", "is trying to stay awake.", "has gone fishing.",
- "is somewhere over the rainbow.", "has fallen and can't get up.",
- "is running. You better go chase it.", "has just spontantiously combusted.",
- "is talking to itself... don't interrupt. That's rude.", "is bartending at an AA meeting.",
- "is hibernating.", "is saving energy: apathetic mode activated.", "is busy. Go away!"
- };
+ {
+ "is barely alive.", "is trying to stay awake.", "has gone fishing.",
+ "is somewhere over the rainbow.", "has fallen and can't get up.",
+ "is running. You better go chase it.", "has just spontantiously combusted.",
+ "is talking to itself... don't interrupt. That's rude.", "is bartending at an AA meeting.",
+ "is hibernating.", "is saving energy: apathetic mode activated.", "is busy. Go away!"
+ };
final Random r = new Random();
@@ -1354,7 +1362,10 @@ public class Mobibot extends PircBot
}
catch (Exception e)
{
- _logger.debug("Unable to calculate: " + message, e);
+ if (_logger.isDebugEnabled())
+ {
+ _logger.debug("Unable to calculate: " + message, e);
+ }
}
}
else
@@ -1498,7 +1509,7 @@ public class Mobibot extends PircBot
if (_delicious != null)
{
- _delicious.addPost(entry);
+ _delicious.updatePost(entry.getLink(), entry);
}
send(getChannel(), buildLink(index, entry));
@@ -1583,7 +1594,7 @@ public class Mobibot extends PircBot
if (_delicious != null)
{
- _delicious.addPost(entry);
+ _delicious.updatePost(entry.getLink(), entry);
}
send(getChannel(), buildTags(index, entry));
@@ -1672,10 +1683,12 @@ public class Mobibot extends PircBot
/**
* This method is called whenever a private message is sent to the bot.
*
- * @param sender The nick of the person who sent the private message.
- * @param login The login of the person who sent the private message.
- * @param hostname The hostname of the person who sent the private message.
- * @param message The actual message sent.
+ * @param sender The nick of the person who sent the private message.
+ * @param login The login of the person who sent the private message.
+ * @param hostname The hostname of the person who sent the private message.
+ * @param message The actual message sent.
+ *
+ * @noinspection UseOfSystemOutOrSystemErr
*/
protected final void onPrivateMessage(String sender, String login, String hostname, String message)
{
@@ -2338,8 +2351,7 @@ public class Mobibot extends PircBot
timeInSeconds -= (hours * 3600L);
final long minutes = timeInSeconds / 60L;
- send(sender,
- "Uptime: " + days + " day(s) " + hours + " hour(s) " + minutes + " minute(s) [Entries: " +
+ send(sender, "Uptime: " + days + " day(s) " + hours + " hour(s) " + minutes + " minute(s) [Entries: " +
_entries.size() + ']', isPrivate);
}
@@ -2471,10 +2483,11 @@ public class Mobibot extends PircBot
for (int i = items.size() - 1; i >= 0; i--)
{
item = (SyndEntryImpl) items.get(i);
- author = item.getAuthor().substring(item.getAuthor().lastIndexOf('(') + 1,
- item.getAuthor().length() - 1);
- entry = new EntryLink(item.getLink(), item.getTitle(), author, getChannel(), item.getPublishedDate(),
- item.getCategories());
+ author =
+ item.getAuthor().substring(item.getAuthor().lastIndexOf('(') + 1, item.getAuthor().length() - 1);
+ entry =
+ new EntryLink(item.getLink(), item.getTitle(), author, getChannel(), item.getPublishedDate(),
+ item.getCategories());
description = item.getDescription();
comments = description.getValue().split("
");
@@ -2550,7 +2563,11 @@ public class Mobibot extends PircBot
}
catch (IOException ioe)
{
- _logger.debug("Unable to perform whois IP lookup: " + query, ioe);
+ if (_logger.isDebugEnabled())
+ {
+ _logger.debug("Unable to perform whois IP lookup: " + query, ioe);
+ }
+
send(getChannel(), "Unable to perform whois IP lookup: " + ioe.getMessage());
}
}
@@ -2917,8 +2934,9 @@ public class Mobibot extends PircBot
else
{
TIME_SDF.setTimeZone(TimeZone.getTimeZone(tz));
- response = TIME_SDF.format(Calendar.getInstance().getTime()) +
- tz.substring(tz.indexOf('/') + 1).replace('_', ' ');
+ response =
+ TIME_SDF.format(Calendar.getInstance().getTime()) +
+ tz.substring(tz.indexOf('/') + 1).replace('_', ' ');
}
}
else
@@ -3041,8 +3059,7 @@ public class Mobibot extends PircBot
{
if (sent > MAX_ENTRIES)
{
- send(sender,
- "To view more, try: " +
+ send(sender, "To view more, try: " +
bold(getNick() + ": " + VIEW_CMD + ' ' + (i + 1) + ' ' + lcArgs), isPrivate);
break;
diff --git a/src/net/thauvin/erik/mobibot/ReleaseInfo.java b/src/net/thauvin/erik/mobibot/ReleaseInfo.java
index e3cd1de..1d5a59d 100644
--- a/src/net/thauvin/erik/mobibot/ReleaseInfo.java
+++ b/src/net/thauvin/erik/mobibot/ReleaseInfo.java
@@ -1,5 +1,5 @@
/* Created by JReleaseInfo AntTask from Open Source Competence Group */
-/* Creation date Thu Dec 29 01:58:01 PST 2005 */
+/* Creation date Fri Jun 02 16:51:45 PDT 2006 */
package net.thauvin.erik.mobibot;
import java.util.Date;
@@ -20,21 +20,21 @@ public class ReleaseInfo {
}
- /** buildDate (set during build process to 1135850281968L). */
- private static final Date buildDate = new Date(1135850281968L);
+ /** buildDate (set during build process to 1149292305593L). */
+ private static final Date buildDate = new Date(1149292305593L);
/**
- * Get buildDate (set during build process to Thu Dec 29 01:58:01 PST 2005).
+ * Get buildDate (set during build process to Fri Jun 02 16:51:45 PDT 2006).
* @return Date buildDate
*/
public static Date getBuildDate() { return buildDate; }
/**
- * Get buildNumber (set during build process to 43).
+ * Get buildNumber (set during build process to 63).
* @return int buildNumber
*/
- public static int getBuildNumber() { return 43; }
+ public static int getBuildNumber() { return 63; }
/** version (set during build process to "0.3"). */