diff --git a/lib/net/imap.rb b/lib/net/imap.rb index 2940fff2a..d57c2e652 100644 --- a/lib/net/imap.rb +++ b/lib/net/imap.rb @@ -2609,8 +2609,6 @@ def remove_response_handler(handler) PORT = 143 # :nodoc: SSL_PORT = 993 # :nodoc: - @@debug = false - def start_imap_connection @greeting = get_server_greeting @capabilities = capabilities_from_resp_code @greeting @@ -2755,7 +2753,7 @@ def get_response end end return nil if buff.length == 0 - if @@debug + if config.debug? $stderr.print(buff.gsub(/^/n, "S: ")) end return @parser.parse(buff) @@ -2834,7 +2832,7 @@ def generate_tag def put_string(str) @sock.print(str) - if @@debug + if config.debug? if @debug_output_bol $stderr.print("C: ") end diff --git a/lib/net/imap/response_parser/parser_utils.rb b/lib/net/imap/response_parser/parser_utils.rb index d458ede7c..bc84bed99 100644 --- a/lib/net/imap/response_parser/parser_utils.rb +++ b/lib/net/imap/response_parser/parser_utils.rb @@ -154,7 +154,7 @@ def accept(*args) end # To be used conditionally: - # assert_no_lookahead if Net::IMAP.debug + # assert_no_lookahead if config.debug? def assert_no_lookahead @token.nil? or parse_error("assertion failed: expected @token.nil?, actual %s: %p", @@ -181,23 +181,23 @@ def lookahead!(*args) end def peek_str?(str) - assert_no_lookahead if Net::IMAP.debug + assert_no_lookahead if config.debug? @str[@pos, str.length] == str end def peek_re(re) - assert_no_lookahead if Net::IMAP.debug + assert_no_lookahead if config.debug? re.match(@str, @pos) end def accept_re(re) - assert_no_lookahead if Net::IMAP.debug + assert_no_lookahead if config.debug? re.match(@str, @pos) and @pos = $~.end(0) $~ end def match_re(re, name) - assert_no_lookahead if Net::IMAP.debug + assert_no_lookahead if config.debug? if re.match(@str, @pos) @pos = $~.end(0) $~ @@ -212,7 +212,7 @@ def shift_token def parse_error(fmt, *args) msg = format(fmt, *args) - if IMAP.debug + if config.debug? local_path = File.dirname(__dir__) tok = @token ? "%s: %p" % [@token.symbol, @token.value] : "nil" warn "%s %s: %s" % [self.class, __method__, msg]