114 |
sub add_counter_calendar($) { |
sub add_counter_calendar($) { |
115 |
my $self = shift; |
my $self = shift; |
116 |
|
|
117 |
my $t = shift || croak "add_counter_calendar without argument!"; |
my $t = shift || return; |
118 |
|
|
119 |
my ($yyyy,$mm,$dd) = $self->fmtdate($self->yyyymmdd($t)); |
my ($yyyy,$mm,$dd) = $self->fmtdate($self->yyyymmdd($t)); |
120 |
|
|
150 |
|
|
151 |
print STDERR "about to open_folder($mbox)\n" if ($debug == 2); |
print STDERR "about to open_folder($mbox)\n" if ($debug == 2); |
152 |
|
|
153 |
$self->{folder}->{$mbox} = $self->{mgr}->open($mbox_path) || croak "can't open folder $mbox at '$mbox_path': $!"; |
my $folder; |
154 |
|
|
155 |
|
# is this maildir (no locking anyway) |
156 |
|
if (-d $mbox_path) { |
157 |
|
$folder = $self->{mgr}->open($mbox_path); |
158 |
|
} else { |
159 |
|
$folder = $self->{mgr}->open($mbox_path, lock_type=>'none' ); |
160 |
|
} |
161 |
|
|
162 |
|
$self->{folder}->{$mbox} = $folder || croak "can't open folder $mbox at '$mbox_path': $!"; |
163 |
|
|
164 |
print STDERR "open_folder($mbox) ok\n" if ($debug); |
print STDERR "open_folder($mbox) ok\n" if ($debug); |
165 |
} |
} |
254 |
|
|
255 |
print STDERR "$qp\n" if ($debug == 2); |
print STDERR "$qp\n" if ($debug == 2); |
256 |
|
|
257 |
my $iconv = Text::Iconv->new($cp,'ISO-8859-2'); |
my $iconv; |
258 |
return $iconv->convert($qp) || ''; |
eval '$iconv = Text::Iconv->new($cp,"ISO-8859-2")'; |
259 |
|
if ($iconv) { |
260 |
|
return $iconv->convert($qp) || ''; |
261 |
|
} else { |
262 |
|
return $qp; |
263 |
|
} |
264 |
} |
} |
265 |
|
|
266 |
$tmp =~ s/=\?([^\?]+)\?([QB])\?(.+?)\?=/decode($1,$2,$3)/ige; |
$tmp =~ s/=\?([^\?]+)\?([QB])\?(.+?)\?=/decode($1,$2,$3)/ige; |
347 |
# reformat with Text::Autoformat |
# reformat with Text::Autoformat |
348 |
my $wrap = $self->{wrap_margin}; |
my $wrap = $self->{wrap_margin}; |
349 |
if ($wrap && $body && $body =~ m/^.{$wrap}..*$/m) { |
if ($wrap && $body && $body =~ m/^.{$wrap}..*$/m) { |
350 |
$body = autoformat($body, {right=>$wrap, all=>1}); |
eval '$body = autoformat($body, {right=>$wrap, all=>1});'; |
351 |
$body .="\n[reformated using autoformat, margin at $wrap]" if ($debug == 2); |
$body .="\n[reformated using autoformat, margin at $wrap]" if ($debug == 2); |
352 |
} |
} |
353 |
|
|