chiark / gitweb /
wip notice_processed; need new article states and counters
authorIan Jackson <ian@liberator.relativity.greenend.org.uk>
Tue, 20 Apr 2010 23:27:11 +0000 (00:27 +0100)
committerIan Jackson <ian@liberator.relativity.greenend.org.uk>
Tue, 20 Apr 2010 23:27:11 +0000 (00:27 +0100)
backends/innduct.c

index b9460ed598a62a205ef865608cbab2151815bc49..9f032f41571857618f6172889e9aa56a7d69a6ad 100644 (file)
@@ -240,7 +240,7 @@ typedef struct {
 
 struct Article {
   int midlen;
-  int checked, sentbody;
+  int checked;
   InputFile *ipf;
   TOKEN token;
   off_t offset;
@@ -960,7 +960,6 @@ static void update_nocheck(int accepted) {
 }
 
 static void article_done(Connection *conn, Article *art, int whichcount) {
-  *count++;
   art->ipf->counts.articles[art->checked][whichcount]++;
   if (whichcount == RC_accepted) update_nocheck(1);
   else if (whichcount == RC_unwanted) update_nocheck(0);
@@ -1173,7 +1172,7 @@ typedef void *feedfile_got_article(oop_source *lp, oop_read *rd,
     art->offset= ipf->offset;
     art->blanklen= recsz;
     art->midlen= midlen;
-    art->checked= art->sentbody= 0;
+    art->checked= 0;
     art->ipf= ipf;  ipf->inprogress++;
     art->token= TextToToken(tokentextbuf);
     strcpy(art->messageid, space+1);
@@ -1639,12 +1638,24 @@ static int inputfile_is_done(InputFile *ipf) {
   if (ipf->fd >= 0); return 0; /* not had EOF */
   return 1;
 }
+
+static void notice_processed(InputFile *ipf, const char *what,
+                            const char *spec) {
+  info("processed %s%s checked=%d unchecked=%d sent=%d");
+  wip;
+}
+
 static void statemc_check_backlog_done(void) {
   InputFile *ipf= backlog_input_file();
   if (!inputfile_is_done(ipf)) return;
 
-  notice_processed(ipf,"backlog file",ipf->path);
+  const char *slash= strrchr(ipf->path, "/");
+  const char *leaf= slash ? slash+1 : ipf->path;
+  const char *under= strchr(slash, "_");
+  const char *rest= under ? under+1 : leaf;
+  if (!strncmp(rest,"backlog",7)) rest += 7;
+  notice_processed(ipf,"backlog:",rest);
+  
   close_input_file(ipf);
   if (unlink(ipf->path)) {
     if (errno != ENOENT)
@@ -1665,7 +1676,7 @@ static void statemc_check_flushing_done(void) {
 
   assert(sms==sm_SEPARATED || sms==sm_DROPPING);
 
-  notice_processed(ipf,"feed file",0);
+  notice_processed(ipf,"feedfile",0);
 
   close_defer();