Add notes to Qpsmtpd::Address class

standardize other notes calls
This commit is contained in:
Jared Johnson 2009-01-10 08:58:37 -06:00 committed by Robert
parent 815c6d8223
commit ea86b9fdb2
3 changed files with 23 additions and 10 deletions

View File

@ -317,6 +317,20 @@ sub host {
return $self->{_host}; return $self->{_host};
} }
=head2 notes($key[,$value])
Get or set a note on the recipient. This is a piece of data that you wish
to attach to the recipient and read somewhere else. For example you can
use this to pass data between plugins.
=cut
sub notes {
my ($self,$key,$value) = @_;
$self->{_notes}->{$key} = $value if defined $value;
return $self->{_notes}->{$key};
}
sub _addr_cmp { sub _addr_cmp {
require UNIVERSAL; require UNIVERSAL;
my ($left, $right, $swap) = @_; my ($left, $right, $swap) = @_;

View File

@ -108,10 +108,9 @@ sub hello_host {
} }
sub notes { sub notes {
my $self = shift; my ($self,$key,$value) = @_;
my $key = shift; $self->{_notes}->{$key} = $value if defined $value;
@_ and $self->{_notes}->{$key} = shift; return $self->{_notes}->{$key};
$self->{_notes}->{$key};
} }
sub reset { sub reset {
@ -200,7 +199,9 @@ set after a successful return from those hooks.
=head2 notes($key [, $value]) =head2 notes($key [, $value])
Connection-wide notes, used for passing data between plugins. Get or set a note on the transaction. This is a piece of data that you wish
to attach to the transaction and read somewhere else. For example you can
use this to pass data between plugins.
=head2 clone([%args]) =head2 clone([%args])

View File

@ -55,11 +55,9 @@ sub header {
#} #}
sub notes { sub notes {
my $self = shift; my ($self,$key,$value) = @_;
my $key = shift; $self->{_notes}->{$key} = $value if defined $value;
@_ and $self->{_notes}->{$key} = shift; return $self->{_notes}->{$key};
#warn Data::Dumper->Dump([\$self->{_notes}], [qw(notes)]);
$self->{_notes}->{$key};
} }
sub set_body_start { sub set_body_start {