r35953 - in /branches/upstream/libnet-imap-client-perl/current: META.yml lib/Net/IMAP/Client.pm lib/Net/IMAP/Client/MsgSummary.pm
jawnsy-guest at users.alioth.debian.org
jawnsy-guest at users.alioth.debian.org
Wed May 20 04:30:20 UTC 2009
Author: jawnsy-guest
Date: Wed May 20 04:30:15 2009
New Revision: 35953
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=35953
Log:
[svn-upgrade] Integrating new upstream version, libnet-imap-client-perl (0.93)
Modified:
branches/upstream/libnet-imap-client-perl/current/META.yml
branches/upstream/libnet-imap-client-perl/current/lib/Net/IMAP/Client.pm
branches/upstream/libnet-imap-client-perl/current/lib/Net/IMAP/Client/MsgSummary.pm
Modified: branches/upstream/libnet-imap-client-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libnet-imap-client-perl/current/META.yml?rev=35953&op=diff
==============================================================================
--- branches/upstream/libnet-imap-client-perl/current/META.yml (original)
+++ branches/upstream/libnet-imap-client-perl/current/META.yml Wed May 20 04:30:15 2009
@@ -1,6 +1,6 @@
--- #YAML:1.0
name: Net-IMAP-Client
-version: 0.92
+version: 0.93
abstract: Not so simple IMAP client library
license: ~
author:
Modified: branches/upstream/libnet-imap-client-perl/current/lib/Net/IMAP/Client.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libnet-imap-client-perl/current/lib/Net/IMAP/Client.pm?rev=35953&op=diff
==============================================================================
--- branches/upstream/libnet-imap-client-perl/current/lib/Net/IMAP/Client.pm (original)
+++ branches/upstream/libnet-imap-client-perl/current/lib/Net/IMAP/Client.pm Wed May 20 04:30:15 2009
@@ -1,7 +1,7 @@
package Net::IMAP::Client;
use vars qw[$VERSION];
-$VERSION = '0.92';
+$VERSION = '0.93';
use strict;
use warnings;
@@ -198,6 +198,33 @@
return undef;
}
+sub _mk_namespace {
+ my ($ns) = @_;
+ if ($ns) {
+ foreach my $i (@$ns) {
+ $i = {
+ prefix => $i->[0],
+ sep => $i->[1],
+ };
+ }
+ }
+ return $ns;
+}
+
+sub namespace {
+ my ($self) = @_;
+ my ($ok, $lines) = $self->_tell_imap('NAMESPACE');
+ if ($ok) {
+ my $ret = _parse_tokens($lines->[0]);
+ splice(@$ret, 0, 2);
+ return {
+ personal => _mk_namespace($ret->[0]),
+ other => _mk_namespace($ret->[1]),
+ shared => _mk_namespace($ret->[2]),
+ };
+ }
+}
+
sub folders_more {
my ($self) = @_;
my ($ok, $lines) = $self->_tell_imap(LIST => '"" "*"');
@@ -601,6 +628,9 @@
sub _socket_write {
my $self = shift;
+ # open LOG, '>>:raw', '/tmp/net-imap-client.log';
+ # print LOG @_;
+ # close LOG;
$self->_get_socket->write(@_);
}
@@ -1033,9 +1063,9 @@
}, [ 'SUBJECT', '^DATE' ]);
# fetch message summaries (actually, a lot more)
- my @summaries = $imap->get_summaries([ @msg_ids ]);
-
- foreach (@summaries) {
+ my $summaries = $imap->get_summaries([ @msg_ids ]);
+
+ foreach (@$summaries) {
print $_->uid, $_->subject, $_->date, $_->rfc822_size;
print join(', ', @{$_->from}); # etc.
}
@@ -1255,6 +1285,27 @@
- sep -- one character containing folder hierarchy separator
- name -- folder name (same as the key -- thus redundant)
+=head2 namespace
+
+Returns an hash reference containing the namespaces for this server
+(see RFC 2342). Since the RFC defines 3 possible types of namespaces,
+the hash contains the following keys:
+
+ - `personal' -- the personal namespace
+ - `other' -- "other users" namespace
+ - `shared' -- shared namespace
+
+Each one can be I<undef> if the server returned "NIL", or an array
+reference. If an array reference, each element is in the form:
+
+ {
+ sep => '.',
+ prefix => 'INBOX.'
+ }
+
+(I<sep> is the separator for this hierarchy, and I<prefix> is the
+prefix).
+
=head2 seq_to_uid(@sequence_ids)
I recommend usage of UID-s only (see L</uid_mode>) but this isn't
@@ -1374,7 +1425,7 @@
way to decode it is use Email::MIME::Encodings, i.e.:
use Email::MIME::Encodings;
- my $summary = $imap->get_summaries(10);
+ my $summary = $imap->get_summaries(10)->[0];
my $part = $summary->get_subpart('1.1');
my $body = $imap->get_part_body('1.1');
my $cte = $part->transfer_encoding; # Content-Transfer-Encoding
@@ -1400,18 +1451,17 @@
(C<$headers> is optional).
Fetches, parses and returns "message summaries". $msg can be an array
-ref, or a single id. The return value is an array reference (in
-scalar context) or a list. If a single message was passed, then in
-scalar context it returns only that message (not an array ref).
+ref, or a single id. The return value is always an array reference,
+even if a single message is queried.
If $headers is passed, it must be a string containing name(s) of the
header fields to fetch (space separated). Example:
$imap->get_summaries([1, 2, 3], 'References X-Original-To')
-The result contains one or more L<Net::IMAP::Client::MsgSummary>
-objects. The best way to understand the result is to actually call
-this function and use Data::Dumper to see its structure.
+The result contains L<Net::IMAP::Client::MsgSummary> objects. The
+best way to understand the result is to actually call this function
+and use Data::Dumper to see its structure.
Following is the output for a pretty complicated message, which
contains an HTML part with an embedded image and an attached message.
Modified: branches/upstream/libnet-imap-client-perl/current/lib/Net/IMAP/Client/MsgSummary.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libnet-imap-client-perl/current/lib/Net/IMAP/Client/MsgSummary.pm?rev=35953&op=diff
==============================================================================
--- branches/upstream/libnet-imap-client-perl/current/lib/Net/IMAP/Client/MsgSummary.pm (original)
+++ branches/upstream/libnet-imap-client-perl/current/lib/Net/IMAP/Client/MsgSummary.pm Wed May 20 04:30:15 2009
@@ -190,7 +190,7 @@
$self->{transfer_encoding} = $struct->[5];
$self->{encoded_size} = $struct->[6];
- if ($self->is_message) {
+ if ($self->is_message && $struct->[7] && $struct->[8]) {
# continue parsing attached message
$self->_parse_envelope($struct->[7]);
$self->_parse_body($struct->[8]);
@@ -233,7 +233,7 @@
$self->{transfer_encoding} = $struct->[5];
$self->{encoded_size} = $struct->[6];
- if ($self->is_message) {
+ if ($self->is_message && $struct->[7] && $struct->[8]) {
# continue parsing attached message
$self->_parse_envelope($struct->[7]);
$self->_parse_bodystructure($struct->[8]);
More information about the Pkg-perl-cvs-commits
mailing list