minor fixes

master
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>
<groupId>loper</groupId>
<artifactId>InnaIrcBot</artifactId>
<version>0.9.1-SNAPSHOT</version>
<version>0.9.2-SNAPSHOT</version>
<packaging>jar</packaging>
<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){
cmode(chanel, "-b", simplifyNick(user)+"*!*@*");
if (user.contains("@")){
cmode(chanel, "-b", "*!*@"+user.replaceAll("^.+@",""));
cmode(chanel, "-b", user);
}
}
private void kickban(String chanel, String user, String reason){

View File

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

View File

@ -1,7 +1,7 @@
package InnaIrcBot;
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(){
return String.format("%s, %s %s %s", version,
System.getProperty("os.name"),

View File

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