Subject: | Yes, slfags should be exposed |
Date: | Wed, 20 Feb 2019 08:46:52 -0500 |
To: | bug-Net-IMAP-Simple [...] rt.cpan.org |
From: | tlhackque <tlhackque [...] yahoo.com> |
Simple.pm at line 405 says:
# NOTE: the sflags really aren't used anywhere, should they be?
Yes, they should. They indicate which flags can be set permanently
on the server, and in particular, the \* flag in this response indicates
whether new keywords can be created.
I suggest the following simple change to the 'flags' method:
|sub| |flags {|
| ||my| |( ||$self||, ||$folder| |) = ||@_||;|
| ||$self||->||select||(||$folder||);|
| ||return| |@{ ||$self||->{BOXES}{ ||$self||->current_box }{flags}
|| [] };|
|}|
becomes: (add $permflags and first "return")
|sub| |flags {|
| ||my| |( ||$self||, ||$folder|, $permflags |) = ||@_||;|
| ||$self||->||select||(||$folder||);|
| ||return| |@{ ||$self||->{BOXES}{ ||$self||->current_box
}{sflags}{PERMANENTFLAGS} || [ ' ' ] } if( $permflags );|
| ||return| |@{ ||$self||->{BOXES}{ ||$self||->current_box }{flags} ||
[] };|
||||
|}|
You can then remove the NOTE.
And the POD becomes
|=item flags|
| ||print "Available server flags: " . join(", ", $imap->flags) . "\n";|
|This method accepts an optional folder name and optional boolean,
"$permflags|
|and returns the current available|
|server flags as a list, for the selected folder. If no folder name is
provided|
|the last folder C<< $imap->select >>'ed will be used.|
If the $permflags boolean is specified, the flags that the server allows
to be
set permanently are returned. The flag '\*' indicates that new keywords
can be created.
If the list ( ' ' ) is returned, the server did not provide an explicit
list, and
"all flags" should be assumed. To specify $permflags & default $folder,
use 'undef'
for $folder.
|This method uses caching.|
I noted in passing that line 369 (in sub select) defaults $mbox to
$self->current_box 'unless $mbox'.
This won't work if you happen to have a folder named '0' - stranger
things have happened.
The clause should be 'unless defined $mbox'.
Message body is not shown because it is too large.