File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -64,7 +64,7 @@ def names; @authenticators.keys end
6464 # When only a single argument is given, the authenticator class will be
6565 # lazily loaded from <tt>Net::IMAP::SASL::#{name}Authenticator</tt> (case is
6666 # preserved and non-alphanumeric characters are removed..
67- def add_authenticator ( name , authenticator = nil )
67+ def add_authenticator ( name , authenticator = nil , warn_overwrite : true )
6868 key = name . upcase . to_sym
6969 authenticator ||= begin
7070 class_name = "#{ name . gsub ( /[^a-zA-Z0-9]/ , "" ) } Authenticator" . to_sym
@@ -74,6 +74,11 @@ def add_authenticator(name, authenticator = nil)
7474 auth_class . new ( *creds , **props , &block )
7575 }
7676 end
77+ if warn_overwrite && ( original = @authenticators [ key ] )
78+ warn ( "%p: replacing existing %p authenticator: %p" % [
79+ self , key , original
80+ ] , uplevel : 1 )
81+ end
7782 @authenticators [ key ] = authenticator
7883 end
7984
You can’t perform that action at this time.
0 commit comments