diff options
-rw-r--r-- | lib/PublicInbox/IMAPD.pm | 7 | ||||
-rw-r--r-- | t/imap.t | 7 | ||||
-rw-r--r-- | t/imapd.t | 2 |
3 files changed, 14 insertions, 2 deletions
diff --git a/lib/PublicInbox/IMAPD.pm b/lib/PublicInbox/IMAPD.pm index a3a25986..966879d8 100644 --- a/lib/PublicInbox/IMAPD.pm +++ b/lib/PublicInbox/IMAPD.pm @@ -25,6 +25,13 @@ sub refresh_inboxlist ($) { my ($self) = @_; my @names = map { $_->{newsgroup} } @{delete $self->{grouplist}}; my %ns; # "\Noselect \HasChildren" + + if (my @uc = grep(/[A-Z]/, @names)) { + warn "Uppercase not allowed for IMAP newsgroup(s):\n", + map { "\t$_\n" } @uc; + my %uc = map { $_ => 1 } @uc; + @names = grep { !$uc{$_} } @names; + } for (@names) { my $up = $_; while ($up =~ s/\.[^\.]+\z//) { @@ -8,9 +8,14 @@ use PublicInbox::IMAP; use PublicInbox::IMAPD; { # make sure we get '%' globbing right - my @n = map { { newsgroup => $_ } } (qw(x.y.z x.z.y)); + my @w; + local $SIG{__WARN__} = sub { push @w, @_ }; + my @n = map { { newsgroup => $_ } } (qw(x.y.z x.z.y IGNORE.THIS)); my $self = { imapd => { grouplist => \@n } }; PublicInbox::IMAPD::refresh_inboxlist($self->{imapd}); + is(scalar(@w), 1, 'got a warning for upper-case'); + like($w[0], qr/IGNORE\.THIS/, 'warned about upper-case'); + my $res = PublicInbox::IMAP::cmd_list($self, 'tag', 'x', '%'); is(scalar($$res =~ tr/\n/\n/), 2, 'only one result'); like($$res, qr/ x\r\ntag OK/, 'saw expected'); @@ -88,7 +88,7 @@ like($e, qr/\bNO\b/, 'got a NO on EXAMINE for non-existent'); ok(!$mic->select('foo') && ($e = $@), 'EXAMINE non-existent'); like($e, qr/\bNO\b/, 'got a NO on EXAMINE for non-existent'); ok($mic->select('inbox.i1'), 'SELECT succeeds'); -ok($mic->examine('inbox.i1'), 'EXAMINE succeeds'); +ok($mic->examine('INBOX.i1'), 'EXAMINE succeeds'); my @raw = $mic->status('inbox.i1', qw(Messages uidnext uidvalidity)); is(scalar(@raw), 2, 'got status response'); like($raw[0], qr/\A\*\x20STATUS\x20inbox\.i1\x20 |