From d9cf61175ad571b6acce682c618f051b30ff1c2b Mon Sep 17 00:00:00 2001 From: Jared Johnson Date: Fri, 20 Feb 2009 07:45:03 -0600 Subject: [PATCH] Add Qpsmtpd::Address::notes() method MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Qpsmtpd Connection and Transaction objects support notes() methods which are conventionally used to pass data between plugins. This adds the same functionality to Address objects. This should make it easier for plugins to begin supporting message handling based on per-user configuration directives. Signed-off-by: Ask Bjørn Hansen --- Changes | 2 ++ lib/Qpsmtpd/Address.pm | 15 +++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/Changes b/Changes index f4aadff..3bbf0b7 100644 --- a/Changes +++ b/Changes @@ -1,3 +1,5 @@ + Add notes method to Qpsmtpd::Address objects (Jared Johnson) + Add remove_recipient method to the transaction object (Jared Johnson) 0.80 - February 27, 2009 diff --git a/lib/Qpsmtpd/Address.pm b/lib/Qpsmtpd/Address.pm index 71558bd..1db3e06 100644 --- a/lib/Qpsmtpd/Address.pm +++ b/lib/Qpsmtpd/Address.pm @@ -317,6 +317,21 @@ sub host { return $self->{_host}; } +=head2 notes($key[,$value]) + +Get or set a note on the address. This is a piece of data that you wish +to attach to the address and read somewhere else. For example you can +use this to pass data between plugins. + +=cut + +sub notes { + my ($self,$key) = (shift,shift); + # Check for any additional arguments passed by the caller -- including undef + return $self->{_notes}->{$key} unless @_; + return $self->{_notes}->{$key} = shift; +} + sub _addr_cmp { require UNIVERSAL; my ($left, $right, $swap) = @_;