On Wed, 23 Aug 2006, Erik Kangas wrote:
* What are the easiest ways to cause the uid validity of a folder to change? I know I can do it by converting the mbx -> unix -> mbx (or by otherwise deleting and re-creating the folder). But maybe there is a simpler way? This is for testing our imap client software taht it correctly detects changes in uid validity.

The UID validity is the first 8 octets of the second line in the mbx file (after the "*mbx* line). It's a 32-bit value, represented in hex as ASCII. You can use a hex editor to change those octets to represent some other number, either zero OR a value that is higher than what is already there (do NOT use a lower value).

In the past, I would have recommended using EMACS instead of a hex editor, but some recent versions of GNU emacs have been "improved" to do things with CRLF newlines and/or nulls other than leaving them alone.

* Mark: when MIX is released and we work on migrating users to it, will it be at all possible to convert an mbx -> mix and preserve both the UIDs and the UID Validity settings? I know you have -kwcopy in the new mailutil. Can it be possible to do something similar for uid/uidvalidity?

It isn't be possible to do this with the distributed version of mailutil. I consider it to be too special purpose, and too dangerous, to be something that I am comfortable with putting in the distributed version. However, it shouldn't be a particularly difficult change to make as a local hack.

For example, the following is a disgusting kludge, but it should do the trick. You probably want to do this in a separate copy of the source code just for this special hacked version of mailutil.

(1) Create two new global variables in mailutil.c, newuidvalidity and newuidlast.

(2) Early in routine mbxcopy() in mailutil.c, do
  newuidvalidity = source->uid_validity;
  newuidlast = source->uid_last;

(3) In mix.c, prototype newuidvalidity and newuidlast as extern.

(4) In mix_create() in mix.c, change
  fprintf (f,MTAFMT,now,0,now);
to
  fprintf (f,MTAFMT,newuidvalidity,0,now);

(5) Finally, in mix_append(), just before the lines that read:
          ret = (mix_meta_update (astream) &&
                 mix_index_update (astream,&idxf,LONGT) &&
                 mix_status_update (astream,&statf,LONGT));
add
          if (astream->uid_last <= newuidlast) aastream->uid_last = newuidlast;

Please let me know how it goes.

-- Mark --

http://staff.washington.edu/mrc
Science does not emerge from voting, party politics, or public debate.
Si vis pacem, para bellum.
_______________________________________________
Imap-uw mailing list
[email protected]
https://mailman1.u.washington.edu/mailman/listinfo/imap-uw

Reply via email to