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

alexmv at bestpractical.com alexmv at bestpractical.com
Fri Nov 2 09:22:05 EDT 2007


Author: alexmv
Date: Fri Nov  2 09:22:04 2007
New Revision: 9535

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

Log:
 r24308 at zoq-fot-pik:  chmrr | 2007-11-02 09:20:42 -0400
  * Update auth as soon as possible, so messages and mailboxes can examine it at create time


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	Fri Nov  2 09:22:04 2007
@@ -126,6 +126,7 @@
     my $self = shift;
     if (@_) {
         $self->{auth} = shift;
+        $self->server->{auth} = $self->{auth};
         $self->server->model_class->require || warn $@;
         $self->model(
             $self->server->model_class->new( { auth => $self->{auth} } ) );

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 Nov  2 09:22:04 2007
@@ -59,11 +59,19 @@
 sub add_message {
     my $self    = shift;
     my $message = shift;
-    $message->uid( $self->uidnext );
-    $self->uidnext( $self->uidnext + 1 );
+
+    # Basic message setup first
+    $message->mailbox($self);
     $message->sequence( @{ $self->messages } + 1 );
     push @{ $self->messages }, $message;
-    $message->mailbox($self);
+
+    # Some messages may supply their own uids
+    if ($message->uid) {
+        $self->uidnext( $message->uid + 1 ) if $message->uid >= $self->uidnext;
+    } else {
+        $message->uid( $self->uidnext );
+        $self->uidnext( $self->uidnext + 1 );
+    }
     $self->uids->{ $message->uid } = $message;
 
     # Also need to add it to anyone that has this folder as a



More information about the Bps-public-commit mailing list