On Sun, Sep 14, 2014, at 07:23 AM, Florent Peterschmitt wrote: > Hi, > > I'm getting into something a little too tricky for me (== don't have > time to investigate enough) : I want to modify cyrus.index files to > change UIDs of all messages in a mailbox.
You can't just do that unless you rename the message files as well. > For now, I have a tiny python script that can change any header value, > but where I'm stuck is for any other header which value depends of others. > > Like all CRC ones, for example. Yep, they are an extra level of trickyness for sure. > For now, I tested by sending two mails. So their UID are 1 and 2. > After the script, 1 is 2 and 2 is 3. > > I've mv each mail to get the correct name. Ahh, OK. That helps. It's really not ideal to do this though, so I wonder why you are even trying? > But now (I knew it would not be so easy), no mail (0 exists, 0 recent). I wouldn't be surprised to see IO errors in the logs too. We're not as diligent at checking the error codes from parsing index records as we could be everywhere in the code - many of the read paths just skip invalid records, hence the zero exists. I have a perl module that does roughly what you are doing there, and it can even re-calculate the CRCs... Or you can just look in mailbox.c at mailbox_index_record_to_buf and friends in the Cyrus source code. Cheers, Bron. -- Bron Gondwana br...@fastmail.fm
IndexFile.pm
Description: Perl program