Re: Api for seen state, perl preferred
Sorry to be late to answer, and thanks for the thread. I tried that command and gets lots of info: getting id in a folder, I got that [cy...@smtp ~]$ ./test.pl lastread:Tue May 19 14:14:04 2009 52 lastchange:Tue May 19 14:05:51 2009 1:52 I put an unread mail in that folder, it appears to be at uid 53 [cy...@smtp ~]$ ./test.pl lastread:Tue May 19 14:14:04 2009 52 lastchange:Tue May 19 14:05:51 2009 1:52 Nothing changed Then clicking on it: [cy...@smtp ~]$ ./test.pl lastread:Mon May 25 14:51:06 2009 53 lastchange:Mon May 25 14:51:06 2009 1:53 Yes that information has been updated. I begin to understand but my subfolder was easy, few messages and just one unread. When it's mixed it's more difficult: For my INBOX: [cy...@smtp ~]$ ./test.pl lastread:Mon May 25 14:49:37 2009 30714 lastchange:Mon May 25 14:45:48 2009 1:30421,30423:30443,30445,30448:30449,30451,30453:30455,30457:30467,30472,30474,30477:30478,30480,30485:30490,30492,30494,30496:30498,30502,30504,30506,30508:30509,30511:30514,30516:30518,30520,30522:30523,30526:30528,30530:30537,30548:30558,30577,30579:30581,30606:30607,30610,30612,30615:30619,30621,30623:30643,30650,30652,30656,30659,30663:30666,30669:30670,30672:30675,30677:30678,30681,30683,30685,30687:30689,30691,30696:30697,30699:30701,30703:30705,30710,30713 [cy...@smtp ~]$ ll /var/spool/imap2/l/user/lalot/3071* -rw--- 1 cyrus cyrus 1642 mai 25 16:31 /var/spool/imap2/l/user/lalot/30710. -rw--- 1 cyrus cyrus 31880 mai 25 16:35 /var/spool/imap2/l/user/lalot/30712. -rw--- 1 cyrus cyrus 2058 mai 25 16:41 /var/spool/imap2/l/user/lalot/30713. -rw--- 1 cyrus cyrus 8268 mai 25 16:47 /var/spool/imap2/l/user/lalot/30714. -rw--- 1 cyrus cyrus 2622 mai 25 16:50 /var/spool/imap2/l/user/lalot/30715. -rw--- 1 cyrus cyrus 7982 mai 25 16:56 /var/spool/imap2/l/user/lalot/30716. [cy...@smtp ~]$ ./test.pl lastread:Mon May 25 16:49:37 2009 30714 lastchange:Mon May 25 16:45:48 2009 1:30421,30423:30443,30445,30448:30449,30451,30453:30455,30457:30467,30472,30474,30477:30478,30480,30485:30490,30492,30494,30496:30498,30502,30504,30506,30508:30509,30511:30514,30516:30518,30520,30522:30523,30526:30528,30530:30537,30548:30558,30577,30579:30581,30606:30607,30610,30612,30615:30619,30621,30623:30643,30650,30652,30656,30659,30663:30666,30669:30670,30672:30675,30677:30678,30681,30683,30685,30687:30689,30691,30696:30697,30699:30701,30703:30705,30710,30713 The last 3 emails haven't been red. and we stopped at 30713 I clicked on last one: [cy...@smtp ~]$ ./test.pl lastread:Mon May 25 17:03:06 2009 30716 lastchange:Mon May 25 17:03:07 2009 1:30421,30423:30443,30445,30448:30449,30451,30453:30455,30457:30467,30472,30474,30477:30478,30480,30485:30490,30492,30494,30496:30498,30502,30504,30506,30508:30509,30511:30514,30516:30518,30520,30522:30523,30526:30528,30530:30537,30548:30558,30577,30579:30581,30606:30607,30610,30612,30615:30619,30621,30623:30643,30650,30652,30656,30659,30663:30666,30669:30670,30672:30675,30677:30678,30681,30683,30685,30687:30689,30691,30696:30697,30699:30701,30703:30705,30710:30711,30713,30716 So, I have all the ranges of what has been red. I can put the ranges in a structure, then do a search before xx and compare if the mails are in the range. I believe it can do the job with that. Thanks Dom 2009/5/20 Bron Gondwana br...@fastmail.fm On Wed, May 20, 2009 at 07:34:52AM -0400, Adam Tauno WIlliams wrote: 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 46a0a0b041114dce Junk $Label1 $Label2 $Label3 $Label4 $Label5 $MDNSent NotJunk receipt-handled $has_cal awilliam lrswipcda Is 46a0a0b041114dce the id? Yeah, just means you have no quota root. That's the ID. [br...@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? Yes. I'm not clear on what lastuid is; looks like it is a message id? What operation sets/updates the lastuid value? It's a UID. Here's a more interesting couple of folders to give you an idea of what ranges look like: 798b2df94146a5fe1 1095746485 1526 1095740252 1:559,561:772,774:920,922:1109,:1115,1117:1138,1140:1170,1172:1195,1197:1521 798b2df9415762611 1125837870 34307 1123831223 1:28289,29118,30871,31887,31935,32058,32209:32210,32214:32219,3,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
Re: Api for seen state, perl preferred
On Wed, May 20, 2009 at 08:36:47AM +0200, LALOT Dominique wrote: Hello, 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: [br...@imap3 hm]$ cat /mnt/meta8/slot308/store23/meta/b/user/brong/cyrus.header | grep user.brong user.brong 6af857f64475158a [br...@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 Here's a more interesting couple of folders to give you an idea of what ranges look like: 798b2df94146a5fe1 1095746485 1526 1095740252 1:559,561:772,774:920,922:1109,:1115,1117:1138,1140:1170,1172:1195,1197:1521 798b2df9415762611 1125837870 34307 1123831223 1:28289,29118,30871,31887,31935,32058,32209:32210,32214:32219,3,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!) Bron. Cyrus Home Page: http://cyrusimap.web.cmu.edu/ Cyrus Wiki/FAQ: http://cyrusimap.web.cmu.edu/twiki List Archives/Info: http://asg.web.cmu.edu/cyrus/mailing-list.html
Re: Api for seen state, perl preferred
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: [br...@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 46a0a0b041114dce Junk $Label1 $Label2 $Label3 $Label4 $Label5 $MDNSent NotJunk receipt-handled $has_cal awilliamlrswipcda Is 46a0a0b041114dce the id? [br...@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: 798b2df94146a5fe1 1095746485 1526 1095740252 1:559,561:772,774:920,922:1109,:1115,1117:1138,1140:1170,1172:1195,1197:1521 798b2df9415762611 1125837870 34307 1123831223 1:28289,29118,30871,31887,31935,32058,32209:32210,32214:32219,3,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. Cyrus Home Page: http://cyrusimap.web.cmu.edu/ Cyrus Wiki/FAQ: http://cyrusimap.web.cmu.edu/twiki List Archives/Info: http://asg.web.cmu.edu/cyrus/mailing-list.html
Re: Api for seen state, perl preferred
On Wed, May 20, 2009 at 07:34:52AM -0400, Adam Tauno WIlliams wrote: 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 46a0a0b041114dce Junk $Label1 $Label2 $Label3 $Label4 $Label5 $MDNSent NotJunk receipt-handled $has_cal awilliam lrswipcda Is 46a0a0b041114dce the id? Yeah, just means you have no quota root. That's the ID. [br...@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? Yes. I'm not clear on what lastuid is; looks like it is a message id? What operation sets/updates the lastuid value? It's a UID. Here's a more interesting couple of folders to give you an idea of what ranges look like: 798b2df94146a5fe1 1095746485 1526 1095740252 1:559,561:772,774:920,922:1109,:1115,1117:1138,1140:1170,1172:1195,1197:1521 798b2df9415762611 1125837870 34307 1123831223 1:28289,29118,30871,31887,31935,32058,32209:32210,32214:32219,3,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. $uid. Please don't get confused between the two. It's an important distinction. Everything is in UIDs internally. Bron. Cyrus Home Page: http://cyrusimap.web.cmu.edu/ Cyrus Wiki/FAQ: http://cyrusimap.web.cmu.edu/twiki List Archives/Info: http://asg.web.cmu.edu/cyrus/mailing-list.html
Re: Api for seen state, perl preferred
LALOT Dominique wrote: Hello, 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 Dom Connecting via IMAP would be more portable. See 'imtestExample.pl' within Mail::IMAPClient for something to start with. With that script, you would do, e.g.: ./imtestExample.pl -m DIGEST-MD5 -a cyrus -u dwh...@olp.net -w mysecret where 'cyrus' is an admin, and 'dwh...@olp.net' is the user who's mailbox you want to examine. You'll need to add logic to the script to view seen state. - Dan Cyrus Home Page: http://cyrusimap.web.cmu.edu/ Cyrus Wiki/FAQ: http://cyrusimap.web.cmu.edu/twiki List Archives/Info: http://asg.web.cmu.edu/cyrus/mailing-list.html