diff --git a/lib/net/imap.rb b/lib/net/imap.rb index f17122f4..4c7607c2 100644 --- a/lib/net/imap.rb +++ b/lib/net/imap.rb @@ -2545,7 +2545,8 @@ def responses(type = nil) when :raise raise ArgumentError, "Pass a block or use #clear_responses" when :warn - warn("DEPRECATED: pass a block or use #clear_responses", uplevel: 1) + warn("DEPRECATED: pass a block or use #clear_responses", + uplevel: 1, category: :deprecated) end @responses end diff --git a/lib/net/imap/authenticators.rb b/lib/net/imap/authenticators.rb index 8ecb3851..5580a335 100644 --- a/lib/net/imap/authenticators.rb +++ b/lib/net/imap/authenticators.rb @@ -9,7 +9,7 @@ def add_authenticator(...) "%s.%s is deprecated. Use %s.%s instead." % [ Net::IMAP, __method__, Net::IMAP::SASL, __method__ ], - uplevel: 1 + uplevel: 1, category: :deprecated ) Net::IMAP::SASL.add_authenticator(...) end @@ -20,7 +20,7 @@ def authenticator(...) "%s.%s is deprecated. Use %s.%s instead." % [ Net::IMAP, __method__, Net::IMAP::SASL, __method__ ], - uplevel: 1 + uplevel: 1, category: :deprecated ) Net::IMAP::SASL.authenticator(...) end diff --git a/lib/net/imap/command_data.rb b/lib/net/imap/command_data.rb index 20018b5d..71fd4d65 100644 --- a/lib/net/imap/command_data.rb +++ b/lib/net/imap/command_data.rb @@ -193,7 +193,8 @@ def validate def initialize(data) @data = data - warn "DEPRECATED: #{MessageSet} should be replaced with #{SequenceSet}." + warn("DEPRECATED: #{MessageSet} should be replaced with #{SequenceSet}.", + uplevel: 1, category: :deprecated) begin # to ensure the input works with SequenceSet, too SequenceSet.new(data) diff --git a/lib/net/imap/deprecated_client_options.rb b/lib/net/imap/deprecated_client_options.rb index 1a0fe298..1242bed6 100644 --- a/lib/net/imap/deprecated_client_options.rb +++ b/lib/net/imap/deprecated_client_options.rb @@ -83,10 +83,12 @@ def initialize(host, port_or_options = nil, *deprecated, **options) elsif deprecated.empty? super host, port: port_or_options elsif deprecated.shift - warn "DEPRECATED: Call Net::IMAP.new with keyword options", uplevel: 1 + warn("DEPRECATED: Call Net::IMAP.new with keyword options", + uplevel: 1, category: :deprecated) super host, port: port_or_options, ssl: create_ssl_params(*deprecated) else - warn "DEPRECATED: Call Net::IMAP.new with keyword options", uplevel: 1 + warn("DEPRECATED: Call Net::IMAP.new with keyword options", + uplevel: 1, category: :deprecated) super host, port: port_or_options, ssl: false end end @@ -113,7 +115,8 @@ def starttls(*deprecated, **options) elsif deprecated.first.respond_to?(:to_hash) super(**Hash.try_convert(deprecated.first)) else - warn "DEPRECATED: Call Net::IMAP#starttls with keyword options", uplevel: 1 + warn("DEPRECATED: Call Net::IMAP#starttls with keyword options", + uplevel: 1, category: :deprecated) super(**create_ssl_params(*deprecated)) end end diff --git a/lib/net/imap/response_data.rb b/lib/net/imap/response_data.rb index 808da9c4..25c1d42c 100644 --- a/lib/net/imap/response_data.rb +++ b/lib/net/imap/response_data.rb @@ -939,7 +939,8 @@ def multipart? # for something else? #++ def media_subtype - warn("media_subtype is obsolete, use subtype instead.\n", uplevel: 1) + warn("media_subtype is obsolete, use subtype instead.\n", + uplevel: 1, category: :deprecated) return subtype end end @@ -984,7 +985,8 @@ def multipart? # generate a warning message to +stderr+, then return # the value of +subtype+. def media_subtype - warn("media_subtype is obsolete, use subtype instead.\n", uplevel: 1) + warn("media_subtype is obsolete, use subtype instead.\n", + uplevel: 1, category: :deprecated) return subtype end end @@ -1111,7 +1113,8 @@ def multipart? # generate a warning message to +stderr+, then return # the value of +subtype+. def media_subtype - warn("media_subtype is obsolete, use subtype instead.\n", uplevel: 1) + warn("media_subtype is obsolete, use subtype instead.\n", + uplevel: 1, category: :deprecated) return subtype end end diff --git a/lib/net/imap/sasl/cram_md5_authenticator.rb b/lib/net/imap/sasl/cram_md5_authenticator.rb index 4f33ecc3..df2648da 100644 --- a/lib/net/imap/sasl/cram_md5_authenticator.rb +++ b/lib/net/imap/sasl/cram_md5_authenticator.rb @@ -20,7 +20,7 @@ def initialize(user = nil, pass = nil, warn_deprecation: true, **) if warn_deprecation - warn "WARNING: CRAM-MD5 mechanism is deprecated." # TODO: recommend SCRAM + warn "WARNING: CRAM-MD5 mechanism is deprecated.", category: :deprecated end require "digest/md5" @user = authcid || username || user diff --git a/lib/net/imap/sasl/digest_md5_authenticator.rb b/lib/net/imap/sasl/digest_md5_authenticator.rb index 1b07c411..13a2fd35 100644 --- a/lib/net/imap/sasl/digest_md5_authenticator.rb +++ b/lib/net/imap/sasl/digest_md5_authenticator.rb @@ -161,7 +161,8 @@ def initialize(user = nil, pass = nil, authz = nil, password ||= secret || pass or raise ArgumentError, "missing password" authzid ||= authz if warn_deprecation - warn "WARNING: DIGEST-MD5 SASL mechanism was deprecated by RFC6331." + warn("WARNING: DIGEST-MD5 SASL mechanism was deprecated by RFC6331.", + category: :deprecated) end require "digest/md5" diff --git a/lib/net/imap/sasl/login_authenticator.rb b/lib/net/imap/sasl/login_authenticator.rb index 7496793d..a9686fbe 100644 --- a/lib/net/imap/sasl/login_authenticator.rb +++ b/lib/net/imap/sasl/login_authenticator.rb @@ -29,7 +29,8 @@ def initialize(user = nil, pass = nil, warn_deprecation: true, **) if warn_deprecation - warn "WARNING: LOGIN SASL mechanism is deprecated. Use PLAIN instead." + warn "WARNING: LOGIN SASL mechanism is deprecated. Use PLAIN instead.", + category: :deprecated end @user = authcid || username || user @password = password || secret || pass