[Bps-public-commit] Net-IMAP-Server branch, master, updated. 1.20-4-g03ace00

Alex M Vandiver alexmv at bestpractical.com
Tue Jul 7 12:38:41 EDT 2009


The branch, master has been updated
       via  03ace00b7b62f985702448b45f960bb6098e8370 (commit)
       via  b1b368767e93a620312df498ca7391142e13e2ae (commit)
       via  4cd51017fb1c5dbc57b7c58542743b12688237c1 (commit)
      from  90b55538b71c22961a6d1649466172a391a66607 (commit)

Summary of changes:
 lib/Net/IMAP/Server/Connection.pm |   61 ++++++++++++++++++++----------------
 lib/Net/IMAP/Server/Mailbox.pm    |    2 +-
 lib/Net/IMAP/Server/Message.pm    |    9 +++--
 3 files changed, 40 insertions(+), 32 deletions(-)

- Log -----------------------------------------------------------------
commit 4cd51017fb1c5dbc57b7c58542743b12688237c1
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Fri Apr 17 00:43:18 2009 -0400

    Remove mostly undocumented an no-servicable-parts session_flags

diff --git a/lib/Net/IMAP/Server/Connection.pm b/lib/Net/IMAP/Server/Connection.pm
index c515d4f..3e3d3fd 100644
--- a/lib/Net/IMAP/Server/Connection.pm
+++ b/lib/Net/IMAP/Server/Connection.pm
@@ -547,17 +547,6 @@ sub capability {
     return $base;
 }
 
-=head2 session_flags MESSAGE
-
-=cut
-
-sub session_flags {
-    my $self = shift;
-    my ($message) = shift;
-    $self->_session_flags->{$message . ""} ||= {};
-    return $self->_session_flags->{$message . ""};
-}
-
 =head2 log MESSAGE
 
 Logs the message to standard error, using C<warn>.
diff --git a/lib/Net/IMAP/Server/Message.pm b/lib/Net/IMAP/Server/Message.pm
index df4aef1..8958318 100644
--- a/lib/Net/IMAP/Server/Message.pm
+++ b/lib/Net/IMAP/Server/Message.pm
@@ -121,7 +121,8 @@ sub copy {
 
 =head2 session_flags
 
-Returns the list of flags that are stored per-session.
+Returns the names of flags that are stored per-session.  Defaults to
+only the C<\Recent> flag.
 
 =cut
 
@@ -133,7 +134,7 @@ sub _session_flags {
     my $self = shift;
     my $conn = Net::IMAP::Server->connection;
     return {} unless $conn;
-    return $conn->session_flags($self) || {};
+    return $conn->_session_flags->{$self} || {};
 }
 
 =head2 set_flag FLAG [, SILENT]

commit b1b368767e93a620312df498ca7391142e13e2ae
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Fri Apr 17 01:33:01 2009 -0400

    untagged_* renamed to _unsent_* (and thus private)

diff --git a/lib/Net/IMAP/Server/Connection.pm b/lib/Net/IMAP/Server/Connection.pm
index 3e3d3fd..ecf55d1 100644
--- a/lib/Net/IMAP/Server/Connection.pm
+++ b/lib/Net/IMAP/Server/Connection.pm
@@ -35,13 +35,13 @@ sub new {
     my $class = shift;
     my $self  = $class->SUPER::new(
         {   @_,
-            state            => "unauth",
-            untagged_expunge => [],
-            untagged_fetch   => {},
-            last_poll        => time,
-            commands         => 0,
-            coro             => $Coro::current,
-            _session_flags   => {},
+            state           => "unauth",
+            _unsent_expunge => [],
+            _unsent_fetch   => {},
+            last_poll       => time,
+            commands        => 0,
+            coro            => $Coro::current,
+            _session_flags  => {},
         }
     );
     $self->update_timer;
@@ -440,32 +440,32 @@ sub send_untagged {
         $self->in_poll(0);
     }
 
-    for my $s ( keys %{ $self->untagged_fetch } ) {
+    for my $s ( keys %{ $self->_unsent_fetch } ) {
         my ($m) = $self->get_messages($s);
         $self->untagged_response(
                   $s 
                 . " FETCH "
                 . Net::IMAP::Server::Command->data_out(
-                [ $m->fetch( [ keys %{ $self->untagged_fetch->{$s} } ] ) ]
+                [ $m->fetch( [ keys %{ $self->_unsent_fetch->{$s} } ] ) ]
                 )
         );
     }
-    $self->untagged_fetch( {} );
+    $self->_unsent_fetch( {} );
 
     if ( $args{expunged} ) {
 
 # Make sure that they know of at least the existence of what's being expunged.
         my $max = 0;
-        $max = $max < $_ ? $_ : $max for @{ $self->untagged_expunge };
+        $max = $max < $_ ? $_ : $max for @{ $self->_unsent_expunge };
         $self->untagged_response("$max EXISTS")
             if $max > $self->previous_exists;
 
         # Send the expunges, clear out the temporary message store
         $self->previous_exists(
-            $self->previous_exists - @{ $self->untagged_expunge } );
+            $self->previous_exists - @{ $self->_unsent_expunge } );
         $self->untagged_response( map {"$_ EXPUNGE"}
-                @{ $self->untagged_expunge } );
-        $self->untagged_expunge( [] );
+                @{ $self->_unsent_expunge } );
+        $self->_unsent_expunge( [] );
         $self->temporary_messages(undef);
     }
 
diff --git a/lib/Net/IMAP/Server/Mailbox.pm b/lib/Net/IMAP/Server/Mailbox.pm
index 28bd8e4..4511f71 100644
--- a/lib/Net/IMAP/Server/Mailbox.pm
+++ b/lib/Net/IMAP/Server/Mailbox.pm
@@ -304,7 +304,7 @@ sub expunge {
     for my $c ( Net::IMAP::Server->concurrent_mailbox_connections($self) ) {
 
         # Also, each connection gets these added to their expunge list
-        push @{ $c->untagged_expunge }, @ids;
+        push @{ $c->_unsent_expunge }, @ids;
     }
 
     return 1;
diff --git a/lib/Net/IMAP/Server/Message.pm b/lib/Net/IMAP/Server/Message.pm
index 8958318..d054316 100644
--- a/lib/Net/IMAP/Server/Message.pm
+++ b/lib/Net/IMAP/Server/Message.pm
@@ -163,7 +163,7 @@ sub set_flag {
             )
             )
         {
-            $c->untagged_fetch->{ $c->sequence($self) }{FLAGS}++
+            $c->_unsent_fetch->{ $c->sequence($self) }{FLAGS}++
                 unless $c->ignore_flags;
         }
     }
@@ -197,7 +197,7 @@ sub clear_flag {
             )
             )
         {
-            $c->untagged_fetch->{ $c->sequence($self) }{FLAGS}++
+            $c->_unsent_fetch->{ $c->sequence($self) }{FLAGS}++
                 unless $c->ignore_flags;
         }
     }

commit 03ace00b7b62f985702448b45f960bb6098e8370
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Fri Apr 17 01:34:14 2009 -0400

    A bit more documentation of accessors

diff --git a/lib/Net/IMAP/Server/Connection.pm b/lib/Net/IMAP/Server/Connection.pm
index ecf55d1..52cea1d 100644
--- a/lib/Net/IMAP/Server/Connection.pm
+++ b/lib/Net/IMAP/Server/Connection.pm
@@ -12,7 +12,18 @@ use Net::IMAP::Server::Error;
 use Net::IMAP::Server::Command;
 
 __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 last_poll in_poll commands timer coro _session_flags)
+    qw(server coro io_handle model auth
+       timer commands pending
+       selected_read_only
+       _selected
+
+       temporary_messages temporary_sequence_map
+       ignore_flags
+       _session_flags
+
+       last_poll previous_exists in_poll
+       _unsent_expunge _unsent_fetch
+       )
 );
 
 =head1 NAME
@@ -209,6 +220,10 @@ sub update_timer {
 
 Returns the L<EV> watcher in charge of the inactivity timer.
 
+=head2 commands
+
+Returns the number of client commands the connection has processed.
+
 =head2 handle_command
 
 Handles a single line from the client.  This is not quite the same as
@@ -415,7 +430,10 @@ sub force_poll {
 Gets or sets the last time the selected mailbox was polled, in seconds
 since the epoch.
 
-=cut
+=head2 previous_exists
+
+The high-water mark of how many messages the client has been told are
+in the mailbox.
 
 =head2 send_untagged
 

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



More information about the Bps-public-commit mailing list