Skip to content
This repository has been archived by the owner on Jul 27, 2019. It is now read-only.

Commit

Permalink
Add new bot option: ciphers
Browse files Browse the repository at this point in the history
  • Loading branch information
cnaude committed May 30, 2015
1 parent f80da5f commit 509dfcb
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Expand Up @@ -97,7 +97,7 @@
<dependency>
<groupId>com.cnaude.pircbotx</groupId>
<artifactId>pircbotx</artifactId>
<version>2.1.1</version>
<version>2.1.4</version>
</dependency>

<!-- Needed for PircBotX -->
Expand Down
12 changes: 10 additions & 2 deletions src/main/java/com/cnaude/purpleirc/PurpleBot.java
Expand Up @@ -50,6 +50,7 @@
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.locks.Lock;
Expand Down Expand Up @@ -176,6 +177,7 @@ public final class PurpleBot {
private final Lock wl;
public String sslInfo = "";
public List<String> actionCommands;
public List<String> ciphers;

/**
*
Expand Down Expand Up @@ -232,6 +234,7 @@ public PurpleBot(File file, PurpleIRC plugin) {
this.reconnectCount = 0;
this.whoisSenders = new ArrayList<>();
this.actionCommands = new ArrayList<>();
this.ciphers = new LinkedList<>();
config = new YamlConfiguration();
goodBot = loadConfig();
if (goodBot) {
Expand Down Expand Up @@ -272,6 +275,9 @@ public void buildBot(boolean reload) {
for (ListenerAdapter ll : ircListeners) {
configBuilder.addListener(ll);
}
if (!ciphers.isEmpty()) {
configBuilder.setCiphers(ciphers);
}
if (!botIdentPassword.isEmpty()) {
if (!reload) {
plugin.logInfo("Setting IdentPassword ...");
Expand All @@ -288,7 +294,7 @@ public void buildBot(boolean reload) {
plugin.logInfo("Enabling SSL and trusting all certificates ...");
socketFactory.trustAllCertificates();
} else {
plugin.logInfo("Enabling SSL ...");
plugin.logInfo("Enabling SSL ...");
}
configBuilder.setSocketFactory(socketFactory);
}
Expand Down Expand Up @@ -636,6 +642,8 @@ private boolean loadConfig() {
autoConnect = config.getBoolean("autoconnect", true);
tls = config.getBoolean("tls", false);
ssl = config.getBoolean("ssl", false);
ciphers = config.getStringList("ciphers");
plugin.logDebug("Ciphers => " + ciphers);
trustAllCerts = config.getBoolean("trust-all-certs", false);
sendRawMessageOnConnect = config.getBoolean("raw-message-on-connect", false);
rawMessage = config.getString("raw-message", "");
Expand Down Expand Up @@ -892,7 +900,7 @@ private boolean loadConfig() {
if (tabIgnoreNicks.isEmpty()) {
plugin.logInfo("Tab ignore list is empty!");
}

// build action command list
for (String name : config.getStringList("action-commands")) {
if (!actionCommands.contains(name)) {
Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/SampleBot.yml
Expand Up @@ -23,6 +23,8 @@ tls: false
ssl: false
# Trust all SSL certs
trust-all-certs: false
# Enabled ciphers - To get a list of available ciphers run "/irc test sslcpihers"
ciphers: []
# Bind address
bind: ''
# Auto split length for long messages
Expand Down

0 comments on commit 509dfcb

Please sign in to comment.