Hi,
first, thanks for your quick reply and help. Is rt.cpan.org the
preferred way to report bugs and problems? That is, would you want me to
report the issue with dummy messages and threadStart() that I tried to
post to the mailing list but never made it through moderation to RT?
On Wed, Oct 22, 2008 at 05:19:47PM -0400, Mark Overmeer via RT wrote:
Show quoted text
Show quoted text> This only happens if keep_dups is false (default), I thing. If you
> open folders with ->new(keep_dups => 1) then the new one will not
> be deleted automatically.
I didn't test that, but in general I wouldn't want two messages with the
same Message-ID in the same folder anyway...
Show quoted text> > As far as I can see, there's no straightforward way to find out which
> > folder a message is in, so I could skip the moveMessage? As a
> > workaround, I'm using a temporary folder, but this shouldn't be
> > necessary really...
>
> Quite simple if($msg1->folder==$msg2->folder)
Hmm, I thought I had seen something like that, but couldn't find
anything when I was looking for it. I would have expected some mention
in the documentation for Mail::Message or Mail::Box::Manager, but never
looked into Mail::Box::Message, as that's deeply into the magic workings
of Mail::Box! At the top of Mail/Box/Message.pod it even reads "If you
access the knowledge of a message, then read Mail::Message"... Do you
think it could be mentioned in Mail::Message?
(talking about documentation, how about spelling out the options for
Mail::Box::nrMessages() -- once I had discovered it also counts the
deleted messages it was easy to find out why, but I never would have
noticed had I not been testing your patch)
NB: the above equation (in the incarnation you suggested for
Mail::Box::Manager::copyMessages()) failed on me with "Operation `==':
no method found", but worked ok when replacing '==' with 'eq'.
Show quoted text> What about this:
>
> Mail::Box::Manager::copyMessages() replace:
>
> my @coerced
> = ref $folder
> ? map {$_->copyTo($folder, share => $args{share})} @messages
> : $self->appendMessages(@messages, %args, folder => $folder);
>
> # hidden option, do not use it: it's designed to optimize moveMessage
> if($args{_delete})
> { $_->label(deleted => 1) foreach @messages;
> }
I've had perfect results with a slightly modfied replacement (udiff):
unless(ref $folder)
{ my @c = $self->appendMessages(@messages, %args, folder => $folder);
- $_->label(deleted => 1) for @messages;
+ if($args{_delete})
+ { $_->label(deleted => 1) for @messages;
+ }
return @c;
}
my @coerced;
foreach my $msg (@messages)
- { if($msg->folder==$folder) # ignore move to same folder
+ { if($msg->folder eq $folder) # ignore move to same folder
{ push @coerced, $msg;
next;
}
push @coerced, $msg->copyTo($folder, share => $args{share});
$msg->label(deleted => 1) if $args{_delete};
}
@coerced;
warm regards,
Florian