deleted DELETE
Bron Gondwana
brong at fastmail.fm
Thu Aug 30 20:44:41 EDT 2007
On Thu, Aug 30, 2007 at 12:27:39PM -0400, Ken Murchison wrote:
> David Carter wrote:
>> On Wed, 29 Aug 2007, David Carter wrote:
>>> mboxname_isusermailbox() works on internal mailbox names. I don't think
>>> that it needs to worry about IMAPOPT_UNIXHIERARCHYSEP.
>> Here's a trivial patch to remove the IMAPOPT_UNIXHIERARCHYSEP stuff.
>> Otherwise mboxname_isusermailbox() is broken when unixhierarchysep is set.
>
> I've modified your patch further, to make it look closer to the original
> code. But I'm now wondering what the 'isdel' clause is trying to do. Once
> we've stripped the deletedprefix and found "user.", we shouldn't care about
> any timestamp, because a deleted Inbox, isn't an Inbox anymore. Correct?
> Actually, can any deleted mailbox be considered a user mailbox since only
> the admin can see them?
>
> if (!strncmp(start, "user.", 5) && (!isinbox || !strchr(start+5, '.'))
> || (isdel && (p = strchr(start+5, '.')) && !strchr(p+1, '.')))
> return (char*) start+5;
Actually, that's buggy. Here's the corrected version (full patch
attached)
/* starts with "user." AND
* we don't care if it's an inbox OR
* there's no dots after the username OR
* it's deleted and there's only one more dot
*/
if (strlen(start) > 5 && !strncmp(start, "user", 4) && start[4] == '.'
&& (!isinbox ||
!strchr(start+5, '.') ||
(isdel && (p = strchr(start+5, '.')) && !strchr(p+1, '.'))
))
return (char*) start+5; /* could have trailing bits if isinbox+isdel */
Basically, a user's inbox looks like:
domain.com!user.username
a deleted inbox looks like:
domain.com!DELETED.user.username.46D16085
(or whatever timestamp)
So if isinbox, we want to check that either there's no more dots if it's
not deleted, or one more dot if it is deleted.
Bron.
More information about the Cyrus-devel
mailing list