problems with IMAP folder separator
Michael Reece <[email protected]> Tue, 27 Feb 2007 11:32:36 -0800
| Newsgroups | gmane.comp.lang.perl.modules.mail-box |
|---|---|
| Message-ID | <[email protected]> |
my IMAP server uses '.' as the folder separator, which causes some
problems with Mail::Box::IMAP4 (and related).
here is one patch (to Mail::Transport::IMAP4) that helps:
--- IMAP4.orig 2007-02-27 10:51:48.000000000 -0800
+++ IMAP4.pm 2007-02-27 10:51:16.000000000 -0800
@@ -283,11 +283,11 @@
my $sep = $imap->separator;
my $level = 1 + (defined $top ? () = $top =~ m/\Q$sep\E/g : -1);
# There may be multiples thanks to subdirs so we uniq it
my %uniq;
- $uniq{(split($sep, $_))[$level]||''}++ foreach @folders;
+ $uniq{(split(/\Q$sep\E/, $_))[$level]||''}++ foreach @folders;
delete $uniq{''};
keys %uniq;
}
as the $sep is meta-quoted a few lines up there (my $level = ...), i
think this is the right fix.
there is another bug in Mail::Box::IMAP4,
sub nameOfSubfolder($;$) { $_[1] }
that should be nameOfSubFolder. due to the typo, it is falling
trough to Mail::Box->nameOfSubFolder,
sub nameOfSubFolder($;$)
{ my ($thing, $name) = (shift, shift);
my $parent = @_ ? shift : ref $thing ? $thing->name : undef;
defined $parent ? "$parent/$name" : $name;
}
but this hard-codes a / separator, which leads to errors like
ERROR: Couldn't select IMAP4 folder INBOX/perl
adding the following to Mail::Box::IMAP4 appears to solve the
problem, at least for me:
sub nameOfSubFolder($;$)
{ my ($thing, $name) = (shift, shift);
my $parent = @_ ? shift : ref $thing ? $thing->name : undef;
(defined $parent && $parent ne '/')
? join($thing->transporter->imapClient->separator,
$parent, $name)
: $name;
}
but i suspect it is not a perfect patch in cases where
nameOfSubFolder might be called as a class method, so it probably
needs some tweaking.
also, is there a SSL recipe for Mail::Box::IMAP4?
_______________________________________________
Mailbox mailing list
[email protected]
http://lists.utsl.gen.nz/mailman/listinfo.cgi/mailbox