<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -1,44 +1,51 @@
 module ActionMailer
   class Base
-    alias_method :deliver_without_blacklisting, :deliver!
-
     def self.filter_blacklisted(level = nil)
-      self.send(:include, BouncesHandlerInstanceMethods)
       define_method(:blacklist_level) { level }
     end
 
     module BouncesHandlerInstanceMethods
-      def deliver!(mail = @mail)
-        # Cleanup all headers used for recepients specification
-        if mail
-          [ :to, :cc, :bcc ].each do |header|
-            blacklist_cleanup_header(mail, header)
+      def self.included(base)
+        base.class_eval do
+          alias_method :deliver_without_blacklisting, :deliver!
+
+          def deliver!(mail = @mail)
+            return deliver_without_blacklisting(mail) unless defined? blacklist_level
+
+            # Cleanup all headers used for recepients specification
+            if mail
+              [ :to, :cc, :bcc ].each do |header|
+                blacklist_cleanup_header(mail, header)
+              end
+
+              # Do not send this email if the destination list is empty
+              return mail if !mail.destinations || mail.destinations.empty?
+            end
+
+            deliver_without_blacklisting(mail)
           end
-          # Do not send this email if the destination list is empty
-          return mail if !mail.destinations || mail.destinations.empty?
-        end
-        
-        deliver_without_blacklisting(mail)
-      end
 
-    private
-    
-      def blacklist_cleanup_header(mail, header_name)
-        # Get addrs list from a header
-        orig_addrs = mail.send(&quot;#{header_name}_addrs&quot;.to_sym)
-        return unless orig_addrs
-
-        # Clean them up (can't use delete_if for AddressGroups)
-        res_addrs = []
-        orig_addrs.each do |addr|
-          next if MailingBlacklist.banned?(addr.spec, blacklist_level)
-          res_addrs &lt;&lt; addr
-        end
-        
-        # Assign addrs list back
-        mail.send(&quot;#{header_name}_addrs=&quot;.to_sym, res_addrs)
+          private
+
+          def blacklist_cleanup_header(mail, header_name)
+            # Get addrs list from a header
+            orig_addrs = mail.send(&quot;#{header_name}_addrs&quot;.to_sym)
+            return unless orig_addrs
+
+            # Clean them up (can't use delete_if for AddressGroups)
+            res_addrs = []
+            orig_addrs.each do |addr|
+              next if MailingBlacklist.banned?(addr.spec, blacklist_level)
+              res_addrs &lt;&lt; addr
+            end
+
+            # Assign addrs list back
+            mail.send(&quot;#{header_name}_addrs=&quot;.to_sym, res_addrs)
+          end
+        end    
       end
-    
-    end    
+    end
   end
 end
+
+ActionMailer::Base.send(:include, ActionMailer::Base::BouncesHandlerInstanceMethods)</diff>
      <filename>rails-plugin/extensions/action_mailer.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>b9bd9fdc8f4fb7f95faa5d3921d422aedae4d94c</id>
    </parent>
  </parents>
  <author>
    <name>Alexey Kovyrin</name>
    <email>alexey@kovyrin.net</email>
  </author>
  <url>http://github.com/kovyrin/bounces-handler/commit/938af7cec1b4f5e5c9c6c5cfb6902002f4e7ef60</url>
  <id>938af7cec1b4f5e5c9c6c5cfb6902002f4e7ef60</id>
  <committed-date>2009-09-29T21:03:46-07:00</committed-date>
  <authored-date>2009-09-29T21:03:46-07:00</authored-date>
  <message>Fix from Brian Woods: The plugin would hijack instances where someone else aliased deliver! in ActionMailer</message>
  <tree>6da45c6e5c3cef548b482ee4d43e0d1540d22857</tree>
  <committer>
    <name>Alexey Kovyrin</name>
    <email>alexey@kovyrin.net</email>
  </committer>
</commit>
