From cc3aa99cb3ca7796ae4a199e445608fc478d4f45 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Thu, 5 Jan 2012 23:03:20 +0100 Subject: [PATCH] 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. --- .../inbound_protocols/imap/imap_lib/Commands.cpp | 13 ++++++++----- .../inbound_protocols/imap/imap_lib/Commands.h | 3 ++- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/add-ons/mail_daemon/inbound_protocols/imap/imap_lib/Commands.cpp b/src/add-ons/mail_daemon/inbound_protocols/imap/imap_lib/Commands.cpp index 50c2ab71b1..114b12b2bd 100644 --- a/src/add-ons/mail_daemon/inbound_protocols/imap/imap_lib/Commands.cpp +++ b/src/add-ons/mail_daemon/inbound_protocols/imap/imap_lib/Commands.cpp @@ -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; } diff --git a/src/add-ons/mail_daemon/inbound_protocols/imap/imap_lib/Commands.h b/src/add-ons/mail_daemon/inbound_protocols/imap/imap_lib/Commands.h index 6dbf2cff2e..6b9d053ccf 100644 --- a/src/add-ons/mail_daemon/inbound_protocols/imap/imap_lib/Commands.h +++ b/src/add-ons/mail_daemon/inbound_protocols/imap/imap_lib/Commands.h @@ -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);