Skip Menu |

This queue is for tickets about the Mail-IMAPClient CPAN distribution.

Report information
The Basics
Id: 65637
Status: rejected
Priority: 0/
Queue: Mail-IMAPClient

People
Owner: PLOBBES [...] cpan.org
Requestors: MARKLE [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 3.26
Fixed in: (no value)



Subject: migrate should preserve \Recent flag
The intent of migrating from one imap connection to the next is to preserve the messages intact, right? Unfortunately it does not preserve the \Recent flag. In my script that archives and expires old messages of users, I thought I was going to get it right by only examine()-ing the source folder on the source imap. I see that in Mail/IMAPClient.pm line 871 you filter out the \Recent flag. Is this desirable? It seems like the intent of migrate() is to move the message transparently with all its attributes and flags. Thanks. Mark
I tried patching to remove the grep filter for \Recent in migrate(), but then I get the "Append to '$dfolder' on target failed: " error. Incidentally, $peer->LastError is empty in this condition. I know the RFC says \Recent can never be modified, but does that apply to a "new" message? If this is just something that IMAP cannot do-- mimic a delivery-- then maybe the subject line of this bug should be "LastError empty on failure trying to set \Recent flag". I think my script will lock the destination folder and write to it directly. That should force the imap server to reindex when it is selected to verify the results, and it should see it is a new message. I'm trying to solve a problem where some clients apparently use the \Recent flag to determine whether to display a message as new, instead of the \Seen flag. I'm not even sure what client it is that people are complaining about.
Argh but if I write them directly, they lose any flags that may have been set by the user-- including if they'd \Seen them already. And if then select the messages and set the flags, they're no longer \Recent again. Is there any way to do this?
Hi Mark, Per RFC 3501, Section 2.3.2. Flags Message Attribute: Note: The \Recent system flag is a special case of a session flag. \Recent can not be used as an argument in a STORE or APPEND command, and thus can not be changed at all. As you have discovered, the server controls the \Recent flag. That is why the code, per the RFC, tries to ensure we do not attempt to set that flag. That is also why your attempts to set it fail. This is an IMAP thing, I just wouldn't worry about \Recent too much because of this protocol limitation. I will close this bug as invalid. Although I will try to add a note to the documentation regarding this flag (and the migrate docs are *really* bad/wrong anyway). As for why $peer->LastError() doesn't return any error info on the APPEND failure, well... it appears that the code is appending to $self instead of $peer! I'll release a patch for this soon. Here's a diff in case you want to test: [ppearl@vmwork mail-imapclient]$ git diff diff --git a/lib/Mail/IMAPClient.pm b/lib/Mail/IMAPClient.pm index b1fe956..3618c41 100644 --- a/lib/Mail/IMAPClient.pm +++ b/lib/Mail/IMAPClient.pm @@ -7,7 +7,7 @@ use strict; use warnings; package Mail::IMAPClient; -our $VERSION = '3.26'; +our $VERSION = '3.27_01'; use Mail::IMAPClient::MessageSet; @@ -876,7 +876,7 @@ sub migrate { $self->message_to_file( \$msg, $mid ) or return undef; - my $newid = $self->append_file( $dfolder, \$msg, undef, $flags, $date ); + my $newid = $peer->append_file( $dfolder, \$msg, undef, $flags, $date ); unless ( defined $newid ) { $self->LastError(