Subject: | sub getquota send litteral with Gmail "" quotaroot. Instead of GETQUOTA "" |
Date: | Wed, 7 Oct 2015 02:25:29 +0200 |
To: | bug-Mail-IMAPClient [...] rt.cpan.org |
From: | Gilles LAMIRAL <gilles.lamiral [...] laposte.net> |
Hi Phil,
I'm currently working on reading/using quota.
sub getquotaroot() is ok.
sub getquota is not ok with Gmail because the Gmail quotaroot is ""
so the getquota call is getquota('""') and Mail::IMAPClient 3.37
send the QUOTA command with a literal.
I guess the right command would be
3 QUOTA ""
instead of literal
3 GETQUOTA {2}
""
In fact I've tested manually and it worked:
6 GETQUOTA ""
* QUOTA "" (STORAGE 6095 15728640)
6 OK Success
How to avoid sending literal in that case?
Thanks in advance.
Example:
gilles@petite:~/public_html/imapsync/W/learn 55$ ./imapclient_quota_qq_memo
Mail::IMAPClient::VERSION 3.37
Connecting with IO::Socket::SSL PeerAddr imap.gmail.com PeerPort 993 Proto tcp Timeout 600 Debug 1
Connected to imap.gmail.com
Read: * OK Gimap ready for requests from 2a01:e34:ecde:70d0:2c33:2e01:fb07:6857 t197mb122870937wle
Sending: 1 LOGIN XXXXXXXX XXXXXXXX_Showcredentials_is_off
Sent 40 bytes
Read: * CAPABILITY IMAP4rev1 UNSELECT IDLE NAMESPACE QUOTA ID XLIST CHILDREN X-GM-EXT-1 UIDPLUS COMPRESS=DEFLATE ENABLE MOVE CONDSTORE ESEARCH UTF8=ACCEPT LIST-EXTENDED LIST-STATUS
1 OK imapsync.gl@gmail.com authenticated (Success)
Sending: 2 GETQUOTAROOT INBOX
Sent 22 bytes
Read: * QUOTAROOT "INBOX" ""
* QUOTA "" (STORAGE 6095 15728640)
2 OK Success
Sending literal: 3 GETQUOTA {2}
then: ""
Sending: 3 GETQUOTA {2}
Sent 16 bytes
Read: + go ahead
Sending: ""
Sent 4 bytes
Read: 3 NO [NONEXISTENT] No such quota root. (Failure)
ERROR: 3 NO [NONEXISTENT] No such quota root. (Failure) at /g/public_html/imapsync/W/Mail-IMAPClient-3.37/lib//Mail/IMAPClient.pm line 1365
Mail::IMAPClient::__ANON__('3 NO [NONEXISTENT] No such quota root. (Failure)\x{d}\x{a}') called at /g/public_html/imapsync/W/Mail-IMAPClient-3.37/lib//Mail/IMAPClient.pm line 1401
Mail::IMAPClient::_get_response('Mail::IMAPClient=HASH(0x8c72b94)', 3, undef) called at /g/public_html/imapsync/W/Mail-IMAPClient-3.37/lib//Mail/IMAPClient.pm line 1327
Mail::IMAPClient::_imap_command_do('Mail::IMAPClient=HASH(0x8c72b94)', 'GETQUOTA {2}\x{d}\x{a}""') called at /g/public_html/imapsync/W/Mail-IMAPClient-3.37/lib//Mail/IMAPClient.pm line 1225
Mail::IMAPClient::_imap_command('Mail::IMAPClient=HASH(0x8c72b94)', 'GETQUOTA {2}\x{d}\x{a}""') called at /g/public_html/imapsync/W/Mail-IMAPClient-3.37/lib//Mail/IMAPClient.pm line 3337
Mail::IMAPClient::getquota('Mail::IMAPClient=HASH(0x8c72b94)', '""') called at ./imapclient_quota_qq line 29
ERROR: 3 NO [NONEXISTENT] No such quota root. (Failure) at /g/public_html/imapsync/W/Mail-IMAPClient-3.37/lib//Mail/IMAPClient.pm line 1274
Mail::IMAPClient::_imap_command('Mail::IMAPClient=HASH(0x8c72b94)', 'GETQUOTA {2}\x{d}\x{a}""') called at /g/public_html/imapsync/W/Mail-IMAPClient-3.37/lib//Mail/IMAPClient.pm line 3337
Mail::IMAPClient::getquota('Mail::IMAPClient=HASH(0x8c72b94)', '""') called at ./imapclient_quota_qq line 29
Sending: 4 LOGOUT
Sent 10 bytes
Read: * BYE LOGOUT Requested
4 OK 73 good day (Success)
Here is the code used for this session:
gilles@petite:~/public_html/imapsync/W/learn 57$ cat ./imapclient_quota_qq
#!/usr/bin/perl -w
use lib '/g/public_html/imapsync/W/Mail-IMAPClient-3.37/lib/' ;
use Mail::IMAPClient;
$ARGV[3] or die "usage: $0 host user password quotaroot\n";
$host = $ARGV[0];
$user = $ARGV[1];
$password = $ARGV[2];
$quotaroot = $ARGV[3];
print "Mail::IMAPClient::VERSION $Mail::IMAPClient::VERSION\n" ;
my $imap = Mail::IMAPClient->new( ) ;
$imap->Debug( 1 ) ;
$imap->Server( $host ) ;
$imap->Ssl( 1 ) ;
$imap->Showcredentials( 0 ) ;
$imap->connect( ) or die ;
$imap->IsUnconnected( ) ;
$imap->User( $user ) ;
$imap->Password( $password ) ;
$imap->login( ) or die ;
$imap->Uid( 1 ) ;
$imap->Peek( 1 ) ;
$imap->getquotaroot( $quotaroot ) ;
$imap->getquota( '""' ) ;
$imap->logout( ) ;
gilles@petite:~/public_html/imapsync/W/learn 58$
--
Au revoir, 09 51 84 42 42
Gilles Lamiral. France, Baulon (35580) 06 20 79 76 06