[Dovecot] maildir maintenance?

Timo Sirainen tss at iki.fi
Fri Nov 26 17:15:54 EET 2010

On Fri, 2010-11-26 at 09:03 -0600, Brian Kroth wrote:
> So, I redid this in Perl to only use IMAP rather than any sudo or find
> calls.  In theory then one doesn't need to worry about the indexes being
> out of sync.  I still skipped over the "strange characters" mailboxes
> for the moment.  I'm wondering what you think of this second rendition? 

Using some IMAP parser would be much more robust than doing it via
regexps. Then you wouldn't have to worry about strange characters

> if ($line =~ qr/^\* (LIST|LSUB) \((\\Has(No)?Children)?\) "\/" "(.+)"\s*$/) {

Just ignore the flags in the middle, there might be others: \([^)]*\)

> if ($line =~ /^\* [0-9]+ FETCH \(UID ([0-9]+) X-SAVEDATE "([0-9]{1,2}-[A-Z][a-z][a-z]-[0-9]{4} [0-9][0-9]:[0-9][0-9]:[0-9][0-9] [0-9+-]+)" FLAGS \(([^)]+)\) ENVELOPE \((.*)\)\)\s*$/) {

ENVELOPE reply might not be in one line either. For example see what
happens if subject has " character.

If the list of UIDs is really large, sending a command might fail
because the command line is too long (imap_max_line_length setting).

More information about the dovecot mailing list