Subject: | selectable bug: \b\\Noselect\b never matches, always returns true |
Date: | Mon, 06 Jan 2014 23:37:32 -0500 |
To: | bug-Mail-IMAPClient [...] rt.cpan.org |
From: | Justin Vallon <justinvallon [...] gmail.com> |
When I call $server->selectable('INBOX.Archives.2014'), debug shows:
Sending: 2 LIST "" INBOX.Archives.2014
Sent 31 bytes
Read: * LIST (\Noselect \HasChildren) "." "INBOX.Archives.2014"
2 OK LIST completed
But, it returns 1.
IMAPClient.pm version 3.35:
sub selectable {
my ( $self, $f ) = @_;
my $info = $self->list( "", $f ) or return undef;
return not( grep /\b\\Noselect\b/i, @$info );
}
The \b is not matching. Here is where \b matches in the LIST output line:
* {b}LIST{b} (\{b}Noselect{b} \{b}HasChildren{b}) "."
"{b}INBOX{b}.{b}Archives{b}.{b}2014{b}"
Maybe change \b to [paren space]:
$ git diff
diff --git a/lib/Mail/IMAPClient.pm b/lib/Mail/IMAPClient.pm
index 6e77c85..632e1a7 100644
--- a/lib/Mail/IMAPClient.pm
+++ b/lib/Mail/IMAPClient.pm
@@ -2880,7 +2880,7 @@ sub is_parent {
sub selectable {
my ( $self, $f ) = @_;
my $info = $self->list( "", $f ) or return undef;
- return not( grep /\b\\Noselect\b/i, @$info );
+ return not( grep /[\s(]\\Noselect[)\s]/i, @$info );
}
# append( $self, $folder, $text [, $optmsg] )
With this change, selectable returns 0 for INBOX.Archives.2014.
--
-Justin
JustinVallon@gmail.com
Message body not shown because it is not plain text.