diff --git a/.classpath b/.classpath
index d8c5e3b..940e2b6 100644
--- a/.classpath
+++ b/.classpath
@@ -6,7 +6,7 @@
-
+
@@ -35,6 +35,10 @@
-
+
+
+
+
+
diff --git a/.externalToolBuilders/org.eclipse.wst.common.project.facet.core.builder.launch b/.externalToolBuilders/org.eclipse.wst.common.project.facet.core.builder.launch
new file mode 100644
index 0000000..c9bf5a5
--- /dev/null
+++ b/.externalToolBuilders/org.eclipse.wst.common.project.facet.core.builder.launch
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
diff --git a/.project b/.project
index 0720643..4cb03bd 100644
--- a/.project
+++ b/.project
@@ -11,13 +11,13 @@
- org.eclipse.wst.common.project.facet.core.builder
-
-
-
-
- org.springframework.ide.eclipse.core.springbuilder
+ org.eclipse.ui.externaltools.ExternalToolBuilder
+ full,incremental,
+
+ LaunchConfigHandle
+ <project>/.externalToolBuilders/org.eclipse.wst.common.project.facet.core.builder.launch
+
diff --git a/.settings/org.eclipse.core.resources.prefs b/.settings/org.eclipse.core.resources.prefs
index 2d45d6e..4ed15fc 100644
--- a/.settings/org.eclipse.core.resources.prefs
+++ b/.settings/org.eclipse.core.resources.prefs
@@ -1,4 +1,2 @@
eclipse.preferences.version=1
encoding//target/generated-sources/jaxb=UTF8
-encoding/=UTF8
-encoding/test=UTF8
diff --git a/.settings/org.eclipse.jst.j2ee.ejb.annotations.xdoclet.prefs b/.settings/org.eclipse.jst.j2ee.ejb.annotations.xdoclet.prefs
new file mode 100644
index 0000000..7c8126d
--- /dev/null
+++ b/.settings/org.eclipse.jst.j2ee.ejb.annotations.xdoclet.prefs
@@ -0,0 +1,5 @@
+XDOCLETBUILDERACTIVE=true
+XDOCLETHOME=
+XDOCLETUSEGLOBAL=true
+XDOCLETVERSION=1.2.1
+eclipse.preferences.version=1
diff --git a/.settings/org.eclipse.ltk.core.refactoring.prefs b/.settings/org.eclipse.ltk.core.refactoring.prefs
new file mode 100644
index 0000000..b196c64
--- /dev/null
+++ b/.settings/org.eclipse.ltk.core.refactoring.prefs
@@ -0,0 +1,2 @@
+eclipse.preferences.version=1
+org.eclipse.ltk.core.refactoring.enable.project.refactoring.history=false
diff --git a/.settings/org.eclipse.wst.common.project.facet.core.xml b/.settings/org.eclipse.wst.common.project.facet.core.xml
index 88ceb05..f8b3252 100644
--- a/.settings/org.eclipse.wst.common.project.facet.core.xml
+++ b/.settings/org.eclipse.wst.common.project.facet.core.xml
@@ -1,3 +1,5 @@
+
+
diff --git a/.settings/org.testng.eclipse.maven.prefs b/.settings/org.testng.eclipse.maven.prefs
new file mode 100644
index 0000000..e2415ea
--- /dev/null
+++ b/.settings/org.testng.eclipse.maven.prefs
@@ -0,0 +1,6 @@
+eclipse.preferences.version=1
+org.testng.eclipse.maven.additionalClasspath=true
+org.testng.eclipse.maven.argline=true
+org.testng.eclipse.maven.environ=true
+org.testng.eclipse.maven.sysproperties=true
+userprojectsettings=false
diff --git a/resources/conf/hedbobot-sample.conf b/resources/conf/hedbobot-sample.conf
index 0cccc3e..413f34f 100644
--- a/resources/conf/hedbobot-sample.conf
+++ b/resources/conf/hedbobot-sample.conf
@@ -3,28 +3,30 @@
#
# Revue settings.
-hebdobot.review.file.suffix=revue.txt
+review.directory=reviews
+review.file.suffix=revue.txt
+
# IRC settings.
-hebdobot.irc.host=irc.freenode.org
-hebdobot.irc.port=6667
-hebdobot.irc.name=Hebdobot
-hebdobot.irc.channel=#april-test
+irc.host=irc.freenode.org
+irc.port=6667
+irc.name=Hebdobot
+irc.channel=#april-test
# Pastebin settings.
-#hebdobot.pastebin.apiKey=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+#pastebin.apiKey=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
# Twitter settings.
-#hebdobot.twitter.consumerKey=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
-#hebdobot.twitter.consumerSecret=XXXXXXXXXXXXXXXXXXXXXXXXXXXXX
-#hebdobot.twitter.accessToken=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
-#hebdobot.twitter.accessTokenSecret=XXXXXXXXXXXXXXXXXXXXXXXXXX
+#twitter.consumerKey=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+#twitter.consumerSecret=XXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+#twitter.accessToken=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+#twitter.accessTokenSecret=XXXXXXXXXXXXXXXXXXXXXXXXXX
# Ident.ca settings.
-#hebdobot.identica.apiKey=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
-#hebdobot.identica.apiSecret=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
-#hebdobot.identica.tokenKey=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
-#hebdobot.identica.tokenSecret=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+#identica.apiKey=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+#identica.apiSecret=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+#identica.tokenKey=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+#identica.tokenSecret=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
# Notifications
#notify.at5.cron=0 55 11 ? * *
diff --git a/src/org/april/hebdobot/cli/HebdobotCLI.java b/src/org/april/hebdobot/cli/HebdobotCLI.java
index 7cd18ee..b0ea9dc 100644
--- a/src/org/april/hebdobot/cli/HebdobotCLI.java
+++ b/src/org/april/hebdobot/cli/HebdobotCLI.java
@@ -157,8 +157,23 @@ public class HebdobotCLI
if (config.isValid())
{
logger.info("Bot configuring…");
+
+ File reviewDirectory;
+ if (config.getReviewDirectory() == null)
+ {
+ reviewDirectory = new File(configFile.getParentFile(), "reviews");
+ }
+ else if (config.getReviewDirectory().startsWith("/"))
+ {
+ reviewDirectory = new File(config.getReviewDirectory());
+ }
+ else
+ {
+ reviewDirectory = new File(configFile.getParentFile(), config.getReviewDirectory());
+ }
+
Hebdobot bot = new Hebdobot(config.getIrcHost(), config.getIrcPort(), config.getIrcName(), config.getIrcChannel(),
- configFile.getParentFile(), config.getReviewFileSuffix());
+ configFile.getParentFile(), reviewDirectory, config.getReviewFileSuffix());
bot.getPastebinSettings().setApiKey(config.getPastebinApiKey());
bot.getIdenticaSettings().setApiKey(config.getIdenticaApiKey());
diff --git a/src/org/april/hebdobot/cli/HebdobotConfigFile.java b/src/org/april/hebdobot/cli/HebdobotConfigFile.java
index de36a7c..785cee4 100644
--- a/src/org/april/hebdobot/cli/HebdobotConfigFile.java
+++ b/src/org/april/hebdobot/cli/HebdobotConfigFile.java
@@ -281,6 +281,21 @@ public class HebdobotConfigFile extends Properties
return result;
}
+ /**
+ * Gets the review directory.
+ *
+ * @return the review directory
+ */
+ public String getReviewDirectory()
+ {
+ String result;
+
+ result = getProperty("review.directory");
+
+ //
+ return result;
+ }
+
/**
* Gets the review file suffix.
*
diff --git a/src/org/april/hebdobot/model/Hebdobot.java b/src/org/april/hebdobot/model/Hebdobot.java
index dccf849..0cc020a 100644
--- a/src/org/april/hebdobot/model/Hebdobot.java
+++ b/src/org/april/hebdobot/model/Hebdobot.java
@@ -64,6 +64,7 @@ public class Hebdobot extends PircBot
private String host;
private int port;
private String channel;
+ private File reviewDirectory;
private String reviewFileSuffix;
private Review review;
private IdenticaSettings identicaSettings;
@@ -89,7 +90,7 @@ public class Hebdobot extends PircBot
* @param reviewFileSuffix
* the review file suffix
*/
- public Hebdobot(final String host, final int port, final String name, final String channel, final File homeDirectory,
+ public Hebdobot(final String host, final int port, final String name, final String channel, final File homeDirectory, final File reviewDirectory,
final String reviewFileSuffix)
{
this.homeDirectory = homeDirectory;
@@ -97,6 +98,7 @@ public class Hebdobot extends PircBot
this.port = port;
this.channel = channel;
this.setName(name);
+ this.reviewDirectory = reviewDirectory;
this.reviewFileSuffix = reviewFileSuffix;
this.review = null;
@@ -323,7 +325,12 @@ public class Hebdobot extends PircBot
logger.info("Write review file.");
try
{
- File file = new File(this.homeDirectory, date + "_" + this.reviewFileSuffix);
+ if (!this.reviewDirectory.exists())
+ {
+ logger.info("Create review directory: " + this.reviewDirectory.getAbsolutePath());
+ this.reviewDirectory.mkdirs();
+ }
+ File file = new File(this.reviewDirectory, date + "_" + this.reviewFileSuffix);
FileUtils.writeStringToFile(file, textReview, StandardCharsets.UTF_8);
sendMessage("% Compte-rendu de la revue : " + file.getName());
}
@@ -339,6 +346,7 @@ public class Hebdobot extends PircBot
String participants = StringUtils.join(this.review.getParticipants(), " ");
sendMessage("% " + participants + ", pensez à noter votre bénévalo : http://www.april.org/my?action=benevalo");
sendMessage("% Fin de la revue hebdomadaire");
+ sendMessage(this.review.getOwner(), "Revue finie.");
this.review = null;
}
@@ -554,6 +562,7 @@ public class Hebdobot extends PircBot
try
{
sendMessage(sender + ", ok bye.");
+ sendMessage(sender, "ok bye.");
Thread.sleep(1000);
System.exit(0);
}
diff --git a/test/org/april/hebdobot/BotMock.java b/test/org/april/hebdobot/BotMock.java
index 1826476..93a4f41 100644
--- a/test/org/april/hebdobot/BotMock.java
+++ b/test/org/april/hebdobot/BotMock.java
@@ -36,7 +36,7 @@ public class BotMock extends Hebdobot
*/
public BotMock() throws Exception
{
- super("myHost", 0, "Hebdobot", "#april-mock", new File("/tmp/"), "revue.txt");
+ super("myHost", 0, "Hebdobot", "#april-mock", null, new File("/tmp/"), "revue.txt");
}
/* (non-Javadoc)