Api for seen state, perl preferred

Adam Tauno WIlliams awilliam at whitemice.org
Wed May 20 07:34:52 EDT 2009

> > I'm following a previous thread. I would like to be able to open a seen
> > skiplist database in order to verify if a particular user has red its mail.
> > If possible, a way to do that in PERL would be perfect.
> > Thanks in advance
> That's, um, tricky actually.
> You need to read the uniqueid of the mailbox from the cyrus.header file
> first, then read the contents of the skiplist file.  The easiest way to
> do that is `cyr_dbtool /path/to/seen/file.db skiplist get $uniqueid`,
> which will give you the seen record.  You then need to parse that for
> uniqueids - it's in the format:
> range,range,range
> where range is either a single integer or $low:$high where low and high
> are both integers - in which case all the messages in that range
> inclusive are seen.
> There's some other stuff in that seen record as well.  Here we go:
> [brong at imap3 hm]$ cat /mnt/meta8/slot308/store23/meta/b/user/brong/cyrus.header | grep user.brong
> user.brong      6af857f64475158a

Maybe I'm looking in the wrong place; but on my test server
(cyrus-imapd-2.3.11) my cyrus.header looks like -

estate1:/var/spool/imap/user/awilliam # cat cyrus.header 
Cyrus mailbox header
"The best thing about this system was that it had lots of goals."
	--Jim Morris on Andrew
Junk $Label1 $Label2 $Label3 $Label4 $Label5 $MDNSent NotJunk
receipt-handled $has_cal 
awilliam	lrswipcda	

Is "46a0a0b041114dce" the id?

> [brong at imap3 hm]$ /usr/cyrus/bin/cyr_dbtool -C /etc/imapd-slot308-master.conf /mnt/meta8/slot308/store23/conf/user/b/brong.seen skiplist get 6af857f64475158a
> 1 1242810803 386716 1242800567 1:386615
> Looks like I've seen all my email!  Also notice 4 other
> fields at the start:
> <version> <lastread> <lastuid> <lastchange> <seen_items>

<lastchange> is an epoch time stamp?

I'm not clear on what <lastuid> is; looks like it is a message id?  What
operation sets/updates the <lastuid> value?  

> Here's a more interesting couple of folders to give you an idea
> of what ranges look like:
> 798b2df94146a5fe        1 1095746485 1526 1095740252 1:559,561:772,774:920,922:1109,1111:1115,1117:1138,1140:1170,1172:1195,1197:1521
> 798b2df941576261        1 1125837870 34307 1123831223 1:28289,29118,30871,31887,31935,32058,32209:32210,32214:32219,32222,32228
> So - in summary.  It's not easy.  Some plumbing required...
> (lastuid gives you "\Recent" as per the IMAP flag - anything
> newer than that is recent!)

So any message with $id > $lastuid is "recent".

More information about the Info-cyrus mailing list