[Bps-public-commit] r9364 - in Net-Server-IMAP: lib/Net/Server/IMAP lib/Net/Server/IMAP/Command

alexmv at bestpractical.com alexmv at bestpractical.com
Fri Oct 19 15:41:59 EDT 2007


Author: alexmv
Date: Fri Oct 19 15:41:52 2007
New Revision: 9364

Modified:
   Net-Server-IMAP/   (props changed)
   Net-Server-IMAP/lib/Net/Server/IMAP/Command/Store.pm
   Net-Server-IMAP/lib/Net/Server/IMAP/Mailbox.pm

Log:
 r23756 at zoq-fot-pik:  chmrr | 2007-10-19 15:40:41 -0400
  * Check which flags can actually be set


Modified: Net-Server-IMAP/lib/Net/Server/IMAP/Command/Store.pm
==============================================================================
--- Net-Server-IMAP/lib/Net/Server/IMAP/Command/Store.pm	(original)
+++ Net-Server-IMAP/lib/Net/Server/IMAP/Command/Store.pm	Fri Oct 19 15:41:52 2007
@@ -26,6 +26,9 @@
 
     my ( $messages, $what, $flags ) = $self->parsed_options;
     $flags = ref $flags ? $flags : [$flags];
+
+    return $self->bad_command("Invalid flag $_") for grep {not $self->connection->selected->can_set_flag($_)} @{$flags};
+
     my @messages = $self->connection->get_messages($messages);
     $self->connection->ignore_flags(1) if $what =~ /\.SILENT$/i;
     $_->store( $what => $flags ) for @messages;

Modified: Net-Server-IMAP/lib/Net/Server/IMAP/Mailbox.pm
==============================================================================
--- Net-Server-IMAP/lib/Net/Server/IMAP/Mailbox.pm	(original)
+++ Net-Server-IMAP/lib/Net/Server/IMAP/Mailbox.pm	Fri Oct 19 15:41:52 2007
@@ -144,6 +144,14 @@
     return qw(\Answered \Flagged \Deleted \Seen \Draft);
 }
 
+sub can_set_flag {
+    my $self = shift;
+    my $flag = shift;
+
+    return 1 if grep {$_ eq $flag} $self->flags;
+    return;
+}
+
 sub exists {
     my $self = shift;
     $Net::Server::IMAP::Server->connection->previous_exists( scalar @{ $self->messages } )



More information about the Bps-public-commit mailing list