TB violates RFC2087 (RFC 2087 for QUOTAROOT/QUOTA is not fully suppported yet)
Categories
(MailNews Core :: Networking: IMAP, enhancement)
Tracking
(Not tracked)
People
(Reporter: o2733231, Assigned: gds)
References
Details
Attachments
(3 files, 15 obsolete files)
| Reporter | ||
Updated•13 years ago
|
| Reporter | ||
Comment 1•13 years ago
|
||
| Reporter | ||
Comment 2•13 years ago
|
||
| Reporter | ||
Updated•13 years ago
|
Comment 3•13 years ago
|
||
Comment 4•13 years ago
|
||
Updated•13 years ago
|
Comment 5•13 years ago
|
||
Comment 6•13 years ago
|
||
Comment 7•7 years ago
|
||
Comment 8•6 years ago
|
||
Still a pain point: popular IMAP platform: dovecot on cpanel reports both cPanel quota and mailbox quota. Both are important. Because Thunderbird only sees the cpanel quota, user receives no warning before mailbox stops accepting mail for exceeding quota, nor any notice that mailbox is over quota. The only indicators are: no new mail, and IF/When user tries to send a message (AND if "Sending, Place a copy in Sent" is set) then error "unable to save a copy to Sent folder" will occur. I had a mailbox bouncing messages for days before I discovered it was full.
| Assignee | ||
Comment 9•6 years ago
|
||
(In reply to Shawn Hughes from comment #8)
Still a pain point: popular IMAP platform: dovecot on cpanel reports both cPanel quota and mailbox quota. Both are important.
Can you show me an example imap getquotaroot response for dovecot on cpanel? You can record an IMAP:5 log using procedure here to see it: https://wiki.mozilla.org/MailNews:Logging
Comment 2 also shows a way to get multiple quota responses to quotaroot. I'll see if I can get that to work with just dovecot without cpanel.
I think all my existing accounts just have one quota type in response to getquotaroot.
| Assignee | ||
Comment 10•6 years ago
•
|
||
I enabled some quotas on my test imap server. I think I have two quotaroots: User and Disk, with attributes "storage" and "message". I only see these returned for "User quota" and not for "Disk quota". Here's what I see with the IMAP:5 log:
S-INBOX/newerF:SendData: 11 getquotaroot "INBOX/newerF"
S-INBOX/newerF:CreateNewLineFromSocket: * QUOTAROOT INBOX/newerF "User quota" "Disk quota"
S-INBOX/newerF:CreateNewLineFromSocket: * QUOTA "User quota" (STORAGE 1879422 10485760 MESSAGE 17622 8192)
S-INBOX/newerF:CreateNewLineFromSocket: 11 OK Getquotaroot completed (0.008 + 0.000 + 0.007 secs).
Shawn Hughes: Can you post a similar IMAP:5 snippet that you see for the dovecot on cpanel server? I'm no expert on this an really don't know what I am doing so to see a "real" example would be helpful. Thanks.
P/S: It is pointed out above in comment 5 that tb only considers the "storage" value and ignores other possible attributes. Maybe only in the last "* QUOTA" in the response too? Also, maybe a big UI change to show all the attributes with bar charts.
Comment 11•6 years ago
|
||
Example from https://github.com/roundcube/roundcubemail/issues/1999
QUOT1 GETQUOTAROOT "INBOX"
- QUOTAROOT "INBOX" "User quota" "Group quota"
- QUOTA "User quota" (STORAGE 148 102400)
- QUOTA "Group quota" (STORAGE 1499188 4096000)
QUOT1 OK Getquotaroot completed.
And there also can be MESSAGE limits in these.
Comment 12•6 years ago
|
||
| Assignee | ||
Comment 13•6 years ago
|
||
Thanks to you both for the "real world" examples.
re: comment #2: relates to altering dovecot behavior, yes? I cannot control dovecot settings on any of my accounts.
I wasn't suggesting you change anything in dovecot. I just used the info in comment 2 to change my test dovecot server to produce multiple quota responses. (My dovecot is just for testing tb stuff, not a production server.)
And there also can be MESSAGE limits in these.
Yes, as in my dovecot response:
S-INBOX/newerF:CreateNewLineFromSocket: * QUOTA "User quota" (STORAGE 1879422 10485760 MESSAGE 17622 8192)
Several other "limit names" are possible at least with dovecot other than just storage and messages. Note: my MESSAGE quote is greater than 100% but it's fake.
| Assignee | ||
Comment 14•6 years ago
|
||
This proposes a fix for the quota issue described in this bug. This now looks at all the quota items reported for the selected folder and reports the one having the highest percentage used. Also, it no longer restricts the quota resource to just storage so if the server reports a quota for the number of messages or number of mailboxes or other resourse, they will also be candidates for reporting the worst case usage.
This makes a few changes to the quota tab of the folder properties screen. Instead of showing the quotaroot name, I now show the quotaroot name and the resource (if resource is storage, "in KB" is appended). The usage line no longer shows "in KB" but just gives numbers since resources like number of messages or mailboxes are typically unit-less. The status bar-graph is unchanged.
This fixes a problem with status messages that appear when quota capability is not supported or if the folder is not yet selected and quota info is not available. It also fixes a problem that when a server reports capability in the initial imap "greeting" the password is not retrieved until the folder is re-selected. This caused the quota report to claim quota is not yet available.
I have tested this with multiple servers, some with multiple resources per quotaroot and it works well.
Note: A more ideal fix is to list all the quota items in the quota tab rather than just the worst case one. This would require more changes to the quota tab UI that I'm not sure how to do and might not be worth the effort since most servers only report one quota item per folder.
Comment 15•6 years ago
|
||
| Assignee | ||
Comment 16•6 years ago
|
||
I think it would be better if this method took some object as input, so we could store the stuff we found, if there were more than one resource. (Don't worry about the UI, we can handle that later.)
Magnus, I have changed the items you requested. However, I haven't changed the above item completely as I think you requested. I did change it so that that all the quota items are saved but in 3 separate arrays rather than as an array of a struct containing 3 items. I'm not real familiar with arrays in mozilla code but it it seems like nsTArray is appropriate so I used that and the code still works OK.
m_folderQuotaPercentTimesTen(0) {Strange name. Why do we want that?
I did this in case two quota item are tied in percent for worst case, e.g., both are at 86% full. If I multiply by 100 I only get a percent. But if I multiply to 1000 I get one more decimal place to compare to, so I might see 861 vs. 864 so I take the quotaroot/resource with 864 for display.
Here's how I calculate the percent-time10:
+ uint32_t percentTimesTen = 0;
+ if (aFolderQuotaMaxKB > 0)
+ percentTimesTen = ((static_cast<uint64_t>(aFolderQuotaUsedKB) * 1000) +
+ (aFolderQuotaMaxKB/2)) / aFolderQuotaMaxKB;
Anyhow, maybe just multiply by 100 is OK too and worrying about the extra decimal is nit-picking.
I just realized that my variables ...UsedKB and ...MaxKB should really drop the KB since the same calculation and comparisons apply to non-STORAGE resources too.
Updated•6 years ago
|
Comment 17•6 years ago
|
||
| Assignee | ||
Comment 18•6 years ago
|
||
You could just put something like this into the same idl you're modifying.
interface nsMsgIQuota : nsISupports
{
attribute ACString name;
unsigned long usage;
unsigned long limit
};
Sounds good but when I do this and I define an nsTArray of type nsMsgIQuota in the .cpp I see the compile error "nsMsgIQuota is a virtual class". Haven't figured out yet how to get around this. Also, added "attribute" to usage and limit didn't help.
Comment 19•6 years ago
|
||
Hmm, looks like there are a few typos here:
interface nsMsgIQuota : nsISupports
{
attribute ACString name;
unsigned long usage;
unsigned long limit
};
That should be nsIMsgQuota since we always start with "nsI", I for interface. Then there is attribute missing twice, as you pointed out.
This is a new interface, so something needs to inherit from that, like here:
https://searchfox.org/comm-central/rev/771b361ca1a33dd9ba3afdfdadfedf4621c98873/mailnews/base/util/nsMsgMailNewsUrl.h#40
In your case, I guess you want to add it here:
https://searchfox.org/comm-central/rev/771b361ca1a33dd9ba3afdfdadfedf4621c98873/mailnews/imap/src/nsImapIncomingServer.h#23
And then nsImapIncomingServer needs to implement the Get and Set methods.
Comment 20•6 years ago
|
||
Sorry about the typos!
| Assignee | ||
Comment 21•6 years ago
|
||
I ended associating the interface with the folder class instead of the incoming server class since it needs the array of quota items for each folder, not per server. Anyhow, it builds and seems to work OK, but I need to re-test to make sure it is completely working (assuming I'm even on the right track).
I had big problems at line 506 of the raw diff getting a pointer to the interface. I found some documentation that I followed and the only thing I could get to work at that point was to cast to "this" pointer. I'm 99% sure that's not the best way but everything else I tried didn't compile or crashed.
Comment 22•6 years ago
|
||
There are two print statements left in the code. As for the cast, there is positively no line 506 anywhere, maybe it's like 506 of the patch, but we can't see that in the review. I guess you mean this:
//nsCOMPtr<nsIMsgQuota> quotaItem
//getter_AddRefs(static_cast<nsIMsgQuota>(this));
//do_GetInterface(getter_AddRefs(quotaItem));
nsIMsgQuota *quotaItem = static_cast<nsIMsgQuota*>(this);
quotaItem->SetQuotaRootResource(aFolderQuotaRoot);
Why do you need this at all? Isn't this a folder and a quota item at the same time? So just this->SetQuotaRootResource(aFolderQuotaRoot); and of course the this is implicit, so just SetQuotaRootResource(aFolderQuotaRoot);. If that doesn't compile:
nsCOMPtr<nsIMsgQuota> quotaItem(do_QueryInterface(this));
| Assignee | ||
Comment 23•6 years ago
•
|
||
Sorry for the confusion; I was referring to line 506 of the quotaroot-fix3.diff attachment but you found the right place.
Anyhow, thanks for wake-up on "this" meaning. So I didn't have to declare a "quotaItem" at all, just set the values into the folder object using the new "set" methods.
I have an array of nsIMsgQuota items that I defined in the folder .h file:
nsCOMArray<nsIMsgQuota> m_folderQuota;
I set the 3 values into the folder object then then append an element to m_folderQuota array:
SetQuotaRootResource(aFolderQuotaRoot);
SetResourceUsed(aFolderQuotaUsed);
SetResourceMax(aFolderQuotaMax);
m_folderQuota.AppendElement(this);
Is this correct? It seems strange to append "this" at this point, but it seems to work.
I fixed the "keys" and display empty when there is no quotaroot name as requested in comment 17. Also, I assume the string changes are needed in the "suite" so I made the corresponding changes there too. And got rid of the printfs.
I'll submit the formal patch with the appropriate headers if this is OK and after a bit more testing.
Edit: And will run clang-format.
Comment 24•6 years ago
|
||
Comment 25•6 years ago
|
||
| Assignee | ||
Comment 26•6 years ago
•
|
||
I think I have found the correct way to add the nsIMsgQuota interface. It is based on a similar interface and function returning an Array found in mailnews/base/src/nsMsgTagService.idl. The details can be found using this search link for "nsIMsgTag":
https://searchfox.org/comm-central/search?q=nsIMsgTag%5Cb&case=false®exp=true&path=
As is done for nsMsgTagService, I now create a new class called nsMsgQuota that inherits from nsIMsgQuota (nsImapMailFolder no longer inherits from nsIMsgQuota as in previous diffs). For the two .js functions associated with this, one now returns the array and the other accepts it as an input parameter.
The determination of the array element with the maximum percent used now occurs in the .js files instead of the .cpp and eliminates the need to determine the "percentTimeTen" and the array index of the worst case percent usage.
With future changes to the .xhtml and .js this should allow the quota tab to display all the quota items and not just the item with highest usage. This is the original goal of this bug.
Comment 27•6 years ago
|
||
| Assignee | ||
Comment 28•6 years ago
|
||
A few more updates. Addressed Jorg's comments. Added a parameter aAction to SetFolderQuotaData() and others so can invalidate, store and validate rather than using other parameters to determine the action. Plus a few other misc. clean-ups.
I've only run clang-format on cpp/h file. Should others be run through it too, like .js files? (Notice for those it recommended a lot of changes to stuff I didn't touch.)
Comment 29•6 years ago
|
||
clang-format is for C++ files, JS files are treated with eslint/prettier. If you have it set up correctly, you just run ../mach eslint mail/base/content for example. There is also a --fix switch.
| Assignee | ||
Comment 30•6 years ago
|
||
Thanks, didn't know about eslint.
I should also mention that fix6 now marks the quota array valid only after the OK response occurs for the getquotaroot imap command. This is necessary since there can be multiple QUOTA untagged responses, each with multiple resources. Before we only saved the first STORAGE resource data and immediately marked it valid before the OK response occurred.
| Assignee | ||
Comment 31•6 years ago
•
|
||
Doing some more testing on this today with daily/trunk, it appears that when I set the advanced server setting "cached connections" from 5 down to 1, 2, 3 or 4 that it is ignored and remains at the default value of 5. Don't know if this is a known bug or not.
Edit: I couldn't find anything reported about this so I submitted Bug 1624393.
Comment 32•6 years ago
|
||
Updated•6 years ago
|
Comment 33•6 years ago
|
||
Did some cleanup on top of your patch. (Feel free to merge this with yours if you like.)
Comment 34•6 years ago
|
||
(In reply to Magnus Melin [:mkmelin] from comment #32)
I guess we should still just have the number, not KB tagged onto the name.
It's not clear to me we even want to show the actual numbers anywhere (or at
least rather hidden). It could be better to just show the percentage, likeSTORAGE: [**** ] 34%
Users (here) have no idea what their limits are unless limit is shown somewhere. 34% give no knowledge in such case (34% of 10MB, 10GB or something else?)
Comment 35•6 years ago
|
||
They don't, but RFC 2087 doesn't say what it is, and ATM we just show very large numbers there so that is also not very user friendly.
Comment 36•6 years ago
|
||
It says "implementation defined" and gives example of size/number of messages. Does anyone know implementation that returns other things than bytes and number of messages there?
Comment 37•6 years ago
|
||
Makes all the types of quota resources we know of show. Typically just storage.
Comment 38•6 years ago
|
||
Comment 39•6 years ago
|
||
| Assignee | ||
Comment 40•6 years ago
|
||
If we only show the bargraph should we also show the quotaroot name in front like:
Mailbox / STORAGE [-- ] 10% full
or
cPanel Account / STORAGE [-------- ] 50% full
Re: Comment 8 where they had two competing quotaroots for STORAGE and with current tb only saw the one that was smaller. (My % doesn't match the data provided in comment 8, so just an example:
dovecot cpanel ASMALLORANGE.COM bcg
I/IMAP 0x7f1bdadb1000:simply.asoshared.com:S-INBOX:SendData: 8 getquotaroot "INBOX"
D/IMAP ReadNextLine [stream=0x7f1bd8e34710 nb=44 needmore=0]
I/IMAP 0x7f1bdadb1000:simply.asoshared.com:S-INBOX:CreateNewLineFromSocket: * QUOTAROOT INBOX Mailbox "cPanel Account"
D/IMAP ReadNextLine [stream=0x7f1bd8e34710 nb=38 needmore=0]
I/IMAP 0x7f1bdadb1000:simply.asoshared.com:S-INBOX:CreateNewLineFromSocket: * QUOTA Mailbox (STORAGE 3505 51200)
D/IMAP ReadNextLine [stream=0x7f1bd8e34710 nb=48 needmore=0]
I/IMAP 0x7f1bdadb1000:simply.asoshared.com:S-INBOX:CreateNewLineFromSocket: * QUOTA "cPanel Account" (STORAGE 20 10485760)
D/IMAP ReadNextLine [stream=0x7f1bd8e34710 nb=51 needmore=0]
I/IMAP 0x7f1bdadb1000:simply.asoshared.com:S-INBOX:CreateNewLineFromSocket: 8 OK Getquotaroot completed (0.001 + 0.000 secs).
Anyhow, I think even if the real number are not user friendly, they could be useful if and when a uses bumps up against a quota, so I would vote for keeping them.
| Assignee | ||
Comment 41•6 years ago
|
||
(In reply to Magnus Melin [:mkmelin] from comment #35)
They don't, but RFC 2087 doesn't say what it is, and ATM we just show very large numbers there so that is also not very user friendly.
The rfc 2087 implies the storage is in kb and message is in number of messages as example resources:
STORAGE Sum of messages' RFC822.SIZE, in units of 1024 octets
MESSAGE Number of messages
From comment 39:
And we should have a converter in place that automatically switches the quota from KB, to MB, to GB, to TB if the values reach those limits.
This may make the user unfriendly numbers more meaningful.
Comment 42•6 years ago
|
||
Comment 43•6 years ago
|
||
<progress> can't have inline data.
| Assignee | ||
Comment 44•6 years ago
|
||
Now see my 4 quota items that I set up on dovecot server! However, no data for storage is shown. Is this the inline data problem you mention?
Comment 45•6 years ago
|
||
No, it that would be something else - I put that data to the left instead, like shown in the screenshot. But I don't understand why that string would ever become empty. Can you check why the usage.textContent = ${usage} / ${limit}}; doesn't work?
Comment 46•6 years ago
|
||
Comment 47•6 years ago
|
||
Sorry about that, must have forgot to refresh before uploading the patch.
| Assignee | ||
Comment 48•6 years ago
•
|
||
Looks good now. I set the threshold down low enough to trigger the status bar display and clicking on it brings up the quota display with my several quota items.
Magnus, should I do anything else on this?
Edit: Should the status bar-graph also have rounded corners?
Comment 49•6 years ago
|
||
(In reply to gene smith from comment #48)
Magnus, should I do anything else on this?
Just the smaller updates for comment 32
Edit: Should the status bar-graph also have rounded corners?
I would keep that one as it is.
| Assignee | ||
Comment 50•6 years ago
|
||
(In reply to Magnus Melin [:mkmelin] from comment #32)
Comment on attachment 9134936 [details] [diff] [review]
quotaroot-fix6.diff
::: mailnews/base/content/folderProps.xhtml
@@ +201,5 @@
readonly="readonly"
class="input-inline"
+ aria-labelledby="quotaRootLabel"
+ size="32"/>
+ <description id="quotaUsedFree2"/>
id of the actual element should not change
Your changes make this moot.
::: mailnews/imap/public/nsIMsgImapMailFolder.idl
@@ +19,5 @@
/**
+ * This interface defines the quota for a resource within a quota root. It
+ * consisting of three attributes:
+ * name: Concatenation of the quota root name and the resource name separated
+ * by a slash, i.e., "<quotaroot name> / <resource name>"
If quotaroot is emtpy, maybe we just give <resoutce name>
It looks rather odd when root is emtpy (like gmail).
I changed the comment.
@@ +29,5 @@
+[scriptable, uuid(9db60f97-45c1-45c2-8ab1-395690228f3f)]
+interface nsIMsgQuota : nsISupports {
+ readonly attribute ACString name;
+ readonly attribute unsigned long usage;
+ readonly attribute unsigned long limit;
actually, these don't need to be readonly
(it would only make testing harder)
I removed the readonly but linker requires new Set functions as well as Gets. I defined them in nsImapMailFolder.cpp. The sets and gets are never called, at least by the application. I assume you mean these might be needed for test functions.
::: mailnews/imap/src/nsImapMailFolder.cpp
@@ +7999,5 @@
+ nsTArray<RefPtr<nsIMsgQuota>> &aArray) {
+ if (m_folderQuotaDataIsValid) {
+ // Only set aArray if quota data is valid. If not currently valid,
+ // aArray is not set and returns an empty array when this function called
+ // from javascript.
it would be the same for c++, so maybe don't need this comment
I removed all 3 lines of this comment.
::: mailnews/imap/src/nsImapServerResponseParser.cpp
@@ +2625,5 @@
+ nsCString quotaRootResource(quotaroot);
+ quotaRootResource.AppendLiteral(" / ");
+ quotaRootResource.Append(resource);
+ if (resource.Equals("STORAGE", nsCaseInsensitiveCStringComparator()))
+ quotaRootResource.AppendLiteral(" KB");
I guess we should still just have the number, not KB tagged onto the name.
It's not clear to me we even want to show the actual numbers anywhere (or at
least rather hidden). It could be better to just show the percentage, like
STORAGE: [**** ] 34%
Your changes make this moot.
I'll attach the complete patch next.
| Assignee | ||
Comment 51•6 years ago
|
||
Not sure if you want this but here is the complete patch against comm-central trunk (pulled/updated last night). It includes all the changes and I've tested it with my fairly extensive set of imap servers. (Only my localhost based dovecot has multple quotaroots.) Also, the scaling of the KB, MB and GB numbers look good. (Not sure if it handles TeraB but don't have a server with that much quota.)
The patch also includes the added file mail/themes/shared/mail/folderProps.css
Comment 52•6 years ago
|
||
Comment 53•6 years ago
|
||
Comment 54•6 years ago
|
||
Pushed by mkmelin@iki.fi:
https://hg.mozilla.org/comm-central/rev/54a83a246c9e
make all the quotas the IMAP server sends us show up in the folder props. r=aleca,mkmelin
Updated•6 years ago
|
Description
•