Timo Sirainen <t...@iki.fi> 2010-11-26 15:15:
> 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
> either.

*sigh*

Should have started there.  It appears there's a nice module that even
has an example for talking to Dovecot via preauth:
http://search.cpan.org/~jettero/Net-IMAP-Simple-1.2018/Simple.pod#PREAUTH

Thanks again,
Brian

> > 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).

Attachment: signature.asc
Description: Digital signature

Reply via email to