Use GETQUOTAROOT instead of GETQUOTA.

* At least with my ISP, there is no "" root, so the command would fail when used
  as is.
* Now we always use the GETQUOTAROOT command instead, by default for the INBOX
  mailbox. This isn't entirely correct either, but better than nothing.
This commit is contained in:
Axel Dörfler
2015-01-06 15:20:49 +01:00
parent f1c9cc4292
commit cc3aa99cb3
2 changed files with 10 additions and 6 deletions
@@ -740,7 +740,7 @@ GetQuotaCommand::GetQuotaCommand(const char* mailboxName)
BString
GetQuotaCommand::CommandString()
{
BString command = "GETQUOTA \"";
BString command = "GETQUOTAROOT \"";
command += fMailboxName;
command += "\"";
return command;
@@ -750,12 +750,15 @@ GetQuotaCommand::CommandString()
bool
GetQuotaCommand::HandleUntagged(Response& response)
{
if (!response.IsCommand("QUOTA") || response.IsListAt(1))
if (!response.IsCommand("QUOTA") || !response.IsListAt(2))
return false;
const ArgumentList& arguments = response.ListAt(1);
fUsedStorage = (uint64)arguments.NumberAt(0) * 1024;
fTotalStorage = (uint64)arguments.NumberAt(1) * 1024;
const ArgumentList& arguments = response.ListAt(2);
if (!arguments.EqualsAt(0, "STORAGE"))
return false;
fUsedStorage = (uint64)arguments.NumberAt(1) * 1024;
fTotalStorage = (uint64)arguments.NumberAt(2) * 1024;
return true;
}
@@ -289,7 +289,8 @@ private:
class GetQuotaCommand : public Command, public Handler {
public:
GetQuotaCommand(const char* mailboxName = "");
GetQuotaCommand(
const char* mailboxName = "INBOX");
BString CommandString();
bool HandleUntagged(Response& response);