[Net-IMAP-Server] Mailbox rename
Jan Dvořák
jdvorak at uikt.mendelu.cz
Wed Jul 29 08:03:27 EDT 2009
Yes, it works fine, thanks.
Tue, Jul 28, 2009 ve 11:24:31AM -0400 Alex Vandiver napsal(a):
> On Tue, 2009-07-28 at 16:46 +0200, Jan Dvořák wrote:
> > Hi, I think I found little bug in renaming mailboxes. If you rename
> > mailbox and after it call list command, in result mailbox has still same
> > name. If you try select mailbox with old name, mailbox does not exists.
> > I think there is $mailbox->full_path( purge => 1 ) missing.
>
> Does the below solve it?
> - Alex
>
> >From 142dd3af0e458a105f7874790c363a243c4a8e37 Mon Sep 17 00:00:00 2001
> From: Alex Vandiver <alexmv at bestpractical.com>
> Date: Tue, 28 Jul 2009 11:22:45 -0400
> Subject: [PATCH] Fix caching in rename by setting name inside ->reparent
>
> ---
> lib/Net/IMAP/Server/Command/Rename.pm | 3 +--
> lib/Net/IMAP/Server/Mailbox.pm | 7 ++++---
> 2 files changed, 5 insertions(+), 5 deletions(-)
>
> 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;
> }
> --
> 1.6.3.3.473.gb74fc4.dirty
>
>
--
S pozdravem
Ing. Jan Dvořák
programátor IS
Ústav pro informační systém
Mendelova zemědělská
a lesnická univerzita v Brně
Zemědělská 1 / 613 00 Brno
telefon 545 132 816 / fax 545 132 828
jdvorak at mendelu.cz
www.mendelu.cz
[prostor pro logo]
More information about the Net-IMAP-Server
mailing list