From a1695c50f0435f6d29debc92fa201d1c376fdee1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Damstedt=20Rasmussen?= Date: Tue, 24 Oct 2023 09:47:04 +0200 Subject: [PATCH] Change underscore to space in word splitting --- Client/jSpamBot/src/BadWords.java | 5 +++-- Client/jSpamBot/src/Main.java | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Client/jSpamBot/src/BadWords.java b/Client/jSpamBot/src/BadWords.java index c6b4dbaafb..6783cd0c63 100644 --- a/Client/jSpamBot/src/BadWords.java +++ b/Client/jSpamBot/src/BadWords.java @@ -56,13 +56,14 @@ boolean loadFile(String language, String filename) { Vector badwords_lower = new Vector<>(); for (String w : badwords) badwords_lower.add(w.toLowerCase()); - + lang_badwords.put(language, badwords_lower); return true; } boolean contains(String language, String sentence) { - sentence = sentence.toLowerCase(); + sentence = sentence.toLowerCase().replace('_', ' '); + String[] words = sentence.split("\\W"); for (String word : words) { if (word.isEmpty()) diff --git a/Client/jSpamBot/src/Main.java b/Client/jSpamBot/src/Main.java index 6ee8bb8552..c701a51c4e 100644 --- a/Client/jSpamBot/src/Main.java +++ b/Client/jSpamBot/src/Main.java @@ -46,7 +46,7 @@ public static void main(String[] args) throws IOException, InterruptedException, badwords.loadFile("french", "badwords_french.txt"); var bannetworks = IPBan.loadFile("vpnips.txt"); - + var sessions = new Vector(); var lastServers = new Vector(); var serverlistUpdateTimeout = System.nanoTime();