This commit is contained in:
Dmitry Isaenko 2019-01-02 15:25:04 +03:00
parent 4c532a730c
commit 91dfb5a934
9 changed files with 20 additions and 8 deletions

3
Jenkinsfile vendored
View file

@ -2,7 +2,7 @@ pipeline {
agent {
docker {
image 'maven:3-alpine'
args '-v /root/.m2:/root/.m2 -v /home/docker/innaircbot/files/artifact:/rel'
args '-v /home/docker/jenkins/files/m2:/root/.m2 -v /home/docker/innaircbot/files/artifact:/rel'
}
}
@ -19,6 +19,7 @@ pipeline {
}
stage('Deploy') {
steps {
// TODO: consider switch to docker registry
sh 'cp ./target/InnaIrcBot-*-jar-with-dependencies.jar /rel/InnaIrcBot.jar'
// sh 'docker restart innaircbot'
}

View file

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

View file

@ -1,7 +1,6 @@
/**
* InnaIrcBot
* @author Dmitry Isaenko
* @version 0.1 "Батлкрузер"
* Russia, 2018.
* */
package InnaIrcBot;

View file

@ -151,13 +151,13 @@ public class ChanelCommander implements Runnable {
executiveStr.append(": ");
}
for (int i = 1; i<messages.length; i++){
for (int i = 0; i < messages.length; i++){
if ( ! messages[i].startsWith("\\"))
executiveStr.append(messages[i]);
else if (messages[i].equals("\\time"))
executiveStr.append(LocalTime.now().format(DateTimeFormatter.ofPattern("HH:mm:ss")));
}
//System.out.println(executiveStr); //TODO: debug
//System.out.println(executiveStr.toString()); //TODO: debug
StreamProvider.writeToStream(server, executiveStr.toString());
}
private void banAction(String whom){
@ -172,7 +172,7 @@ public class ChanelCommander implements Runnable {
executiveStr.append(simplifyNick(whom));
executiveStr.append(" :");
for (int i = 1; i<messages.length; i++){
for (int i = 0; i < messages.length; i++){
if ( ! messages[i].startsWith("\\"))
executiveStr.append(messages[i]);
else if (messages[i].equals("\\time"))

View file

@ -3,6 +3,7 @@ package InnaIrcBot.Config;
public class StorageFile {
private final String serverName;
private final int serverPort;
private final String serverPass;
private final String[] channels;
private final String userNick;
private final String userIdent;
@ -18,6 +19,7 @@ public class StorageFile {
public String getServerName() { return serverName; }
public int getServerPort() { return serverPort; }
public String getServerPass() { return serverPass; }
public String[] getChannels() { return channels; }
public String getUserNick() { return userNick; }
public String getUserIdent() { return userIdent; }
@ -33,6 +35,7 @@ public class StorageFile {
public StorageFile(String serverName,
int serverPort,
String serverPass,
String[] channels,
String userNick,
String userIdent,
@ -47,6 +50,7 @@ public class StorageFile {
String chanelConfigurationsPath){
this.serverName = serverName;
this.serverPort = serverPort;
this.serverPass = serverPass;
this.channels = channels;
this.userIdent = userIdent;
this.userNick = userNick;

View file

@ -65,6 +65,7 @@ public class StorageReader {
StorageFile storageFileObject = new StorageFile("srv",
6667,
"",
new String[] {"#lpr",
"#main"},
"user_nick",

View file

@ -1,7 +1,7 @@
package InnaIrcBot;
public class GlobalData {
public static final String version = "InnaIrcBot v0.1 \"Батлкрузер\"";
public static final String version = "InnaIrcBot v0.2 \"Маньчжурия\"";
public static synchronized String getAppVersion(){
return version;
}

View file

@ -173,6 +173,8 @@ public class DataProvider implements Runnable {
StreamProvider.writeToStream(serverName,"NICK "+this.userNick);
StreamProvider.writeToStream(serverName,"USER "+configFile.getUserIdent()+" 8 * :"+configFile.getUserRealName()); // TODO: Add usermode 4 rusnet
if (!configFile.getServerPass().isEmpty())
StreamProvider.writeToStream(serverName,"PASS "+configFile.getServerPass());
if (!configFile.getUserNickPass().isEmpty() && (!configFile.getUserNickAuthStyle().isEmpty() && configFile.getUserNickAuthStyle().toLowerCase().equals("freenode")))
StreamProvider.writeToStream(serverName,"PRIVMSG NickServ :IDENTIFY "+configFile.getUserNickPass());
@ -186,6 +188,7 @@ public class DataProvider implements Runnable {
// 432 ERR_ERRONEUSNICKNAME covered
// 433 ERR_NICKNAMEINUSE covered
// 436 ERR_NICKCOLLISION
// 464 ERR_PASSWDMISMATCH (password for server/znc/bnc)
while ((rawMessage = genericStreamReader.readLine()) != null){
System.out.println(rawMessage);
if (rawMessage.startsWith("PING :")) {
@ -223,6 +226,9 @@ public class DataProvider implements Runnable {
System.out.println("Configuration issue: Nickname contains unacceptable characters (432 ERR_ERRONEUSNICKNAME).");
return false;
}
else if (rawMessage.contains(" 464 ")) {
StreamProvider.writeToStream(serverName,"PASS "+configFile.getServerPass());
}
}
} catch (IOException e){
System.out.println("Internal issue: DataProvider->initConnection() caused I/O exception.");

View file

@ -7,6 +7,7 @@ public class StorageFileTest {
StorageFile config = new StorageFile(
"",
0,
"",
null,
"",
"",