Line 235... |
Line 235... |
235 |
my $targetAccount = $target->{'connection'};
|
235 |
my $targetAccount = $target->{'connection'};
|
236 |
my $numMessages = 0;
|
236 |
my $numMessages = 0;
|
237 |
$sourceAccount->expunge_mailbox( $folder ); # clean it up so we don't copy deleted messages
|
237 |
$sourceAccount->expunge_mailbox( $folder ); # clean it up so we don't copy deleted messages
|
238 |
$sourceAccount->select( $folder ) or die "Could not connect to folder $folder\n"; # move into the correct folder for the source
|
238 |
$sourceAccount->select( $folder ) or die "Could not connect to folder $folder\n"; # move into the correct folder for the source
|
239 |
my @ids = $sourceAccount->search_sent_before( $source->{'before date'} ); # use sent_before to get the sent date from message
|
239 |
my @ids = $sourceAccount->search_sent_before( $source->{'before date'} ); # use sent_before to get the sent date from message
|
240 |
# print join( "\n\t\t\t", @ids ) . "\n";
|
240 |
print "Found " . scalar( @ids ) . " messages to process\n";
|
241 |
return 0 unless @ids; # we have nothing to copy, so exit
|
241 |
return 0 unless @ids; # we have nothing to copy, so exit
|
242 |
# make life easier by precalculating some paths as array pointers
|
242 |
# make life easier by precalculating some paths as array pointers
|
243 |
my @sourceFolders = split( '\\' . $source->{'separator'}, $folder );
|
243 |
my @sourceFolders = split( '\\' . $source->{'separator'}, $folder );
|
244 |
my @pattern = split '\\^', $target->{'hierarchy'};
|
244 |
my @pattern = split '\\^', $target->{'hierarchy'};
|
245 |
$source->{'source folder list'} = \@sourceFolders;
|
245 |
$source->{'source folder list'} = \@sourceFolders;
|
246 |
$target->{'hierachy pattern'} = \@pattern;
|
246 |
$target->{'hierachy pattern'} = \@pattern;
|
247 |
# print "\n\nDumping information\n";
|
- |
|
248 |
# print "Source Folder $folder\n";
|
- |
|
249 |
# print "Source Separator $source->{'separator'}\n";
|
- |
|
250 |
# print Dumper( $source->{'source folder list'} ) . "\n";
|
- |
|
251 |
# print "Target Separator $target->{'separator'}\n";
|
- |
|
252 |
# print "Target Hierarchy $target->{'hierarchy'}\n";
|
- |
|
253 |
# print Dumper( $target->{'hierachy pattern'} ) . "\n";
|
- |
|
254 |
|
- |
|
255 |
# print 'Source => ' . join( "\n", @sourceFolders ) . "\n";
|
- |
|
256 |
# print 'Pattern => ' . join( "\n", @pattern ) . "\n";
|
- |
|
257 |
|
- |
|
258 |
|
247 |
|
259 |
# process each message to be done
|
248 |
# process each message to be done
|
260 |
foreach my $id ( @ids ) {
|
249 |
foreach my $id ( @ids ) {
|
261 |
# get the flags
|
250 |
# get the flags
|
262 |
my @flags = $sourceAccount->msg_flags( $id );
|
251 |
my @flags = $sourceAccount->msg_flags( $id );
|