minor fixes

This commit is contained in:
Dmitry Isaenko 2021-12-29 21:10:17 +03:00
parent 2058370ee6
commit 61a7b76096
5 changed files with 17 additions and 9 deletions

View file

@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>loper</groupId> <groupId>loper</groupId>
<artifactId>InnaIrcBot</artifactId> <artifactId>InnaIrcBot</artifactId>
<version>0.9.1-SNAPSHOT</version> <version>0.9.2-SNAPSHOT</version>
<packaging>jar</packaging> <packaging>jar</packaging>
<name>InnaIrcBot</name> <name>InnaIrcBot</name>

View file

@ -288,7 +288,7 @@ public class PrivateMsgCommander { // TODO: add black list: add users afte
private void unban(String chanel, String user){ private void unban(String chanel, String user){
cmode(chanel, "-b", simplifyNick(user)+"*!*@*"); cmode(chanel, "-b", simplifyNick(user)+"*!*@*");
if (user.contains("@")){ if (user.contains("@")){
cmode(chanel, "-b", "*!*@"+user.replaceAll("^.+@","")); cmode(chanel, "-b", user);
} }
} }
private void kickban(String chanel, String user, String reason){ private void kickban(String chanel, String user, String reason){

View file

@ -66,9 +66,8 @@ public class JoinFloodHandler implements EventHandler {
return fistJoinTime; return fistJoinTime;
} }
private void kickBanUser(String user){ private void kickBanUser(String user){
StreamProvider.writeToStream(server, StreamProvider.writeToStream(server,"PRIVMSG "+ channel +" :"+user+": join flood ("+ joinMaxNumber +" connections in "+timeFrameInSeconds+" seconds).\n");
"PRIVMSG "+ channel +" :"+user+": join flood ("+ joinMaxNumber +" connections in "+timeFrameInSeconds+" seconds).\n"+ StreamProvider.writeToStream(server,"MODE "+ channel +" +b "+user+"!*@*"); // TODO: consider other ban methods
"MODE "+ channel +" +b "+user+"!*@*"); // TODO: consider other ban methods
} }
private String simplifyNick(String nick){ return nick.replaceAll("!.*$",""); } private String simplifyNick(String nick){ return nick.replaceAll("!.*$",""); }

View file

@ -1,7 +1,7 @@
package InnaIrcBot; package InnaIrcBot;
public class GlobalData { public class GlobalData {
private static final String version = "InnaIrcBot v0.9.1 \"Литке\""; private static final String version = "InnaIrcBot v0.9.2 \"Литке\"";
public static synchronized String getAppVersion(){ public static synchronized String getAppVersion(){
return String.format("%s, %s %s %s", version, return String.format("%s, %s %s %s", version,
System.getProperty("os.name"), System.getProperty("os.name"),

View file

@ -70,11 +70,20 @@ class LinksTitleHandler implements Runnable{
); );
StringBuilder stringBuffer = new StringBuilder(); StringBuilder stringBuffer = new StringBuilder();
//stringBuffer.setLength();
String line; String line;
int semaphore = 0;
while ((line = reader.readLine()) != null) { while ((line = reader.readLine()) != null) {
stringBuffer.append(line); if (semaphore == 1) {
if (line.contains("</title>")) { stringBuffer.append(line);
break; if (line.contains("</title>")) {
break;
}
continue;
}
if (line.contains("<title>")) {
semaphore = 1;
stringBuffer.append(line);
} }
} }
reader.close(); reader.close();