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) ...@@ -1049,3 +1049,17 @@ util_wcard_match (const char *string, const char *pattern, const char *delim)
1049 1049
1050 return WCARD_NOMATCH; 1050 return WCARD_NOMATCH;
1051 } 1051 }
1052
1053 /* Return the uindvalidity of a mailbox. */
1054 int
1055 util_uidvalidity (mailbox_t smbox, unsigned long *uidvp)
1056 {
1057 url_t mbox_url = NULL;
1058 url_t smbox_url = NULL;
1059
1060 mailbox_get_url (mbox, &mbox_url);
1061 mailbox_get_url (smbox, &smbox_url);
1062 if (strcmp (url_to_string (mbox_url), url_to_string (smbox_url)) == 0)
1063 smbox = mbox;
1064 return mailbox_uidvalidity (smbox, uidvp);
1065 }
......