Subject: | Should support "deleted" method |
Net::IMAP::Simple should support a "deleted" method, like the "seen"
method, so that deleted messages can be ignored. Attached patch adds
this functionality.
Subject: | Net-IMAP-Simple-1.17-deleted.patch |
--- lib/Net/IMAP/Simple.pm~ 2008-04-13 10:14:32.000000000 -0400
+++ lib/Net/IMAP/Simple.pm 2008-04-13 10:15:43.000000000 -0400
@@ -360,7 +360,8 @@
A message number is the only required parameter for this method. The message's
C<\Seen> flag will be examined and if the message has been seen a true
-value is returned. All other failures return a false value and the errstr() error handler is set with the error message.
+value is returned. All other failures return a false value and the errstr()
+error handler is set with the error message.
=cut
@@ -375,6 +376,28 @@
);
}
+=item deleted
+
+ print "Deleted!" if $imap->deleted( $message_number );
+
+A message number is the only required parameter for this method. The message's
+C<\Deleted> flag will be examined and if the message has been deleted a true
+value is returned. All other failures return a false value and the errstr()
+error handler is set with the error message.
+
+=cut
+
+sub deleted {
+ my ( $self, $number ) = @_;
+
+ my $lines = '';
+ $self->_process_cmd(
+ cmd => [FETCH=> qq[$number (FLAGS)]],
+ final => sub { $lines =~ /\\Deleted/i },
+ process => sub { $lines .= $_[0] },
+ );
+}
+
=pod
=item list