Skip to content

Commit 696376e

Browse files
committed
Make list of SASL mechanisms configurable
1 parent e860fc7 commit 696376e

File tree

3 files changed

+15
-2
lines changed

3 files changed

+15
-2
lines changed

docs/bot_options.md

+11
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,17 @@ Default value
320320
Description
321321
: The password to use for SASL authentication.
322322

323+
### sasl.mechanisms
324+
Type
325+
: Array<Cinch::SASL::Mechanism>
326+
327+
Default value
328+
: `[Cinch::SASL::DH_Blowfish, Cinch::SASL::Plain]`
329+
330+
Description
331+
: The SASL mechanisms to use. All mechanisms in the array will be
332+
attempted, until one was successful
333+
323334
## server
324335
Type
325336
: String

lib/cinch/configuration/sasl.rb

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
11
require "cinch/configuration"
2+
require "cinch/sasl"
23

34
module Cinch
45
class Configuration
56
# @since 2.0.0
67
class SASL < Configuration
7-
KnownOptions = [:username, :password]
8+
KnownOptions = [:username, :password, :mechanisms]
89

910
def self.default_config
1011
{
1112
:username => nil,
1213
:password => nil,
14+
:mechanisms => [Cinch::SASL::DH_Blowfish, Cinch::SASL::Plain]
1315
}
1416
end
1517
end

lib/cinch/irc.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ def send_sasl
210210
def start
211211
setup
212212
if connect
213-
@sasl_remaining_methods = [SASL::Plain, SASL::DH_Blowfish]
213+
@sasl_remaining_methods = @bot.config.sasl.mechanisms.reverse
214214
send_cap_ls
215215
send_login
216216

0 commit comments

Comments
 (0)