253 |
253 |
or die "Could not get folders via IMAP: $@\n";
|
254 |
254 |
my @subfolder_strings = grep { $_ ne $base_folder_string } @$folder_strings;
|
255 |
255 |
|
256 |
|
# Store all emails in journal
|
257 |
|
my $email_import =
|
258 |
|
$self->_update_emails_from_folder_strings($base_folder_path, \@subfolder_strings);
|
259 |
|
|
260 |
256 |
# Store the emails to the records
|
261 |
257 |
foreach my $subfolder_string (@subfolder_strings) {
|
262 |
258 |
my $ilike_folder_path = $self->get_ilike_folder_path_from_string($subfolder_string);
|
... | ... | |
286 |
282 |
$self->update_email_files_for_record($record);
|
287 |
283 |
}
|
288 |
284 |
|
289 |
|
return ($email_import, \@subfolder_strings);
|
|
285 |
return \@subfolder_strings;
|
290 |
286 |
}
|
291 |
287 |
|
292 |
288 |
sub create_folder {
|
... | ... | |
327 |
323 |
|
328 |
324 |
sub clean_up_subfolders {
|
329 |
325 |
my ($self, $active_records) = @_;
|
330 |
|
my $record_folder_path = $self->{base_folder};
|
331 |
326 |
|
332 |
|
my ($email_import, $synced_folders) =
|
|
327 |
my $subfolder_strings =
|
333 |
328 |
$self->update_email_subfolders_and_files_for_records();
|
334 |
329 |
|
335 |
|
my @active_folders = map { $self->_get_folder_string_for_record($_) }
|
|
330 |
my @active_folder_strings = map { $self->_get_folder_string_for_record($_) }
|
336 |
331 |
@$active_records;
|
337 |
332 |
|
338 |
|
my %keep_folder = map { $_ => 1 } @active_folders;
|
339 |
|
my @folders_to_delete = grep { !$keep_folder{$_} } @$synced_folders;
|
|
333 |
my %keep_folder = map { $_ => 1 } @active_folder_strings;
|
|
334 |
my @folders_to_delete = grep { !$keep_folder{$_} } @$subfolder_strings;
|
340 |
335 |
|
341 |
336 |
foreach my $folder (@folders_to_delete) {
|
342 |
337 |
$self->{imap_client}->delete($folder)
|
343 |
338 |
or die "Could not delete IMAP folder '$folder': $@\n";
|
344 |
339 |
}
|
345 |
|
|
346 |
|
return $email_import;
|
347 |
340 |
}
|
348 |
341 |
|
349 |
342 |
sub _get_folder_string_for_record {
|
BJ: CleanUpEmailSubfolders: nur Emaildateien speicher
Es werden keine ein Einträge in die Datenbank gemacht und Emails, die
nicht zugeordnet werden können, werden ohne zu sichern gelöscht.