Skip Menu |

This queue is for tickets about the Mail-IMAPClient CPAN distribution.

Report information
The Basics
Id: 107593
Status: resolved
Priority: 0/
Queue: Mail-IMAPClient

People
Owner: PLOBBES [...] cpan.org
Requestors: gilles.lamiral [...] laposte.net
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: 3.38



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
Out of curiosity, instead of: $imap->getquota( '""' ) ; What happens when you send: $imap->getquota( '' ) ; OR $imap->getquota( "" ) ;
On Tue Oct 13 00:22:04 2015, PLOBBES wrote: Show quoted text
> Out of curiosity, instead of: > $imap->getquota( '""' ) ; > > What happens when you send: > $imap->getquota( '' ) ; > OR > $imap->getquota( "" ) ;
OK. Tested myself and it appears that the quota routines don't like the empty string being passed in. I'll update them to allow for that...
Subject: Re: [rt.cpan.org #107593] sub getquota send litteral with Gmail "" quotaroot. Instead of GETQUOTA ""
Date: Wed, 14 Oct 2015 23:46:18 +0200
To: bug-Mail-IMAPClient [...] rt.cpan.org
From: Gilles LAMIRAL <gilles.lamiral [...] laposte.net>
Hi Phil, The quota stuff should be simplified for the user of Mail-IMAPClient quota() and quota_usage() should find the quotaroot argument by default and apply getquota on it. Starting with the quotaroot of INBOX is the good way of a good default behaviour. Show quoted text
> OK. Tested myself and it appears that the quota routines don't like the empty string being passed in. I'll update them to allow for that... >
-- Au revoir, 09 51 84 42 42 Gilles Lamiral. France, Baulon (35580) 06 20 79 76 06
On Wed Oct 14 17:46:32 2015, gilles.lamiral@laposte.net wrote: Show quoted text
> Hi Phil, > > The quota stuff should be simplified for the user of Mail-IMAPClient > > quota() and quota_usage() should find the quotaroot argument by > default > and apply getquota on it. > > Starting with the quotaroot of INBOX is the > good way of a good default behaviour.
Let's break this out to a separate bug if you still want this (I expect you do). I'm using this bug to track getting getquota("") to work.
The fix to allow getquota("") was in commit 0a38f5c543cd0de3ba2359e8fd17ba491d832357 IIRC, but this additional commit includes test cases: commit ccd47404a6dba9615ae9e07b81ef5b300b50164a Author: Phil Pearl (Lobbes) <phil@perkpartners.com> Date: Mon Jan 4 20:20:10 2016 +0000 - noted fix for rt.cpan.org#107593: allow getquota("") - added t/quota.t and t/lib/MyTest.pm for testing - updated copyright for 2016 As noted in the previous comment, please open up a bug on quota and/or quota_usage if those methods don't give you the functionality you need.
Subject: Re: [rt.cpan.org #107593] sub getquota send litteral with Gmail "" quotaroot. Instead of GETQUOTA ""
Date: Tue, 5 Jan 2016 01:10:14 +0100
To: bug-Mail-IMAPClient [...] rt.cpan.org
From: Gilles LAMIRAL <gilles.lamiral [...] laposte.net>
Thanks for all those patches! On 04/01/2016 21:24, Phil Pearl (Lobbes) via RT wrote: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=107593 > > > The fix to allow getquota("") was in commit 0a38f5c543cd0de3ba2359e8fd17ba491d832357 IIRC, but this additional commit includes test cases: > > commit ccd47404a6dba9615ae9e07b81ef5b300b50164a > Author: Phil Pearl (Lobbes) <phil@perkpartners.com> > Date: Mon Jan 4 20:20:10 2016 +0000 > > - noted fix for rt.cpan.org#107593: allow getquota("") > - added t/quota.t and t/lib/MyTest.pm for testing > - updated copyright for 2016 > > As noted in the previous comment, please open up a bug on quota and/or quota_usage if those methods don't give you the functionality you need.
Ok. -- Au revoir, 09 51 84 42 42 Gilles Lamiral. France, Baulon (35580) 06 20 79 76 06
http://search.cpan.org/~plobbes/Mail-IMAPClient-3.38/ is out and include the fix for this bug.