[Bps-public-commit] r10999 - in Net-IMAP-Server: lib/Net/IMAP lib/Net/IMAP/Server lib/Net/IMAP/Server/Command
alexmv at bestpractical.com
alexmv at bestpractical.com
Tue Mar 4 18:04:32 EST 2008
Author: alexmv
Date: Tue Mar 4 18:04:31 2008
New Revision: 10999
Modified:
Net-IMAP-Server/ (props changed)
Net-IMAP-Server/lib/Net/IMAP/Server.pm
Net-IMAP-Server/lib/Net/IMAP/Server/Command/Fetch.pm
Net-IMAP-Server/lib/Net/IMAP/Server/Connection.pm
Net-IMAP-Server/lib/Net/IMAP/Server/Mailbox.pm
Log:
r28295 at zoq-fot-pik: chmrr | 2008-03-04 18:04:00 -0500
* Returning from a cede can leave local'd variables with the value
they held in the latest coroutine! Temporary band-aid over this
horrible Coro bug
* Avoid warning on $conn->select(undef)
* Avoid error on FETCH 1:* in a mailbox with no messages
Modified: Net-IMAP-Server/lib/Net/IMAP/Server.pm
==============================================================================
--- Net-IMAP-Server/lib/Net/IMAP/Server.pm (original)
+++ Net-IMAP-Server/lib/Net/IMAP/Server.pm Tue Mar 4 18:04:31 2008
@@ -249,30 +249,6 @@
return $self->{connection};
}
-=head2 auth
-
-Returns the current L<Net::IMAP::Server::DefaultAuth> (or, more
-probably, descendant thereof) for the active connection.
-
-=cut
-
-sub auth {
- my $self = shift;
- return $self->{auth};
-}
-
-=head2 auth
-
-Returns the current L<Net::IMAP::Server::DefaultModel> (or, more
-probably, descendant thereof) for the active connection.
-
-=cut
-
-sub model {
- my $self = shift;
- return $self->{model};
-}
-
=head2 concurrent_mailbox_connections [MAILBOX]
This can be called as either a class method or an instance method; it
Modified: Net-IMAP-Server/lib/Net/IMAP/Server/Command/Fetch.pm
==============================================================================
--- Net-IMAP-Server/lib/Net/IMAP/Server/Command/Fetch.pm (original)
+++ Net-IMAP-Server/lib/Net/IMAP/Server/Command/Fetch.pm Tue Mar 4 18:04:31 2008
@@ -31,6 +31,8 @@
. " FETCH "
. $self->data_out( [ $m->fetch($spec) ] ) );
cede;
+ warn "Connection is no longer me!" if $self->connection->server->connection ne $self->connection;
+ $self->connection->server->{connection} = $self->connection;
}
$self->ok_completed();
Modified: Net-IMAP-Server/lib/Net/IMAP/Server/Connection.pm
==============================================================================
--- Net-IMAP-Server/lib/Net/IMAP/Server/Connection.pm (original)
+++ Net-IMAP-Server/lib/Net/IMAP/Server/Connection.pm Tue Mar 4 18:04:31 2008
@@ -78,7 +78,6 @@
my $self = shift;
if (@_) {
$self->{auth} = shift;
- $self->server->{auth} = $self->{auth};
$self->server->model_class->require || warn $@;
$self->update_timer;
$self->model(
@@ -97,7 +96,7 @@
sub selected {
my $self = shift;
if ( @_ and $self->selected ) {
- unless ( $self->selected eq $_[0] ) {
+ unless ( $_[0] and $self->selected eq $_[0] ) {
$self->send_untagged;
$self->selected->close;
}
@@ -128,9 +127,13 @@
sub handle_lines {
my $self = shift;
$self->coro->prio(-4);
+
+ local $self->server->{connection} = $self;
+
eval {
$self->greeting;
while ( $self->io_handle and $_ = $self->io_handle->getline() ) {
+ $self->server->{connection} = $self;
$self->handle_command($_);
$self->commands( $self->commands + 1 );
if ( $self->is_unauth
@@ -194,10 +197,6 @@
my $self = shift;
my $content = shift;
- local $self->server->{connection} = $self;
- local $self->server->{model} = $self->model;
- local $self->server->{auth} = $self->auth;
-
$self->log(
"C(@{[$self]},@{[$self->auth ? $self->auth->user : '???']},@{[$self->is_selected ? $self->selected->full_path : 'unselected']}): $content"
);
@@ -235,7 +234,7 @@
=head2 pending
If a connection has pending state, contains the callback that will
-recieve the next line of input.
+receive the next line of input.
=cut
@@ -537,6 +536,8 @@
$self->close;
die "Error printing\n";
}
+ warn "Connection is no longer me!" if $self->server->connection ne $self;
+ $self->server->{connection} = $self;
}
1;
Modified: Net-IMAP-Server/lib/Net/IMAP/Server/Mailbox.pm
==============================================================================
--- Net-IMAP-Server/lib/Net/IMAP/Server/Mailbox.pm (original)
+++ Net-IMAP-Server/lib/Net/IMAP/Server/Mailbox.pm Tue Mar 4 18:04:31 2008
@@ -461,6 +461,9 @@
my $self = shift;
my $str = shift;
+ # Otherwise $self->messages->[-1] explodes
+ return () unless @{$self->messages};
+
my %ids;
for ( split ',', $str ) {
if (/^(\d+):(\d+)$/) {
More information about the Bps-public-commit
mailing list