Add (us)subscribe commands and pass sender address along.

This commit is contained in:
Martin Kamerbeek 2010-10-13 17:55:27 +02:00
parent 98ce48f827
commit 831f3ef17a

View file

@ -24,13 +24,14 @@ sub processCommand {
my $session = shift; my $session = shift;
my $command = shift; my $command = shift;
my $parameter = shift; my $parameter = shift;
my $sender = shift;
my $commandClass = resolveCommandClass( $command ) my $commandClass = resolveCommandClass( $command )
|| return; || return;
my $commandObject = WebGUI::Pluggable::instanciate( $commandClass, 'new', [ $session ] ); my $commandObject = WebGUI::Pluggable::instanciate( $commandClass, 'new', [ $session ] );
return $commandObject->process( $parameter ); return $commandObject->process( $parameter, $sender );
} }
sub session { sub session {
@ -42,7 +43,9 @@ sub resolveCommandClass {
# TODO: Do not hard code. # TODO: Do not hard code.
my %commands = ( my %commands = (
bounce => 'WebGUI::MailCommand::Bounce', unsubscribe => 'WebGUI::MailCommand::Unsubscribe',
subscribe => 'WebGUI::MailCommand::Subscribe',
bounce => 'WebGUI::MailCommand::Bounce',
); );
return $commands{ $command } if exists $commands{ $command }; return $commands{ $command } if exists $commands{ $command };