42 |
|
|
43 |
$self->{config} = new Config::IniFiles( -file => $config_file ); |
$self->{config} = new Config::IniFiles( -file => $config_file ); |
44 |
|
|
45 |
my $index_file = $self->{config}->val('global', 'index') || croak "can't find [index] section in config file with path of index"; |
$self->{config_file} = $config_file; |
46 |
|
$config_file =~ s/\.conf.*$//; |
47 |
|
$self->{config_name} = $config_file; |
48 |
|
|
49 |
|
my $index_dir = $self->{config}->val('global', 'index') || croak "can't find [index] section in config file with path of index"; |
50 |
|
|
51 |
$self->{mgr} = Mail::Box::Manager->new(access => 'r'); |
$self->{mgr} = Mail::Box::Manager->new(access => 'r'); |
52 |
$self->{index_file} = $index_file; |
$self->{index_dir} = $index_dir; |
53 |
|
|
54 |
# placeholder for opened folders |
# placeholder for opened folders |
55 |
$self->{folder} = {}; |
$self->{folder} = {}; |
334 |
} |
} |
335 |
} |
} |
336 |
|
|
337 |
|
if (! $body) { |
338 |
|
$body = "[plain/text body not found]" if ($debug == 2); |
339 |
|
print STDERR "plain/text body not found\n" if ($debug); |
340 |
|
return; |
341 |
|
} |
342 |
|
|
343 |
# reformat with Text::Autoformat |
# reformat with Text::Autoformat |
344 |
my $wrap = $self->{wrap_margin}; |
my $wrap = $self->{wrap_margin}; |
345 |
if ($wrap && $body && $body =~ m/^.{$wrap}..*$/m) { |
if ($wrap && $body && $body =~ m/^.{$wrap}..*$/m) { |
|
$body =~ s/[\r\n]/\n/gs; |
|
346 |
$body = autoformat($body, {right=>$wrap, all=>1}); |
$body = autoformat($body, {right=>$wrap, all=>1}); |
347 |
$body .="\n[reformated using autoformat, margin at $wrap]" if ($debug == 2); |
$body .="\n[reformated using autoformat, margin at $wrap]" if ($debug == 2); |
348 |
} |
} |