Commit 83d1d381 83d1d381bcedc757c88bf9bab0be971c11c801f8 by Sergey Poznyakoff

(util_uidvalidity): New function. A wrapper

around mailbox_uidvalidity. When a mailbox is selected whose
first message does not keep X-UIDVALIDITY value, the uidvalidity
is computed based on the return of time(). Now, if we call
"EXAMINE mailbox" or "STATUS mailbox (UIDVALIDITY)" the same
mailbox is opened second time and the uidvalidity recalculated.
Thus each subsequent call to EXAMINE or STATUS upon an already
selected mailbox will return different uidvalidity value. To
avoid this, util_uidvalidity() first sees if it is asked to
operate upon an already opened mailbox and if so, returns
previously computed value.
1 parent 61d964e6
......@@ -1049,3 +1049,17 @@ util_wcard_match (const char *string, const char *pattern, const char *delim)
return WCARD_NOMATCH;
}
/* Return the uindvalidity of a mailbox. */
int
util_uidvalidity (mailbox_t smbox, unsigned long *uidvp)
{
url_t mbox_url = NULL;
url_t smbox_url = NULL;
mailbox_get_url (mbox, &mbox_url);
mailbox_get_url (smbox, &smbox_url);
if (strcmp (url_to_string (mbox_url), url_to_string (smbox_url)) == 0)
smbox = mbox;
return mailbox_uidvalidity (smbox, uidvp);
}
......