(1) dumping twoskip file and (2) getting folder UIDs
Jay Sekora <[email protected]> Tue, 30 Jun 2026 09:35:54 -0400
| Newsgroups | gmane.mail.imap.cyrus |
|---|---|
| Message-ID | <[email protected]> |
Hi! I have a user who accidentally marked all her mail as "read" and needs read state of her messages restored from backups. At the same time, she also accidentally deleted a bunch of messages, but also has gotten lots of new mail since then. So I think what I need to do is restore her old inbox as of just before this happened to a new folder location (that part is easy), and then get a copy of her $username.seen file from the same backup, extract the=20 seen/unseen data from the .seen file, and apply seen/unseen state to the corresponding messages in the new (restored) folder location. So the two pieces of this that I don't know how to do are (1) dumping the twoskip file to a text format that I can get the seen/unseen message UIDs out of, and (2) correlating the folder IDs in the twoskip file with folder names I can select in `cyradm`. (If there's an easier way to do this I'd love to hear it!) So, (1) is there a script available somewhere to dump twoskip files to a text format? And (2) how can I get a list of folder names and=20 corresponding folder IDs as found (apparently) in the twoskip file? (2) seems like something I ought to know, but I don't. :-) (Running `strings` on the twoskip file suggests the folders are stored as IDs like "xhz89kuj0c4m8w0ey4tafenk1" rather than folder names like "user.so-and-so". But presumably the output of `strings` might include values that are deleted or superceded, and in any case it looks like=20 the actual message UIDs are in binary rather than textual format in the twoskip file.) Jay PS -- This is on Ubuntu 22.04 with Cyrus 3.4.3 as packaged by Ubuntu. But I can't imagine the package maintainers broke the twoskip file format. :-) PPS -- I found https://github.com/cyrusimap/cyrus-imapd/blob/master/lib/cyrusdb_twoskip.c but my C is pretty rusty and I don't feel confident trying to convert that to perl or python or something on my own. The other way I've thought of to do this is to bring up an entire second IMAP server, restore the user's inbox and .seen file to it as of a consistent date, and use=20 `imapsync` to synchronize seen/unseen state from the restore with the production IMAP server =E2=80=94 assuming the folder ID is actually stored *in* the folder directory itself. That sounds even worse than trying to parse the twoskip file. ------------------------------------------ Cyrus: Info Permalink: https://cyrus.topicbox.com/groups/info/T643419685ae5113c-Mf5c7c0= 89518c1a2ec60f8bc2 Delivery options: https://cyrus.topicbox.com/groups/info/subscription