From 2e552d2297eb0d4a4c6872a433fdbb4887275c78 Mon Sep 17 00:00:00 2001 From: jaredj Date: Wed, 25 Feb 2009 07:44:50 -0600 Subject: [PATCH] Add Qpsmtpd::Transaction::remove_recipient() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add remove_recipient() to Qpsmtpd::Transaction, a counterpart to add_recipient(). Signed-off-by: Ask Bjørn Hansen --- Changes | 2 ++ lib/Qpsmtpd/Transaction.pm | 13 +++++++++++++ 2 files changed, 15 insertions(+) diff --git a/Changes b/Changes index a9a3659..f4aadff 100644 --- a/Changes +++ b/Changes @@ -1,3 +1,5 @@ + Add remove_recipient method to the transaction object (Jared Johnson) + 0.80 - February 27, 2009 moved development to git repository! diff --git a/lib/Qpsmtpd/Transaction.pm b/lib/Qpsmtpd/Transaction.pm index c8ed194..840e0e4 100644 --- a/lib/Qpsmtpd/Transaction.pm +++ b/lib/Qpsmtpd/Transaction.pm @@ -27,6 +27,12 @@ sub add_recipient { @_ and push @{$self->{_recipients}}, shift; } +sub remove_recipient { + my ($self,$rcpt) = @_; + $self->{_recipients} = [grep {$_->address ne $rcpt->address} + @{$self->{_recipients} || []}] if $rcpt; +} + sub recipients { my $self = shift; @_ and $self->{_recipients} = [@_]; @@ -273,6 +279,13 @@ This adds a new recipient (as in RCPT TO) to the envelope of the mail. The C<$recipient> is a C object. See L for more details. +=head2 remove_recipient($recipient) + +This removes a recipient (as in RCPT TO) from the envelope of the mail. + +The C<$recipient> is a C object. See L +for more details. + =head2 recipients( ) This returns a list of the current recipients in the envelope.