Commit 376089d2 authored by sikeda's avatar sikeda
Browse files

[-dev] Give appropriate command line in command report.


git-svn-id: https://subversion.renater.fr/sympa/branches/sympa-6.2-branch@12746 05aa8bb8-cd2b-0410-b1d7-8918dfa770ce
parent 28469b12
......@@ -28,6 +28,7 @@ use strict;
use warnings;
use Scalar::Util qw();
use Sympa::CommandDef;
use Sympa::Log;
use Sympa::Tools::Data;
use Sympa::Tools::Text;
......@@ -105,6 +106,23 @@ sub new_from_tuples {
return $class->new('', %options);
}
sub cmd_line {
my $self = shift;
return $self->{cmd_line} if $self->{cmd_line};
return undef
if not $self->{action}
or $self->{action} eq 'unknown';
my $cmd_format = $Sympa::CommandDef::comms{$self->{action}}->{cmd_format};
my $arg_keys = $Sympa::CommandDef::comms{$self->{action}}->{arg_keys};
return undef
unless $cmd_format;
return sprintf $cmd_format,
map { defined $_ ? $_ : '' } @{$self}{@{$arg_keys || []}};
}
sub dup {
my $self = shift;
......@@ -254,6 +272,16 @@ Gets deep copy of instance.
I<Serializer>.
Returns serialized data of object.
=item cmd_line ( )
I<Instance method>.
TBD.
=item get_id ( )
I<Instance method>.
Gets unique identifier of instance.
=back
=head2 Context and metadata
......
......@@ -91,10 +91,8 @@ sub _load {
# FIXME: at this point $message->{'dkim_pass'} does not verify that
# Subject: is part of the signature. It SHOULD !
return [
Sympa::Request->new_from_tuples(
Sympa::Request->new(
action => $action,
cmd_line =>
sprintf('%s %s', $message->{listtype}, $list->{'name'}),
context => $list,
email => $message->{sender},
#FIXME: smime_signed?
......@@ -158,7 +156,6 @@ sub _parse {
if ($req->{action} eq 'auth') {
$request->{error} = 'syntax_errors';
} elsif ($req->{action} eq 'unknown' or $req->{error}) {
$req->{cmd_line} = $request->{cmd_line};
$request = $req;
} else {
$request->{request} = $req;
......
......@@ -1512,7 +1512,7 @@ sub subscribe {
}
# Send notice to the user.
my $cmd_line = $request->{cmd_line};
my $cmd_line = $request->cmd_line;
unless (
Sympa::send_file(
$list,
......
......@@ -221,7 +221,7 @@ sub _send_report {
}
$data{type} = $type;
$data{cmd} = $request->{cmd_line};
$data{cmd} = $request->cmd_line;
$data{email} ||= $request->{email};
$data{entry} = ($type eq 'intern') ? 'intern_error' : ($error || '');
my $that = $request->{context};
......
......@@ -54,7 +54,7 @@ sub _twist {
}
# Send notice to the user.
my $cmd_line = $request->{cmd_line};
my $cmd_line = $request->cmd_line;
unless (
Sympa::send_file(
$that,
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment