Add Qpsmtpd::Transaction::remove_recipient()

Add remove_recipient() to Qpsmtpd::Transaction, a counterpart to
add_recipient().

Signed-off-by: Ask Bjørn Hansen <ask@develooper.com>
This commit is contained in:
jaredj 2009-02-25 07:44:50 -06:00 committed by Ask Bjørn Hansen
parent c5af5caa00
commit 2e552d2297
2 changed files with 15 additions and 0 deletions

View File

@ -1,3 +1,5 @@
Add remove_recipient method to the transaction object (Jared Johnson)
0.80 - February 27, 2009 0.80 - February 27, 2009
moved development to git repository! moved development to git repository!

View File

@ -27,6 +27,12 @@ sub add_recipient {
@_ and push @{$self->{_recipients}}, shift; @_ and push @{$self->{_recipients}}, shift;
} }
sub remove_recipient {
my ($self,$rcpt) = @_;
$self->{_recipients} = [grep {$_->address ne $rcpt->address}
@{$self->{_recipients} || []}] if $rcpt;
}
sub recipients { sub recipients {
my $self = shift; my $self = shift;
@_ and $self->{_recipients} = [@_]; @_ 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<Qpsmtpd::Address> object. See L<Qpsmtpd::Address> The C<$recipient> is a C<Qpsmtpd::Address> object. See L<Qpsmtpd::Address>
for more details. 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<Qpsmtpd::Address> object. See L<Qpsmtpd::Address>
for more details.
=head2 recipients( ) =head2 recipients( )
This returns a list of the current recipients in the envelope. This returns a list of the current recipients in the envelope.