Commit 649a0bcc authored by IKEDA Soji's avatar IKEDA Soji

tyidyall

parent 69c9e749
......@@ -969,12 +969,11 @@ our @params = (
'message_header,message_header.mime,message_footer,message_footer.mime,info',
'vhost' => '1',
},
{
'name' => 'family_signoff',
{ 'name' => 'family_signoff',
'gettext_id' => 'Global unsubscription',
'default' => 'auth', # Compat. to <=6.2.52
'scenario' => 1,
'vhost' => '1',
'default' => 'auth', # Compat. to <=6.2.52
'scenario' => 1,
'vhost' => '1',
},
{'gettext_id' => 'Tag based spam filtering'},
......
......@@ -356,7 +356,7 @@ sub get_uncompellable_param {
# OUT : -directory name or undef if the directory does not exist
sub _get_directory {
$log->syslog('debug3', '(%s)', @_);
my $self = shift;
my $self = shift;
my $name = $self->{'name'};
my $robot = $self->{'domain'};
......
......@@ -647,8 +647,7 @@ sub check_dkim_signature {
return unless $Mail::DKIM::Verifier::VERSION;
my $robot_id =
(ref $self->{context} eq 'Sympa::List')
? $self->{context}->{'domain'}
(ref $self->{context} eq 'Sympa::List') ? $self->{context}->{'domain'}
: (ref $self->{context} eq 'Sympa::Family')
? $self->{context}->{'domain'}
: $self->{context};
......@@ -1575,9 +1574,9 @@ sub personalize_text {
my $listname = $list->{'name'};
my $robot_id = $list->{'domain'};
$data->{'listname'} = $listname;
$data->{'domain'} = $robot_id;
$data->{'robot'} = $data->{'domain'}; # Compat.<=6.2.52.
$data->{'listname'} = $listname;
$data->{'domain'} = $robot_id;
$data->{'robot'} = $data->{'domain'}; # Compat.<=6.2.52.
$data->{'wwsympa_url'} = Conf::get_robot_conf($robot_id, 'wwsympa_url');
my $message_output;
......@@ -2096,7 +2095,9 @@ sub _urlize_parts {
## Only multipart/mixed messages are modified.
my $eff_type = $entity->effective_type || 'text/plain';
unless ($eff_type eq 'multipart/mixed' or $eff_type eq 'multipart/alternative' or $eff_type eq 'multipart/related') {
unless ($eff_type eq 'multipart/mixed'
or $eff_type eq 'multipart/alternative'
or $eff_type eq 'multipart/related') {
return undef;
}
......@@ -2121,23 +2122,34 @@ sub _urlize_sub_parts {
my $entity = shift;
my $list = shift;
my $message_id = shift;
my $directory = shift;
my $i = shift;
my @parts = ();
my $directory = shift;
my $i = shift;
my @parts = ();
use Data::Dumper;
my $parent_eff_type = $entity->effective_type();
foreach my $part ($entity->parts) {
my $eff_type = $part->effective_type || 'text/plain';
if ($eff_type eq 'multipart/mixed') {
$i++;
my $p = _urlize_sub_parts($part->dup, $list, $message_id, $directory, $i);
my $p =
_urlize_sub_parts($part->dup, $list, $message_id, $directory,
$i);
push @parts, $p;
} elsif (($eff_type eq 'multipart/alternative' or $eff_type eq 'multipart/related') and $i < 2) {
} elsif (
( $eff_type eq 'multipart/alternative'
or $eff_type eq 'multipart/related'
)
and $i < 2
) {
$i++;
my $p = _urlize_sub_parts($part->dup, $list, $message_id, $directory, $i);
my $p =
_urlize_sub_parts($part->dup, $list, $message_id, $directory,
$i);
push @parts, $p;
} else {
my $p = _urlize_one_part($part->dup, $list, $directory, $i, $parent_eff_type);
my $p = _urlize_one_part($part->dup, $list, $directory, $i,
$parent_eff_type);
if (defined $p) {
push @parts, $p;
$i++;
......@@ -2146,18 +2158,18 @@ sub _urlize_sub_parts {
}
}
}
$entity->parts(\@parts);
return $entity;
}
sub _urlize_one_part {
my $entity = shift;
my $list = shift;
my $dir = shift;
my $i = shift;
my $parent_eff_type = shift;
my $entity = shift;
my $list = shift;
my $dir = shift;
my $i = shift;
my $parent_eff_type = shift;
return undef unless ($parent_eff_type eq 'multipart/mixed');
my $expl = $list->{'dir'} . '/urlized';
......@@ -2173,13 +2185,13 @@ sub _urlize_one_part {
$filename = Encode::encode_utf8($filename)
if Encode::is_utf8($filename);
} else {
my $content_disposition = lc($entity->head->mime_attr('Content-Disposition') // '');
my $content_disposition =
lc($entity->head->mime_attr('Content-Disposition') // '');
if ($entity->effective_type =~ m{\Atext}
&& (!$content_disposition
|| $content_disposition eq 'attachment'
)
&& ( !$content_disposition
|| $content_disposition eq 'attachment')
&& $entity->head->mime_attr('content-type.charset')
){
) {
return undef;
}
my $fileExt = Conf::get_mime_type($entity->effective_type || '')
......
......@@ -175,9 +175,7 @@ sub new {
$data->{'list'}{'domain'} = $list->{'domain'};
$data->{'list'}{'host'} = $list->{'domain'};
} elsif ($family) {
$data->{family} = {
name => $family->{'name'},
};
$data->{family} = {name => $family->{'name'},};
}
# Sign mode
......
......@@ -567,7 +567,8 @@ sub _compile_scenario {
my $required = join "\n", map {
my $req;
if ($_ eq 'list_object') {
$req = 'die "No list context" unless ref $that eq \'Sympa::List\';';
$req =
'die "No list context" unless ref $that eq \'Sympa::List\';';
} elsif ($_ eq 'message') {
$req = '$context->{message} ||= Sympa::Message->new("\n");';
} else {
......@@ -671,7 +672,8 @@ sub _compile_condition {
$log->syslog('err', 'Bad regexp /%s/: %s', $re, $EVAL_ERROR);
return undef;
}
$value = sprintf 'Sympa::Scenario::safe_qr(\'%s\', $context)', $re;
$value = sprintf 'Sympa::Scenario::safe_qr(\'%s\', $context)',
$re;
} elsif ($value =~ /\[custom_vars\-\>([\w\-]+)\]/i) {
# Custom vars
$value = sprintf '$context->{custom_vars}{\'%s\'}', $1;
......@@ -766,11 +768,13 @@ sub _compile_condition {
## available.
if (defined $index) {
$value =
sprintf 'do { my @h = $context->{message}->get_header(\'%s\'); $h[%s] // \'\' }',
sprintf
'do { my @h = $context->{message}->get_header(\'%s\'); $h[%s] // \'\' }',
$field_name, $index;
} else {
$value =
sprintf 'do { my @h = $context->{message}->get_header(\'%s\'); @h ? [@h] : [\'\'] }',
sprintf
'do { my @h = $context->{message}->get_header(\'%s\'); @h ? [@h] : [\'\'] }',
$field_name;
}
$required_keys{message} = 1;
......
......@@ -263,8 +263,13 @@ sub _twist {
$log->syslog('err', 'Cannot create dynamic list %s', $listname);
return undef;
} elsif (
not( $spindle_req->success
and $list = Sympa::List->new($listname, $dyn_family->{'domain'}, {just_try => 1}))
not($spindle_req->success
and $list = Sympa::List->new(
$listname,
$dyn_family->{'domain'},
{just_try => 1}
)
)
) {
$log->syslog('err',
'Unable to create list %s. Message %s ignored',
......
......@@ -370,7 +370,7 @@ sub _url_func {
my $that = $self->{context};
my $robot_id =
(ref $that eq 'Sympa::List') ? $that->{'domain'}
(ref $that eq 'Sympa::List') ? $that->{'domain'}
: (ref $that eq 'Sympa::Family') ? $that->{'domain'}
: ($that and $that ne '*') ? $that
: '*';
......
......@@ -10,9 +10,7 @@ use Test::More;
use Sympa::Log;
use Sympa::Message;
%Conf::Conf = (
sender_headers => 'From',
);
%Conf::Conf = (sender_headers => 'From',);
Sympa::Log->instance->{log_to_stderr} = 'err';
......@@ -26,7 +24,7 @@ Sympa::Log->instance->{log_to_stderr} = 'err';
# is_signed()
is test_is_signed('t/samples/unsigned.eml'), 0, 'never signed';
is test_is_signed('t/samples/signed.eml'), 1, 'multipart/signed S/MIME';
is test_is_signed('t/samples/signed.eml'), 1, 'multipart/signed S/MIME';
#is test_is_signed('t/samples/signed-pkcs7.eml'), 1, 'PKCS#7 S/MIME';
#is test_is_signed('t/samples/signed-pgp.eml'), 0, 'multipart/signed PGP/MIME';
#is test_is_signed('t/samples/signed-pgp-inline.eml'), 0, 'PGP inline';
......
This diff is collapsed.
......@@ -49,5 +49,10 @@ is $dec, $unicode_email, 'decode_filesystem_safe, Unicode';
# ToDo: wrap_text()
# Noncharacters: U+d800, U+10FFE, U+110000, U+200000
is Sympa::Tools::Text::canonic_text("\xED\xA0\x80\n\xF4\x8F\xBF\xBE\n\xF4\x90\x80\x80\n\xF8\x88\x80\x80\x80\n"), Encode::encode_utf8("\x{FFFD}\x{FFFD}\x{FFFD}\n\x{FFFD}\n\x{FFFD}\x{FFFD}\x{FFFD}\x{FFFD}\n\x{FFFD}\x{FFFD}\x{FFFD}\x{FFFD}\x{FFFD}\n");
is Sympa::Tools::Text::canonic_text(
"\xED\xA0\x80\n\xF4\x8F\xBF\xBE\n\xF4\x90\x80\x80\n\xF8\x88\x80\x80\x80\n"
),
Encode::encode_utf8(
"\x{FFFD}\x{FFFD}\x{FFFD}\n\x{FFFD}\n\x{FFFD}\x{FFFD}\x{FFFD}\x{FFFD}\n\x{FFFD}\x{FFFD}\x{FFFD}\x{FFFD}\x{FFFD}\n"
);
Markdown is supported
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