From 2ca03e358d3968a1656f1fd87a4f63f489a51c3f Mon Sep 17 00:00:00 2001 From: "Christian P. MOMON" Date: Tue, 26 Dec 2017 02:16:40 +0100 Subject: [PATCH] Fixed else caught. Improved isValid. --- src/org/april/hebdobot/model/Hebdobot.java | 28 ++++++++++++------- .../hebdobot/pastebin/PastebinSettings.java | 2 +- src/org/april/hebdobot/review/Review.java | 2 +- .../hebdobot/twitter/TwitterSettings.java | 3 +- 4 files changed, 22 insertions(+), 13 deletions(-) diff --git a/src/org/april/hebdobot/model/Hebdobot.java b/src/org/april/hebdobot/model/Hebdobot.java index 91c0c77..ceabad3 100644 --- a/src/org/april/hebdobot/model/Hebdobot.java +++ b/src/org/april/hebdobot/model/Hebdobot.java @@ -242,6 +242,7 @@ public class Hebdobot extends PircBot { String date = ISODateTimeFormat.basicDate().print(new DateTime()); String textReview = this.review.toString(); + if (this.pastebinSettings.isValid()) { logger.info("Pastebin the review."); @@ -394,15 +395,7 @@ public class Hebdobot extends PircBot { logger.info("% caught."); - // Topic message. - if (this.review == null) - { - sendMessage("Pas de revue en cours."); - } - else - { - this.review.add(new Message(sender, text)); - } + // Ignore. } else if (text.startsWith("!")) { @@ -415,12 +408,27 @@ public class Hebdobot extends PircBot { logger.info("Else caught."); + // Topic message. + if (this.review == null) + { + sendMessage("Pas de revue en cours."); + } + else + { + this.review.add(new Message(sender, text)); + } + } + /* + else + { + logger.info("Else caught."); + // All the other. if (this.review != null) { this.review.addRaw(new Message(sender, text)); } - } + }*/ } } diff --git a/src/org/april/hebdobot/pastebin/PastebinSettings.java b/src/org/april/hebdobot/pastebin/PastebinSettings.java index 8900aed..8f2d7ef 100644 --- a/src/org/april/hebdobot/pastebin/PastebinSettings.java +++ b/src/org/april/hebdobot/pastebin/PastebinSettings.java @@ -60,7 +60,7 @@ public class PastebinSettings { boolean result; - if (StringUtils.isBlank(this.apiKey)) + if ((StringUtils.isBlank(this.apiKey)) || (StringUtils.containsOnly(this.apiKey, 'X'))) { result = false; } diff --git a/src/org/april/hebdobot/review/Review.java b/src/org/april/hebdobot/review/Review.java index 3a80ed8..ee594ac 100644 --- a/src/org/april/hebdobot/review/Review.java +++ b/src/org/april/hebdobot/review/Review.java @@ -184,7 +184,7 @@ public class Review { String result; - final StringBuffer buffer = new StringBuffer(); + StringBuffer buffer = new StringBuffer(); addLine(buffer, '='); addCenter(buffer, "Revue de la semaine en cours"); addEmpty(buffer); diff --git a/src/org/april/hebdobot/twitter/TwitterSettings.java b/src/org/april/hebdobot/twitter/TwitterSettings.java index 53b2493..c8b7a8c 100644 --- a/src/org/april/hebdobot/twitter/TwitterSettings.java +++ b/src/org/april/hebdobot/twitter/TwitterSettings.java @@ -73,7 +73,8 @@ public class TwitterSettings { boolean result; - if ((StringUtils.isBlank(this.consumerKey)) || (StringUtils.isBlank(this.consumerSecret))) + if ((StringUtils.isBlank(this.consumerKey)) || (StringUtils.isBlank(this.consumerSecret)) || (StringUtils.containsOnly(this.consumerKey, 'X')) + || (StringUtils.containsOnly(this.consumerSecret, 'X'))) { result = false; }