r35955 - in /trunk/libnet-imap-client-perl: META.yml debian/changelog debian/control debian/copyright 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:38:25 UTC 2009


Author: jawnsy-guest
Date: Wed May 20 04:38:19 2009
New Revision: 35955

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=35955
Log:
* New upstream release
  -> New feature to display show server namespaces (per RFC2342)
* Added /me to uploaders
* Cleaned up long description to remove some less relevant stuff
* Converted copyright to machine-readable format

Modified:
    trunk/libnet-imap-client-perl/META.yml
    trunk/libnet-imap-client-perl/debian/changelog
    trunk/libnet-imap-client-perl/debian/control
    trunk/libnet-imap-client-perl/debian/copyright
    trunk/libnet-imap-client-perl/lib/Net/IMAP/Client.pm
    trunk/libnet-imap-client-perl/lib/Net/IMAP/Client/MsgSummary.pm

Modified: trunk/libnet-imap-client-perl/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libnet-imap-client-perl/META.yml?rev=35955&op=diff
==============================================================================
--- trunk/libnet-imap-client-perl/META.yml (original)
+++ trunk/libnet-imap-client-perl/META.yml Wed May 20 04:38:19 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: trunk/libnet-imap-client-perl/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libnet-imap-client-perl/debian/changelog?rev=35955&op=diff
==============================================================================
--- trunk/libnet-imap-client-perl/debian/changelog (original)
+++ trunk/libnet-imap-client-perl/debian/changelog Wed May 20 04:38:19 2009
@@ -1,3 +1,13 @@
+libnet-imap-client-perl (0.93-1) unstable; urgency=low
+
+  * New upstream release
+    -> New feature to display show server namespaces (per RFC2342)
+  * Added /me to uploaders
+  * Cleaned up long description to remove some less relevant stuff
+  * Converted copyright to machine-readable format
+
+ -- Jonathan Yu <frequency at cpan.org>  Wed, 20 May 2009 00:29:56 -0400
+
 libnet-imap-client-perl (0.92-1) unstable; urgency=low
 
   * Initial Release.

Modified: trunk/libnet-imap-client-perl/debian/control
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libnet-imap-client-perl/debian/control?rev=35955&op=diff
==============================================================================
--- trunk/libnet-imap-client-perl/debian/control (original)
+++ trunk/libnet-imap-client-perl/debian/control Wed May 20 04:38:19 2009
@@ -4,7 +4,7 @@
 Build-Depends: debhelper (>= 5)
 Build-Depends-Indep: perl (>= 5.6.10-12), libio-socket-ssl-perl, liblist-moreutils-perl
 Maintainer: Debian Perl Group <pkg-perl-maintainers at lists.alioth.debian.org>
-Uploaders: Christoph Berg <myon at debian.org>
+Uploaders: Christoph Berg <myon at debian.org>, Jonathan Yu <frequency at cpan.org>
 Standards-Version: 3.8.1
 Homepage: http://search.cpan.org/dist/Net-IMAP-Client/
 Vcs-Svn: svn://svn.debian.org/pkg-perl/trunk/libnet-imap-client-perl/
@@ -13,17 +13,8 @@
 Package: libnet-imap-client-perl
 Architecture: all
 Depends: ${perl:Depends}, ${misc:Depends}, libio-socket-ssl-perl, liblist-moreutils-perl
-Description: Not so simple IMAP client library
- Net::IMAP::Client provides methods to access an IMAP server.  It aims
- to provide a simple and clean API, while employing a rigorous parser
- for IMAP responses in order to create Perl data structures from them.
- The code is simple, clean and extensible.
- .
- It started as an effort to improve Net::IMAP::Simple but then I
- realized that I needed to change a lot of code and API so I started it
- as a fresh module.  Still, the design is influenced by
- Net::IMAP::Simple and I even stole a few lines of code from it ;-)
- (very few, honestly).
- .
- This software was developed for creating a web-based email (IMAP)
- client: www.xuheki.com.  Xhueki uses Net::IMAP::Client.
+Description: Perl module to communicate with IMAP servers
+ Net::IMAP::Client provides methods to access an IMAP server. It aims to
+ provide a simple and clean API, while employing a rigorous parser for IMAP
+ responses in order to create Perl data structures from them. The code is
+ simple, clean and extensible.

Modified: trunk/libnet-imap-client-perl/debian/copyright
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libnet-imap-client-perl/debian/copyright?rev=35955&op=diff
==============================================================================
--- trunk/libnet-imap-client-perl/debian/copyright (original)
+++ trunk/libnet-imap-client-perl/debian/copyright Wed May 20 04:38:19 2009
@@ -1,40 +1,29 @@
-This is the debian package for the Net-IMAP-Client module.
-It was created by Christoph Berg <myon at debian.org> using dh-make-perl.
+Format-Specification:
+    http://wiki.debian.org/Proposals/CopyrightFormat?action=recall&rev=196
+Upstream-Maintainer: Mihai Bazon <mihai.bazon at gmail.com>
+Upstream-Source: http://search.cpan.org/dist/Net-IMAP-Client/
+Upstream-Name: Net-IMAP-Client
 
-It was downloaded from http://search.cpan.org/dist/Net-IMAP-Client/
+Files: *
+Copyright: 2008, Mihai Bazon <mihai.bazon at gmail.com>
+License-Alias: Perl
+License: Artistic | GPL-1+
 
-The upstream author is: Mihai Bazon <mihai.bazon at gmail.com>.
+Files: debian/*
+Copyright: 2009, Jonathan Yu <jonathan.i.yu at gmail.com>
+ 2009, Christoph Berg <myon at debian.org>
+License: Artistic | GPL-1+
 
+License: Artistic
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the Artistic License, which comes with Perl.
+    On Debian GNU/Linux systems, the complete text of the Artistic License
+    can be found in `/usr/share/common-licenses/Artistic'
 
-Copyright (c) Mihai Bazon 2008.  All rights reserved.
-
-This module is free software; you can redistribute it and/or modify it
-under the same terms as Perl itself.
-
-Perl is distributed under your choice of the GNU General Public License or
-the Artistic License.  On Debian GNU/Linux systems, the complete text of the
-GNU General Public License can be found in `/usr/share/common-licenses/GPL'
-and the Artistic Licence in `/usr/share/common-licenses/Artistic'.
-
-DISCLAIMER OF WARRANTY
-
-BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
-FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT
-WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER
-PARTIES PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND,
-EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
-SOFTWARE IS WITH YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME
-THE COST OF ALL NECESSARY SERVICING, REPAIR, OR CORRECTION.
-
-IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
-REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENCE, BE LIABLE
-TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL, OR
-CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
-SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
-RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
-FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
-SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
-DAMAGES.
+License: GPL-1+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 1, or (at your option)
+    any later version.
+    On Debian GNU/Linux systems, the complete text of the GNU General
+    Public License can be found in `/usr/share/common-licenses/GPL'

Modified: trunk/libnet-imap-client-perl/lib/Net/IMAP/Client.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libnet-imap-client-perl/lib/Net/IMAP/Client.pm?rev=35955&op=diff
==============================================================================
--- trunk/libnet-imap-client-perl/lib/Net/IMAP/Client.pm (original)
+++ trunk/libnet-imap-client-perl/lib/Net/IMAP/Client.pm Wed May 20 04:38:19 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: trunk/libnet-imap-client-perl/lib/Net/IMAP/Client/MsgSummary.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libnet-imap-client-perl/lib/Net/IMAP/Client/MsgSummary.pm?rev=35955&op=diff
==============================================================================
--- trunk/libnet-imap-client-perl/lib/Net/IMAP/Client/MsgSummary.pm (original)
+++ trunk/libnet-imap-client-perl/lib/Net/IMAP/Client/MsgSummary.pm Wed May 20 04:38:19 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