[Rt-commit] r7513 - in rt/branches/3.7-EXPERIMENTAL: .

ruz at bestpractical.com ruz at bestpractical.com
Mon Apr 16 09:01:55 EDT 2007


Author: ruz
Date: Mon Apr 16 09:01:55 2007
New Revision: 7513

Modified:
   rt/branches/3.7-EXPERIMENTAL/   (props changed)
   rt/branches/3.7-EXPERIMENTAL/lib/RT/Interface/Email.pm

Log:
 r4933 at cubic-pc:  cubic | 2007-04-13 00:11:17 +0400
 * add new function that deletes list of addresses from a message


Modified: rt/branches/3.7-EXPERIMENTAL/lib/RT/Interface/Email.pm
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL/lib/RT/Interface/Email.pm	(original)
+++ rt/branches/3.7-EXPERIMENTAL/lib/RT/Interface/Email.pm	Mon Apr 16 09:01:55 2007
@@ -665,6 +665,25 @@
     return ( $Address, $Name );
 }
 
+=head2 DeleteRecipientsFromHead HEAD RECIPIENTS
+
+Gets a head object and list of addresses.
+Deletes addresses from To, Cc or Bcc fields.
+
+=cut
+
+sub DeleteRecipientsFromHead {
+    my $head = shift;
+    my %skip = map { lc $_ => 1 } @_;
+
+    foreach my $field ( qw(To Cc Bcc) ) {
+        $head->set( $field =>
+            join ', ', map $_->format, grep !$skip{ lc $_->address },
+                Mail::Address->parse( $head->get( $field ) )
+        );
+    }
+}
+
 
 
 sub ParseTicketId {


More information about the Rt-commit mailing list