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

alexmv at bestpractical.com alexmv at bestpractical.com
Mon Oct 29 17:45:12 EDT 2007


Author: alexmv
Date: Mon Oct 29 17:45:12 2007
New Revision: 9496

Modified:
   Net-Server-IMAP/   (props changed)
   Net-Server-IMAP/lib/Net/Server/IMAP/Command.pm
   Net-Server-IMAP/lib/Net/Server/IMAP/Command/Close.pm
   Net-Server-IMAP/lib/Net/Server/IMAP/Command/Expunge.pm
   Net-Server-IMAP/lib/Net/Server/IMAP/Command/Search.pm
   Net-Server-IMAP/lib/Net/Server/IMAP/Command/Select.pm
   Net-Server-IMAP/lib/Net/Server/IMAP/Command/Store.pm
   Net-Server-IMAP/lib/Net/Server/IMAP/Command/Uid.pm
   Net-Server-IMAP/lib/Net/Server/IMAP/Connection.pm
   Net-Server-IMAP/lib/Net/Server/IMAP/Mailbox.pm
   Net-Server-IMAP/lib/Net/Server/IMAP/Message.pm

Log:
 r24139 at zoq-fot-pik:  chmrr | 2007-10-29 17:43:49 -0400
  * Move 'use bytes' to the packages where needed
  * Fix a \n -> \r\n
  * read-only-ness of EXAMINE is per-connectio, not per-mailbox


Modified: Net-Server-IMAP/lib/Net/Server/IMAP/Command.pm
==============================================================================
--- Net-Server-IMAP/lib/Net/Server/IMAP/Command.pm	(original)
+++ Net-Server-IMAP/lib/Net/Server/IMAP/Command.pm	Mon Oct 29 17:45:12 2007
@@ -2,6 +2,7 @@
 
 use warnings;
 use strict;
+use bytes;
 
 use base 'Class::Accessor';
 use Regexp::Common qw/delimited/;
@@ -40,7 +41,6 @@
 
     # Pending
     $self->connection->pending(sub {
-        use bytes;
         my $content = shift;
         if (length $content < $self->_pending_literal) {
             $self->_literals->[$next] .= $content;
@@ -158,7 +158,6 @@
         $self->untagged_response(
             "NO [" . uc($_) . "] " . $extra_responses{$_} );
     }
-    $self->send_untagged;
     $self->out( $self->command_id . " " . "NO " . $message . "\r\n" );
     return 0;
 }

Modified: Net-Server-IMAP/lib/Net/Server/IMAP/Command/Close.pm
==============================================================================
--- Net-Server-IMAP/lib/Net/Server/IMAP/Command/Close.pm	(original)
+++ Net-Server-IMAP/lib/Net/Server/IMAP/Command/Close.pm	Mon Oct 29 17:45:12 2007
@@ -21,7 +21,7 @@
 sub run {
     my $self = shift;
 
-    $self->connection->selected->expunge unless $self->connection->selected->read_only;
+    $self->connection->selected->expunge unless $self->connection->selected_read_only;
     $self->connection->selected(undef);
 
     $self->ok_completed();

Modified: Net-Server-IMAP/lib/Net/Server/IMAP/Command/Expunge.pm
==============================================================================
--- Net-Server-IMAP/lib/Net/Server/IMAP/Command/Expunge.pm	(original)
+++ Net-Server-IMAP/lib/Net/Server/IMAP/Command/Expunge.pm	Mon Oct 29 17:45:12 2007
@@ -12,7 +12,7 @@
     return $self->bad_command("Select a mailbox first")
         unless $self->connection->is_selected;
 
-    return $self->bad_command("Mailbox is read-only") if $self->connection->selected->read_only;
+    return $self->bad_command("Mailbox is read-only") if $self->connection->selected_read_only;
 
     my @options = $self->parsed_options;
     return $self->bad_command("Too many options") if @options;

Modified: Net-Server-IMAP/lib/Net/Server/IMAP/Command/Search.pm
==============================================================================
--- Net-Server-IMAP/lib/Net/Server/IMAP/Command/Search.pm	(original)
+++ Net-Server-IMAP/lib/Net/Server/IMAP/Command/Search.pm	Mon Oct 29 17:45:12 2007
@@ -2,6 +2,7 @@
 
 use warnings;
 use strict;
+use bytes;
 
 use base qw/Net::Server::IMAP::Command/;
 
@@ -71,7 +72,7 @@
         } elsif ($token eq "LARGER") {
             return $self->bad_command("Parse error") unless @tokens;
             my $size = shift @tokens;
-            push @{$filters}, sub {use bytes; length $_[0]->mime->as_string > $size};
+            push @{$filters}, sub {length $_[0]->mime->as_string > $size};
         } elsif ($token eq "NEW") {
             push @{$filters}, sub {$_[0]->has_flag('\Recent') and not $_->has_flag('\Seen')};
         } elsif ($token eq "NOT") {
@@ -98,7 +99,7 @@
         } elsif ($token eq "SMALLER") {
             return $self->bad_command("Parse error") unless @tokens;
             my $size = shift @tokens;
-            push @{$filters}, sub {use bytes; length $_[0]->mime->as_string < $size};
+            push @{$filters}, sub {length $_[0]->mime->as_string < $size};
         } elsif ($token eq "SUBJECT") {
             return $self->bad_command("Parse error") unless @tokens;
             my $subj = shift @tokens;

Modified: Net-Server-IMAP/lib/Net/Server/IMAP/Command/Select.pm
==============================================================================
--- Net-Server-IMAP/lib/Net/Server/IMAP/Command/Select.pm	(original)
+++ Net-Server-IMAP/lib/Net/Server/IMAP/Command/Select.pm	Mon Oct 29 17:45:12 2007
@@ -25,7 +25,7 @@
     my $self = shift;
 
     my $mailbox = $self->connection->model->lookup( $self->parsed_options );
-    $mailbox->force_read_only(1) if $self->command eq "Examine";
+    $self->connection->selected_read_only(1) if $self->command eq "Examine";
     $mailbox->poll;
     $self->connection->selected($mailbox);
 
@@ -49,7 +49,7 @@
             . join( ' ', $mailbox->permanentflags )
             . ')]' );
 
-    if ( $mailbox->read_only ) {
+    if ( $self->connection->selected_read_only ) {
         $self->ok_command("[READ-ONLY] Completed");
     } else {
         $self->ok_command("[READ-WRITE] Completed");

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	Mon Oct 29 17:45:12 2007
@@ -12,7 +12,7 @@
     return $self->bad_command("Select a mailbox first")
         unless $self->connection->is_selected;
 
-    return $self->bad_command("Mailbox is read-only") if $self->connection->selected->read_only;
+    return $self->bad_command("Mailbox is read-only") if $self->connection->selected_read_only;
 
     my @options = $self->parsed_options;
     return $self->bad_command("Not enough options") if @options < 3;

Modified: Net-Server-IMAP/lib/Net/Server/IMAP/Command/Uid.pm
==============================================================================
--- Net-Server-IMAP/lib/Net/Server/IMAP/Command/Uid.pm	(original)
+++ Net-Server-IMAP/lib/Net/Server/IMAP/Command/Uid.pm	Mon Oct 29 17:45:12 2007
@@ -57,7 +57,7 @@
 sub store {
     my $self = shift;
 
-    return $self->bad_command("Mailbox is read-only") if $self->connection->selected->read_only;
+    return $self->bad_command("Mailbox is read-only") if $self->connection->selected_read_only;
 
     return $self->bad_command("Not enough options") if @_ < 3;
     return $self->bad_command("Too many options") if @_ > 3;
@@ -107,7 +107,7 @@
     return $self->bad_command("Not enough options") if @_ < 1;
     return $self->bad_command("Too many options") if @_ > 2;
 
-    return $self->bad_command("Mailbox is read-only") if $self->connection->selected->read_only;
+    return $self->bad_command("Mailbox is read-only") if $self->connection->selected_read_only;
 
     my ( $messages ) = @_;
     my @messages = $self->connection->selected->get_uids($messages);

Modified: Net-Server-IMAP/lib/Net/Server/IMAP/Connection.pm
==============================================================================
--- Net-Server-IMAP/lib/Net/Server/IMAP/Connection.pm	(original)
+++ Net-Server-IMAP/lib/Net/Server/IMAP/Connection.pm	Mon Oct 29 17:45:12 2007
@@ -7,7 +7,7 @@
 
 use Net::Server::IMAP::Command;
 
-__PACKAGE__->mk_accessors(qw(server io_handle _selected model pending temporary_messages temporary_sequence_map previous_exists untagged_expunge untagged_fetch ignore_flags));
+__PACKAGE__->mk_accessors(qw(server io_handle _selected selected_read_only model pending temporary_messages temporary_sequence_map previous_exists untagged_expunge untagged_fetch ignore_flags));
 
 sub new {
     my $class = shift;
@@ -136,6 +136,7 @@
 sub selected {
     my $self = shift;
     $self->send_untagged if @_ and $self->selected;
+    $self->selected_read_only(0) if @_ and $self->selected;
     return $self->_selected(@_);
 }
 

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	Mon Oct 29 17:45:12 2007
@@ -7,7 +7,7 @@
 use base 'Class::Accessor';
 
 __PACKAGE__->mk_accessors(
-    qw(name is_inbox force_read_only parent children _path uidnext uids uidvalidity messages subscribed is_selectable)
+    qw(name is_inbox parent children _path uidnext uids uidvalidity messages subscribed is_selectable)
 );
 
 sub new {
@@ -178,7 +178,7 @@
 
 sub read_only {
     my $self = shift;
-    return $self->force_read_only;
+    return 0;
 }
 
 sub expunge {

Modified: Net-Server-IMAP/lib/Net/Server/IMAP/Message.pm
==============================================================================
--- Net-Server-IMAP/lib/Net/Server/IMAP/Message.pm	(original)
+++ Net-Server-IMAP/lib/Net/Server/IMAP/Message.pm	Mon Oct 29 17:45:12 2007
@@ -143,7 +143,6 @@
             push @out, [ map { \$_ } $self->flags ];
         } elsif ( uc $part eq "RFC822.SIZE" ) {
             my $result = $self->mime_select( [], undef, undef );
-            use bytes;
             push @out, length $result;
         } elsif ( uc $part eq "BODY" ) {
             push @out, $self->mime_bodystructure( $self->mime, 0 );
@@ -168,7 +167,7 @@
     my $result   = $self->mime->as_string;
     for (@sections) {
         if ( uc $_ eq "HEADER" or uc $_ eq "MIME" ) {
-            $result = $mime->header_obj->as_string . "\n";
+            $result = $mime->header_obj->as_string . "\r\n";
         } elsif ( uc $_ eq "FIELDS" ) {
             my %case;
             $case{ uc $_ } = $_ for $mime->header_names;
@@ -176,7 +175,7 @@
             for my $h ( @{$extras} ) {
                 $header->header_set( $case{$h} || $h => $mime->header($h) );
             }
-            $result = $header->as_string ? $header->as_string . "\n" : "";
+            $result = $header->as_string ? $header->as_string . "\r\n" : "";
         } elsif ( uc $_ eq "TEXT" ) {
             $result = $mime->body;
         } elsif ( $_ =~ /^\d+$/i ) {
@@ -259,7 +258,7 @@
             scalar $mime->header("Content-ID"),
             scalar $mime->header("Content-Description"),
             ( scalar $mime->header("Content-Transfer-Encoding") or "7BIT" ),
-            do {use bytes; length $body},
+            length $body,
             (   defined $lines
                 ? ( $lines, )
                 : ()



More information about the Bps-public-commit mailing list