#!/usr/bin/perl use strict; use warnings; =head1 NAME address_notes - add a notes method to Qpsmtpd::Address =head1 DESCRIPTION This plugin adds a notes method to the Qpsmtpd::Address class. This allows arbitrary data to be attached to an address similar to the connection and transaction notes. One possible use would be to use it to pass per-recipient configuration between plugins. =head2 $address->notes([$key [, $value]]) The notes method can be called with 0, 1, or 2 parameters. If both a key and a value is given, the note with the given key is set to the given value. If only a key is given, the note with this key is returned. If neither is given, a list of keys is returned. =cut package Qpsmtpd::Address; use Qpsmtpd::Constants; sub notes { my $self = shift; if (@_) { my $c = shift; if (@_) { $self->{notes}{$c} = $_[0]; } else { return $self->{notes}{$c}; } } else { if ($self->{notes}) { return keys %{ $self->{notes} }; } else { return (); } } }