[Bps-public-commit] r12537 - in Net-IMAP-Server: lib/Net/IMAP lib/Net/IMAP/Server lib/Net/IMAP/Server/Command
alexmv at bestpractical.com
alexmv at bestpractical.com
Mon May 19 13:33:56 EDT 2008
Author: alexmv
Date: Mon May 19 13:33:55 2008
New Revision: 12537
Modified:
Net-IMAP-Server/ (props changed)
Net-IMAP-Server/Changes
Net-IMAP-Server/META.yml
Net-IMAP-Server/SIGNATURE
Net-IMAP-Server/lib/Net/IMAP/Server.pm
Net-IMAP-Server/lib/Net/IMAP/Server/Command/Status.pm
Net-IMAP-Server/lib/Net/IMAP/Server/Connection.pm
Net-IMAP-Server/lib/Net/IMAP/Server/Mailbox.pm
Net-IMAP-Server/lib/Net/IMAP/Server/Message.pm
Log:
r31952 at kohr-ah: chmrr | 2008-05-19 13:33:34 -0400
* Per-session message flags actually stored on the session
* STATUS is now on the mailbox
* Version bump to 0.7
Modified: Net-IMAP-Server/Changes
==============================================================================
--- Net-IMAP-Server/Changes (original)
+++ Net-IMAP-Server/Changes Mon May 19 13:33:55 2008
@@ -1,5 +1,12 @@
Revision history for Net-IMAP-Server
+0.7 Mon May 19 13:30:17 2008
+ * Per-session message flags actually stored on the session
+ * STATUS is now on the mailbox
+
+0.6 Fri May 16 13:29:12 2008
+ * Add missing Net::SSLeay dep
+
0.5 Fri Apr 25 12:18:17 2008
* Add 'use Coro's for the places I added 'cede's
* Module::Install version bump
Modified: Net-IMAP-Server/META.yml
==============================================================================
--- Net-IMAP-Server/META.yml (original)
+++ Net-IMAP-Server/META.yml Mon May 19 13:33:55 2008
@@ -25,4 +25,4 @@
Net::Server::Coro: 0.2
Regexp::Common: 0
Test::More: 0
-version: 0.6
+version: 0.7
Modified: Net-IMAP-Server/SIGNATURE
==============================================================================
--- Net-IMAP-Server/SIGNATURE (original)
+++ Net-IMAP-Server/SIGNATURE Mon May 19 13:33:55 2008
@@ -14,9 +14,9 @@
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
-SHA1 f09a1cdccafefa0084ed8f1b802bcff5ed2c3e6c Changes
+SHA1 7cd3c7053c2d8fd4f788c86d5afc0edb1bbbbb21 Changes
SHA1 7f0204b961ae6c19de6b53d0fe903fbfdcdd7b4e MANIFEST
-SHA1 c8693b98cdc3883adf251a6da36944d2ac9a9486 META.yml
+SHA1 becb487d174a1dff2f005de6ebcf0e8d56447c2a META.yml
SHA1 c595b7a85778ce02fbbe16df66823f9848d9917c Makefile.PL
SHA1 f4c6e4793fd7815aec4abfcd69018d8f34d832a8 README
SHA1 f5333026061a6f347e7f2a3ce8bb6847081c200c certs/server-cert.pem
@@ -29,7 +29,7 @@
SHA1 7d3be9b158e37b2b2c22084740099955623b1d56 inc/Module/Install/Metadata.pm
SHA1 0a8b66180229ba2f9deaea1fedd0aacf7a7ace6b inc/Module/Install/Win32.pm
SHA1 d3352eb33fe43a5f3ead513f645224fe34d73bc9 inc/Module/Install/WriteAll.pm
-SHA1 05d15ef414c68483860fa17defed0d50086521b9 lib/Net/IMAP/Server.pm
+SHA1 00376085afcb41d5aa722d90e2985b9b732ef54f lib/Net/IMAP/Server.pm
SHA1 a9b20e80cfe76e9fed6b3703818306950669a839 lib/Net/IMAP/Server/Command.pm
SHA1 636e390f8f44ee6c51321220a44c20ceba08b44d lib/Net/IMAP/Server/Command/Append.pm
SHA1 5c203d47099444ceb8ce9e8927353d91ba0545cd lib/Net/IMAP/Server/Command/Authenticate.pm
@@ -52,23 +52,23 @@
SHA1 c26ac00f5af0d972516f3f40132489ec026fecb9 lib/Net/IMAP/Server/Command/Search.pm
SHA1 6b6ee1ca3592b901e5062fcc6d457f1c730e95f3 lib/Net/IMAP/Server/Command/Select.pm
SHA1 3e9a1813eb89b3c311ee61907c5cdc44a177f321 lib/Net/IMAP/Server/Command/Starttls.pm
-SHA1 2aaa47d33fe5ddf4f90d011fb5d7e620ba06a247 lib/Net/IMAP/Server/Command/Status.pm
+SHA1 46d29fc4c67ee0e90ddf0a8d018bb8d1545856ed lib/Net/IMAP/Server/Command/Status.pm
SHA1 5f525299848e3b91d093d3e301d01414b0fdacd1 lib/Net/IMAP/Server/Command/Store.pm
SHA1 3fbb8ce46e696eeb62a97264cb564924a7ccfb57 lib/Net/IMAP/Server/Command/Subscribe.pm
SHA1 c73f4ad4b6177c7efacca44f09b6629a35b63c04 lib/Net/IMAP/Server/Command/Uid.pm
SHA1 4591be8d501ea8877f3b4d4418620cce094256ab lib/Net/IMAP/Server/Command/Unsubscribe.pm
-SHA1 2b5d068deef37010684314a9ef9c7e813620d10e lib/Net/IMAP/Server/Connection.pm
+SHA1 e7bf82b80d0dbfa7c0d15d2fd74df219923785a6 lib/Net/IMAP/Server/Connection.pm
SHA1 9620a310714838ab773e55946ce4136404ce5170 lib/Net/IMAP/Server/DefaultAuth.pm
SHA1 863a191e5f4b30eca0e48ba4a34cbab13dcd38c2 lib/Net/IMAP/Server/DefaultModel.pm
-SHA1 570f55a01f3beeaec888eee013dea9a1296e6ab0 lib/Net/IMAP/Server/Mailbox.pm
-SHA1 cb4ca954b45210d45dd92e80b31640276fcb5252 lib/Net/IMAP/Server/Message.pm
+SHA1 cf3cc44266582faad996c5b5997363cd2c4b65f4 lib/Net/IMAP/Server/Mailbox.pm
+SHA1 bbd36c1a61811bbfb1dde55ec279f2a4fc954426 lib/Net/IMAP/Server/Message.pm
SHA1 2e67e318edc490da7367ebcc789d35d0810e00e6 t/00.load.t
SHA1 ec035a09e3f370620874e9c706d6c8ae4bdfa6a1 t/pod-coverage.t
SHA1 0190346d7072d458c8a10a45c19f86db641dcc48 t/pod.t
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.9 (GNU/Linux)
-iEYEARECAAYFAkgtxEcACgkQMflWJZZAbqCmVQCgt5YDKpg2MPALU+Ed7SuGRLp8
-YRkAoJvKxo1uY8UbKGulo3qBB387iFL3
-=XtJK
+iEYEARECAAYFAkgxucAACgkQMflWJZZAbqBePwCdGNarfr+rIheaWtN05dFG5iXw
+nPwAnRg8v+hukIVgVFN4NXcFB9x5Cvq+
+=RU8B
-----END PGP SIGNATURE-----
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 Mon May 19 13:33:55 2008
@@ -8,7 +8,7 @@
use UNIVERSAL::require;
use Coro;
-our $VERSION = '0.6';
+our $VERSION = '0.7';
=head1 NAME
Modified: Net-IMAP-Server/lib/Net/IMAP/Server/Command/Status.pm
==============================================================================
--- Net-IMAP-Server/lib/Net/IMAP/Server/Command/Status.pm (original)
+++ Net-IMAP-Server/lib/Net/IMAP/Server/Command/Status.pm Mon May 19 13:33:55 2008
@@ -29,41 +29,8 @@
my ( $name, $flags ) = $self->parsed_options;
my $mailbox = $self->connection->model->lookup( $name );
- $mailbox->poll;
- my %items;
- $items{ uc $_ } = undef for @{$flags};
-
- for my $i ( keys %items ) {
- if ( $i eq "MESSAGES" ) {
- $items{$i} = $mailbox->exists;
- } elsif ( $i eq "RECENT" ) {
- $items{$i} = $mailbox->recent;
- } elsif ( $i eq "UNSEEN" ) {
- my $unseen = $mailbox->unseen;
- if ( defined $unseen ) {
- $items{$i} = $unseen;
- } else {
- delete $items{$i};
- }
- } elsif ( $i eq "UIDVALIDITY" ) {
- my $uidvalidity = $mailbox->uidvalidity;
- if ( defined $uidvalidity ) {
- $items{$i} = $uidvalidity;
- } else {
- delete $items{$i};
- }
- } elsif ( $i eq "UIDNEXT" ) {
- my $uidnext = $mailbox->uidnext;
- if ( defined $uidnext ) {
- $items{$i} = $uidnext;
- } else {
- delete $items{$i};
- }
- } else {
- delete $items{$i};
- }
- }
+ my %items = $mailbox->status(map {uc $_} @{$flags});
$self->untagged_response( "STATUS ".$self->data_out({type=>"string", value => $name}) . " "
. $self->data_out([map {(\$_, $items{$_})}keys %items]) );
$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 Mon May 19 13:33:55 2008
@@ -11,7 +11,7 @@
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)
+ 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)
);
=head1 NAME
@@ -40,6 +40,7 @@
last_poll => time,
commands => 0,
coro => $Coro::current,
+ _session_flags => {},
}
);
$self->update_timer;
@@ -487,6 +488,17 @@
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>.
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 Mon May 19 13:33:55 2008
@@ -315,6 +315,34 @@
return $m;
}
+=head3 status
+
+=cut
+
+sub status {
+ my $self = shift;
+ my (@keys) = @_;
+ $self->poll;
+ my %items;
+ for my $i ( @keys ) {
+ if ( $i eq "MESSAGES" ) {
+ $items{$i} = $self->exists;
+ } elsif ( $i eq "RECENT" ) {
+ $items{$i} = $self->recent;
+ } elsif ( $i eq "UNSEEN" ) {
+ my $unseen = $self->unseen;
+ $items{$i} = $unseen if defined $unseen;
+ } elsif ( $i eq "UIDVALIDITY" ) {
+ my $uidvalidity = $self->uidvalidity;
+ $items{$i} = $uidvalidity if defined $uidvalidity;
+ } elsif ( $i eq "UIDNEXT" ) {
+ my $uidnext = $self->uidnext;
+ $items{$i} = $uidnext if defined $uidnext;
+ }
+ }
+ return %items;
+}
+
=head3 close
Called when the client selects a different mailbox, or when the
Modified: Net-IMAP-Server/lib/Net/IMAP/Server/Message.pm
==============================================================================
--- Net-IMAP-Server/lib/Net/IMAP/Server/Message.pm (original)
+++ Net-IMAP-Server/lib/Net/IMAP/Server/Message.pm Mon May 19 13:33:55 2008
@@ -119,6 +119,23 @@
return $clone;
}
+=head2 session_flags
+
+Returns the list of flags that are stored per-session.
+
+=cut
+
+sub session_flags {
+ return ('\Recent');
+}
+
+sub _session_flags {
+ my $self = shift;
+ my $conn = $Net::IMAP::Server::Server->connection;
+ return {} unless $conn;
+ return $conn->session_flags($self) || {};
+}
+
=head2 set_flag FLAG [, SILENT]
Sets the given flag on the message; if a true value is passed for
@@ -131,8 +148,11 @@
my $self = shift;
my ( $flag, $silent ) = @_;
$flag = $FLAGS{ lc $flag } || $flag;
- my $old = exists $self->_flags->{$flag};
- $self->_flags->{$flag} = 1;
+
+ my $hash = (grep $flag eq $_, $self->session_flags) ? $self->_session_flags : $self->_flags;
+
+ my $old = exists $hash->{$flag};
+ $hash->{$flag} = 1;
my $changed = not $old;
if ( $changed and not $silent ) {
@@ -162,8 +182,11 @@
my $self = shift;
my ( $flag, $silent ) = @_;
$flag = $FLAGS{ lc $flag } || $flag;
- my $old = exists $self->_flags->{$flag};
- delete $self->_flags->{$flag};
+
+ my $hash = (grep $flag eq $_, $self->session_flags) ? $self->_session_flags : $self->_flags;
+
+ my $old = exists $hash->{$flag};
+ delete $hash->{$flag};
my $changed = $old;
if ( $changed and not $silent ) {
@@ -191,7 +214,10 @@
my $self = shift;
my $flag = shift;
$flag = $FLAGS{ lc $flag } || $flag;
- return exists $self->_flags->{$flag};
+
+ my $hash = (grep $flag eq $_, $self->session_flags) ? $self->_session_flags : $self->_flags;
+
+ return exists $hash->{$flag};
}
=head2 flags
@@ -202,7 +228,8 @@
sub flags {
my $self = shift;
- return sort keys %{ $self->_flags };
+ my %flags = ( %{ $self->_flags }, %{ $self->_session_flags } );
+ return sort keys %flags;
}
=head2 store STRING FLAGS
More information about the Bps-public-commit
mailing list