[Bps-public-commit] Net-IMAP-Server branch, master, updated. 1.23-1-g142dd3a

Alex M Vandiver alexmv at bestpractical.com
Wed Jul 29 12:42:26 EDT 2009


The branch, master has been updated
       via  142dd3af0e458a105f7874790c363a243c4a8e37 (commit)
      from  5fd00be3089677472118cfb278da3f3bd72560f4 (commit)

Summary of changes:
 lib/Net/IMAP/Server/Command/Rename.pm |    3 +--
 lib/Net/IMAP/Server/Mailbox.pm        |    7 ++++---
 2 files changed, 5 insertions(+), 5 deletions(-)

- Log -----------------------------------------------------------------
commit 142dd3af0e458a105f7874790c363a243c4a8e37
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Tue Jul 28 11:22:45 2009 -0400

    Fix caching in rename by setting name inside ->reparent

diff --git a/lib/Net/IMAP/Server/Command/Rename.pm b/lib/Net/IMAP/Server/Command/Rename.pm
index cab5435..1c7a3cd 100644
--- a/lib/Net/IMAP/Server/Command/Rename.pm
+++ b/lib/Net/IMAP/Server/Command/Rename.pm
@@ -44,8 +44,7 @@ sub run {
         $base = $part;
     }
 
-    $mailbox->reparent($base) or return $self->no_command("Permission denied");
-    $mailbox->name($newname);
+    $mailbox->reparent($base, $newname) or return $self->no_command("Permission denied");
 
     $self->ok_completed();
 }
diff --git a/lib/Net/IMAP/Server/Mailbox.pm b/lib/Net/IMAP/Server/Mailbox.pm
index 4511f71..c36a08c 100644
--- a/lib/Net/IMAP/Server/Mailbox.pm
+++ b/lib/Net/IMAP/Server/Mailbox.pm
@@ -208,11 +208,11 @@ sub create {
     return $self->add_child(@_);
 }
 
-=head3 reparent MAILBOX
+=head3 reparent MAILBOX [NAME]
 
 Reparents this mailbox to be a child of the given
-L<Net::IMAP::Server::Mailbox> C<MAILBOX>.  Should return 0 if the
-reparenting is denied or fails.
+L<Net::IMAP::Server::Mailbox> C<MAILBOX>, with the given C<NAME>.
+Should return 0 if the reparenting is denied or fails.
 
 =cut
 
@@ -224,6 +224,7 @@ sub reparent {
         [ grep { $_ ne $self } @{ $self->parent->children } ] );
     push @{ $parent->children }, $self;
     $self->parent($parent);
+    $self->name(shift) if @_;
     $self->full_path( purge => 1 );
     return 1;
 }

-----------------------------------------------------------------------



More information about the Bps-public-commit mailing list