On Sat, Nov 22, 2008 at 10:42:09PM +1100, Bron Gondwana wrote: > Counting messages would be a separate patch to just pop3. Something like this... Bron ( it counts retr, top and dele commands only, I figured I couldn't be arsed counting list and uidl )
Index: cyrus-imapd-2.3.13/imap/pop3d.c =================================================================== --- cyrus-imapd-2.3.13.orig/imap/pop3d.c 2008-11-22 23:14:51.000000000 +1100 +++ cyrus-imapd-2.3.13/imap/pop3d.c 2008-11-22 23:15:10.000000000 +1100 @@ -125,6 +125,9 @@ static int popd_logfd = -1; unsigned popd_exists = 0; unsigned popd_login_time; +int count_retr = 0; +int count_top = 0; +int count_dele = 0; struct msg { unsigned uid; unsigned size; @@ -315,6 +318,12 @@ { proc_cleanup(); + syslog(LOG_NOTICE, "counts: retr=<%d> top=<%d> dele=<%d>", + count_retr, count_top, count_dele); + count_retr = 0; + count_top = 0; + count_dele = 0; + /* close local mailbox */ if (popd_mailbox) { mailbox_close(popd_mailbox); @@ -476,6 +485,10 @@ popd_in = prot_new(0, 0); popd_out = prot_new(1, 1); + count_retr = 0; + count_top = 0; + count_dele = 0; + /* Find out name of client host */ salen = sizeof(popd_remoteaddr); if (getpeername(0, (struct sockaddr *)&popd_remoteaddr, &salen) == 0 && @@ -607,6 +620,9 @@ free(backend); } + syslog(LOG_NOTICE, "counts: retr=<%d> top=<%d> dele=<%d>", + count_retr, count_top, count_dele); + mboxlist_close(); mboxlist_done(); @@ -941,6 +957,7 @@ } else { blat(msg, -1); + count_retr++; } } } @@ -962,6 +979,7 @@ else { popd_msg[msg].deleted = 1; prot_printf(popd_out, "+OK message deleted\r\n"); + count_dele++; } } } @@ -1003,6 +1021,7 @@ } else { blat(msg, lines); + count_top++; } } }
---- 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