Browse Source

Lots of stuffs before Beta

Martin Passard 7 years ago
parent
commit
6be25a570a

+ 1 - 1
ressources/config/config.properties

@@ -31,4 +31,4 @@ Debug=true
 #Time between each +reload allowed in seconds
 Minimum_time_beetween_+reload=360
 #Time between each autoreload in seconds
-CacheReloader_timeout=3600
+CacheReloader_timeout=3600

+ 5 - 1
ressources/config/default.properties

@@ -36,4 +36,8 @@ Minimum_time_beetween_+reload=360
 CacheReloader_timeout=3600
 
 ## Actions settings
-Caractere_commmand=-
+Caractere_commande=-
+
+## Allowed Actions Properties
+listeall=true
+infoall=false

+ 2 - 5
src/actions/Distance.java

@@ -38,17 +38,14 @@ public class Distance extends Action {
 				Coordinates ca = getCoordinatesFromMessage(message, channel);
 				latitude = ca.getLatitude();
 				longitude = ca.getLongitude();
+				affichePlusProches(latitude, longitude, channel);
 			} catch (MultiplePossibleAddressException e1) {
-				bot.sendMessage(channel, "Plusieurs possibilités pour cet endroit, nous choissisons le 1:");
+				bot.sendMessage(channel, "Plusieurs possibilités pour cet endroit, veuillez preciser:");
 				for(int i = 0; i<e1.lieux.length; ++i) {
 					bot.sendMessage(channel, (i+1)+":"+e1.lieux[i].toString());
 				}
-				latitude = e1.lieux[0].coordonees.getLatitude();
-				longitude = e1.lieux[0].coordonees.getLongitude();
 			}
 			
-		}finally {
-			affichePlusProches(latitude, longitude, channel);
 		}
 
 	}

+ 3 - 1
src/actions/Info.java

@@ -11,6 +11,8 @@ import main.Cache;
 import verif_saisie.EntierPositifNonVide;
 
 public class Info extends Action {
+	
+	public static boolean INFO_ALL = false;
 
 	public Info(Bot b) {
 		super(b);
@@ -36,7 +38,7 @@ public class Info extends Action {
 			if(!EntierPositifNonVide.verifie(s)) {			// Un mot après +info
 
 
-				if(s.equalsIgnoreCase("all")) {	          			  // +info all
+				if(s.equalsIgnoreCase("all") && INFO_ALL) {	          			  // +info all
 					Cache c = Cache.getInstance();
 					ib.sendMessage(channel, c.toStringIRC());
 					for(ISP i : c.getListe()) {

+ 4 - 1
src/actions/Liste.java

@@ -11,11 +11,14 @@ import main.Bot;
 import main.Cache;
 
 public class Liste extends Action {
+	
+	public static boolean allAllowed=true;
 
 	public Liste(Bot b) {
 		super(b);
 		List<String> ar = new ArrayList<>();
 		ar.add("liste");
+		ar.add("list");
 		this.keyWords = ar;
 	}
 
@@ -42,7 +45,7 @@ public class Liste extends Action {
 		String s="";
 
 
-		if(message.indexOf(' ')!=-1 && message.substring(message.indexOf(" ")).contains("all")) {
+		if(allAllowed && message.indexOf(' ')!=-1 && message.substring(message.indexOf(" ")).equalsIgnoreCase("all")) {
 			messages.add("=== Hors fédé: ===");
 			for(ISP isp: listeFAI) {
 				if(!isp.isFFDNMember()) {

+ 1 - 1
src/data/ISPDAO.java

@@ -153,7 +153,7 @@ public class ISPDAO {
 		if(json != null) {
 			if(Main.isDebug()) {
 				System.out.println("JSON du FAI "+number);
-		System.out.println(json);
+				//System.out.println(json);
 			}
 		JSONObject jsonObj = new JSONObject(json);
 		String name = getName(jsonObj);

+ 13 - 2
src/main/PropertiesSetter.java

@@ -7,6 +7,8 @@ import java.io.IOException;
 import java.util.Properties;
 
 import actions.Action;
+import actions.Info;
+import actions.Liste;
 import verif_saisie.EntierPositifNonVide;
 
 
@@ -65,9 +67,18 @@ public class PropertiesSetter {
 		
 		cr.setTimeout(Long.parseLong(prop.getProperty("CacheReloader_timeout")));
 		
-		if(prop.getProperty("Caractere_command") != null) {
-			Action.CARACTERE_COMMANDE=prop.getProperty("Caractere_command").charAt(0);
+		if(prop.getProperty("Caractere_commande") != null) {
+			Action.CARACTERE_COMMANDE=prop.getProperty("Caractere_commande").charAt(0);
 		}
+		if(prop.getProperty("listeall") != null) {
+			Liste.allAllowed = Boolean.parseBoolean(prop.getProperty("listeall"));
+		}
+		if(prop.getProperty("infoall") != null) {
+			Info.INFO_ALL = Boolean.parseBoolean(prop.getProperty("infoall"));
+		}
+		
+		
+		
 		return true;
 	}