lib/protonbot/plug.rb in protonbot-0.1.3 vs lib/protonbot/plug.rb in protonbot-0.2.0
- old
+ new
@@ -32,18 +32,18 @@
# @!attribute [rw] running
# @return [Boolean] Returns `true` if bot still runs
# and processes messages from server.
# @!attribute [r] user
# @return [String] Plug's username.
-# @!attribute [r] nick
+# @!attribute [rw] nick
# @return [String] Plug's nickname.
# @!attribute [r] rnam
# @return [String] Plug's realname.
class ProtonBot::Plug
attr_reader :bot, :db, :sock, :rsock, :name, :conf, :rloop, :wloop, :log, :queue, :chans, :users,
- :event_locks, :user, :nick, :rnam, :is_ssl
- attr_accessor :running
+ :event_locks, :user, :rnam, :is_ssl
+ attr_accessor :running, :nick, :use_sasl
# @param bot [Bot]
# @param name [String]
# @param conf [Hash<String>]
def initialize(bot, name, conf)
@@ -59,9 +59,14 @@
@running = false
@queue = Queue.new
@chans = {}
@users = {}
@event_locks = []
+ if @conf['sasl'] and @conf['sasl_user'] and @conf['pass']
+ @use_sasl = true
+ else
+ @use_sasl = false
+ end
end
# Connects to server, introduces and starts reader and writer threads.
# @return [Plug] self
def connect!