diff --git a/buildnum.properties b/buildnum.properties
index 9823c71..88277bf 100644
--- a/buildnum.properties
+++ b/buildnum.properties
@@ -1,3 +1,3 @@
#ANT Task: ch.oscg.jreleaseinfo.BuildNumberHandler
-#Sat Mar 05 13:36:00 PST 2005
-build.num.last=0
+#Sun Mar 06 08:26:51 PST 2005
+build.num.last=2
diff --git a/mobibot.iws b/mobibot.iws
index c6b7241..0f38f75 100644
--- a/mobibot.iws
+++ b/mobibot.iws
@@ -25,7 +25,7 @@
-
+
@@ -71,7 +71,7 @@
-
+
@@ -112,47 +112,54 @@
-
+
+
+
+
+
+
+
+
-
+
-
+
-
+
-
+
-
-
-
-
-
-
-
-
+
-
+
-
+
-
+
+
+
+
+
+
+
+
@@ -166,13 +173,6 @@
-
-
-
-
-
-
-
@@ -198,22 +198,27 @@
-
+
-
+
-
+
-
-
+
+
+
+
+
+
+
@@ -396,12 +401,12 @@
-
+
-
+
@@ -495,52 +500,29 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -564,29 +546,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -603,7 +562,53 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/net/thauvin/erik/mobibot/DeliciousPoster.java b/src/net/thauvin/erik/mobibot/DeliciousPoster.java
index 9eb1029..08235a3 100644
--- a/src/net/thauvin/erik/mobibot/DeliciousPoster.java
+++ b/src/net/thauvin/erik/mobibot/DeliciousPoster.java
@@ -71,9 +71,18 @@ public class DeliciousPoster
* @param entry The entry to add.
* @param extended The del.icio.us extended data.
*/
- public final void addPost(EntryLink entry, String extended)
+ public final void addPost(final EntryLink entry, final String extended)
{
- _delicious.addPost(entry.getLink(), entry.getTitle(), extended, _tags, entry.getDate());
+ final SwingWorker worker = new SwingWorker()
+ {
+ public Object construct()
+ {
+ return new Boolean(_delicious.addPost(entry.getLink(), entry.getTitle(), extended, _tags,
+ entry.getDate()));
+ }
+ };
+
+ worker.start();
}
/**
@@ -81,8 +90,16 @@ public class DeliciousPoster
*
* @param entry The entry to delete.
*/
- public final void deletePost(EntryLink entry)
+ public final void deletePost(final EntryLink entry)
{
- _delicious.deletePost(entry.getLink());
+ final SwingWorker worker = new SwingWorker()
+ {
+ public Object construct()
+ {
+ return new Boolean(_delicious.deletePost(entry.getLink()));
+ }
+ };
+
+ worker.start();
}
}
diff --git a/src/net/thauvin/erik/mobibot/Mobibot.java b/src/net/thauvin/erik/mobibot/Mobibot.java
index 09a4c90..658e17c 100644
--- a/src/net/thauvin/erik/mobibot/Mobibot.java
+++ b/src/net/thauvin/erik/mobibot/Mobibot.java
@@ -1122,7 +1122,7 @@ public class Mobibot extends PircBot
if (_delicious != null)
{
- _delicious.addPost(entry, postedBy(sender, channel));
+ _delicious.addPost(entry, postedBy(entry, channel));
}
saveEntries(isBackup);
@@ -1395,7 +1395,7 @@ public class Mobibot extends PircBot
if (_delicious != null)
{
- _delicious.addPost(entry, postedBy(sender, channel));
+ _delicious.addPost(entry, postedBy(entry, channel));
}
send(getChannel(), buildLink(index, entry));
@@ -1421,7 +1421,7 @@ public class Mobibot extends PircBot
if (_delicious != null)
{
- _delicious.addPost(entry, postedBy(sender, channel));
+ _delicious.addPost(entry, postedBy(entry, channel));
}
send(getChannel(), buildLink(index, entry));
@@ -2277,14 +2277,14 @@ public class Mobibot extends PircBot
/**
* Returns he del.icio.us extended attribution line.
*
- * @param sender The sender.
+ * @param entry The entry.
* @param channel The channel
*
* @return The extended attribution line.
*/
- private final String postedBy(String sender, String channel)
+ private String postedBy(EntryLink entry, String channel)
{
- return "Posted by " + sender + " on " + channel + " (" + _ircServer + ')';
+ return "Posted by " + entry.getNick() + " on " + channel + " (" + _ircServer + ')';
}
/**
diff --git a/src/net/thauvin/erik/mobibot/ReleaseInfo.java b/src/net/thauvin/erik/mobibot/ReleaseInfo.java
index 28f2ad2..e51fbe1 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 Sat Mar 05 13:36:00 PST 2005 */
+/* Creation date Sun Mar 06 08:26:51 PST 2005 */
package net.thauvin.erik.mobibot;
import java.util.Date;
@@ -12,21 +12,21 @@ import java.util.Date;
public class ReleaseInfo {
- /** buildDate (set during build process to 1110058560437L). */
- private static Date buildDate = new Date(1110058560437L);
+ /** buildDate (set during build process to 1110126411140L). */
+ private static Date buildDate = new Date(1110126411140L);
/**
- * Get buildDate (set during build process to Sat Mar 05 13:36:00 PST 2005).
+ * Get buildDate (set during build process to Sun Mar 06 08:26:51 PST 2005).
* @return Date buildDate
*/
public static final Date getBuildDate() { return buildDate; }
/**
- * Get buildNumber (set during build process to 0).
+ * Get buildNumber (set during build process to 2).
* @return int buildNumber
*/
- public static final int getBuildNumber() { return 0; }
+ public static final int getBuildNumber() { return 2; }
/** version (set during build process to "0.3"). */
diff --git a/src/net/thauvin/erik/mobibot/SwingWorker.java b/src/net/thauvin/erik/mobibot/SwingWorker.java
new file mode 100644
index 0000000..39bf290
--- /dev/null
+++ b/src/net/thauvin/erik/mobibot/SwingWorker.java
@@ -0,0 +1,131 @@
+package net.thauvin.erik.mobibot;
+
+import javax.swing.SwingUtilities;
+
+/**
+ * This is the 3rd version of SwingWorker (also known as
+ * SwingWorker 3), an abstract class that you subclass to
+ * perform GUI-related work in a dedicated thread. For
+ * instructions on and examples of using this class, see:
+ *
+ * http://java.sun.com/docs/books/tutorial/uiswing/misc/threads.html
+ *
+ * Note that the API changed slightly in the 3rd version:
+ * You must now invoke start() on the SwingWorker after
+ * creating it.
+ */
+public abstract class SwingWorker {
+ private Object value; // see getValue(), setValue()
+
+ /**
+ * Class to maintain reference to current worker thread
+ * under separate synchronization control.
+ */
+ private static class ThreadVar {
+ private Thread thread;
+ ThreadVar(Thread t) { thread = t; }
+ synchronized Thread get() { return thread; }
+ synchronized void clear() { thread = null; }
+ }
+
+ private ThreadVar threadVar;
+
+ /**
+ * Get the value produced by the worker thread, or null if it
+ * hasn't been constructed yet.
+ */
+ protected synchronized Object getValue() {
+ return value;
+ }
+
+ /**
+ * Set the value produced by worker thread
+ */
+ private synchronized void setValue(Object x) {
+ value = x;
+ }
+
+ /**
+ * Compute the value to be returned by the get
method.
+ */
+ public abstract Object construct();
+
+ /**
+ * Called on the event dispatching thread (not on the worker thread)
+ * after the construct
method has returned.
+ */
+ public void finished() {
+ }
+
+ /**
+ * A new method that interrupts the worker thread. Call this method
+ * to force the worker to stop what it's doing.
+ */
+ public void interrupt() {
+ Thread t = threadVar.get();
+ if (t != null) {
+ t.interrupt();
+ }
+ threadVar.clear();
+ }
+
+ /**
+ * Return the value created by the construct
method.
+ * Returns null if either the constructing thread or the current
+ * thread was interrupted before a value was produced.
+ *
+ * @return the value created by the construct
method
+ */
+ public Object get() {
+ while (true) {
+ Thread t = threadVar.get();
+ if (t == null) {
+ return getValue();
+ }
+ try {
+ t.join();
+ }
+ catch (InterruptedException e) {
+ Thread.currentThread().interrupt(); // propagate
+ return null;
+ }
+ }
+ }
+
+
+ /**
+ * Start a thread that will call the construct
method
+ * and then exit.
+ */
+ public SwingWorker() {
+ final Runnable doFinished = new Runnable() {
+ public void run() { finished(); }
+ };
+
+ Runnable doConstruct = new Runnable() {
+ public void run() {
+ try {
+ setValue(construct());
+ }
+ finally {
+ threadVar.clear();
+ }
+
+ SwingUtilities.invokeLater(doFinished);
+ }
+ };
+
+ Thread t = new Thread(doConstruct);
+ threadVar = new ThreadVar(t);
+ }
+
+ /**
+ * Start the worker thread.
+ */
+ public void start() {
+ Thread t = threadVar.get();
+ if (t != null) {
+ t.start();
+ }
+ }
+}