diff options
| author | manuel <manuel@mausz.at> | 2013-02-04 02:36:36 +0100 |
|---|---|---|
| committer | manuel <manuel@mausz.at> | 2013-02-04 02:36:36 +0100 |
| commit | 5538f2e0324be41577568029030d097a8a468e6e (patch) | |
| tree | de5a92a0595d55134f2e58f1db333c43e1b85d00 | |
| parent | ca6fcdefe9970efe12ae1162d6bd5532e4149a4c (diff) | |
| download | qmail-5538f2e0324be41577568029030d097a8a468e6e.tar.gz qmail-5538f2e0324be41577568029030d097a8a468e6e.tar.bz2 qmail-5538f2e0324be41577568029030d097a8a468e6e.zip | |
[PATCH] big-todo.103
| -rw-r--r-- | hier.c | 2 | ||||
| -rw-r--r-- | qmail-clean.c | 14 | ||||
| -rw-r--r-- | qmail-qstat.sh | 4 | ||||
| -rw-r--r-- | qmail-queue.c | 4 | ||||
| -rw-r--r-- | qmail-send.c | 38 |
5 files changed, 31 insertions, 31 deletions
| @@ -55,6 +55,8 @@ void hier() | |||
| 55 | d(auto_qmail,"queue/bounce",auto_uids,auto_gidq,0700); | 55 | d(auto_qmail,"queue/bounce",auto_uids,auto_gidq,0700); |
| 56 | 56 | ||
| 57 | dsplit("queue/mess",auto_uidq,0750); | 57 | dsplit("queue/mess",auto_uidq,0750); |
| 58 | dsplit("queue/todo",auto_uidq,0750); | ||
| 59 | dsplit("queue/intd",auto_uidq,0700); | ||
| 58 | dsplit("queue/info",auto_uids,0700); | 60 | dsplit("queue/info",auto_uids,0700); |
| 59 | dsplit("queue/local",auto_uids,0700); | 61 | dsplit("queue/local",auto_uids,0700); |
| 60 | dsplit("queue/remote",auto_uids,0700); | 62 | dsplit("queue/remote",auto_uids,0700); |
diff --git a/qmail-clean.c b/qmail-clean.c index 7539007..4926f86 100644 --- a/qmail-clean.c +++ b/qmail-clean.c | |||
| @@ -73,22 +73,26 @@ void main() | |||
| 73 | if (line.len < 7) { respond("x"); continue; } | 73 | if (line.len < 7) { respond("x"); continue; } |
| 74 | if (line.len > 100) { respond("x"); continue; } | 74 | if (line.len > 100) { respond("x"); continue; } |
| 75 | if (line.s[line.len - 1]) { respond("x"); continue; } /* impossible */ | 75 | if (line.s[line.len - 1]) { respond("x"); continue; } /* impossible */ |
| 76 | for (i = 5;i < line.len - 1;++i) | 76 | for (i = line.len - 2;i > 4;--i) |
| 77 | { | ||
| 78 | if (line.s[i] == '/') break; | ||
| 77 | if ((unsigned char) (line.s[i] - '0') > 9) | 79 | if ((unsigned char) (line.s[i] - '0') > 9) |
| 78 | { respond("x"); continue; } | 80 | { respond("x"); continue; } |
| 79 | if (!scan_ulong(line.s + 5,&id)) { respond("x"); continue; } | 81 | } |
| 82 | if (line.s[i] == '/') | ||
| 83 | if (!scan_ulong(line.s + i + 1,&id)) { respond("x"); continue; } | ||
| 80 | if (byte_equal(line.s,5,"foop/")) | 84 | if (byte_equal(line.s,5,"foop/")) |
| 81 | { | 85 | { |
| 82 | #define U(prefix,flag) fmtqfn(fnbuf,prefix,id,flag); \ | 86 | #define U(prefix,flag) fmtqfn(fnbuf,prefix,id,flag); \ |
| 83 | if (unlink(fnbuf) == -1) if (errno != error_noent) { respond("!"); continue; } | 87 | if (unlink(fnbuf) == -1) if (errno != error_noent) { respond("!"); continue; } |
| 84 | U("intd/",0) | 88 | U("intd/",1) |
| 85 | U("mess/",1) | 89 | U("mess/",1) |
| 86 | respond("+"); | 90 | respond("+"); |
| 87 | } | 91 | } |
| 88 | else if (byte_equal(line.s,4,"todo/")) | 92 | else if (byte_equal(line.s,4,"todo/")) |
| 89 | { | 93 | { |
| 90 | U("intd/",0) | 94 | U("intd/",1) |
| 91 | U("todo/",0) | 95 | U("todo/",1) |
| 92 | respond("+"); | 96 | respond("+"); |
| 93 | } | 97 | } |
| 94 | else | 98 | else |
diff --git a/qmail-qstat.sh b/qmail-qstat.sh index 26a6d3f..243f29c 100644 --- a/qmail-qstat.sh +++ b/qmail-qstat.sh | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | cd QMAIL | 1 | cd QMAIL |
| 2 | messdirs=`echo queue/mess/* | wc -w` | 2 | messdirs=`echo queue/mess/* | wc -w` |
| 3 | messfiles=`find queue/mess/* -print | wc -w` | 3 | messfiles=`find queue/mess/* -print | wc -w` |
| 4 | tododirs=`echo queue/todo | wc -w` | 4 | tododirs=`echo queue/todo/* | wc -w` |
| 5 | todofiles=`find queue/todo -print | wc -w` | 5 | todofiles=`find queue/todo/* -print | wc -w` |
| 6 | echo messages in queue: `expr $messfiles - $messdirs` | 6 | echo messages in queue: `expr $messfiles - $messdirs` |
| 7 | echo messages in queue but not yet preprocessed: `expr $todofiles - $tododirs` | 7 | echo messages in queue but not yet preprocessed: `expr $todofiles - $tododirs` |
diff --git a/qmail-queue.c b/qmail-queue.c index 4b39a8f..7d5ed67 100644 --- a/qmail-queue.c +++ b/qmail-queue.c | |||
| @@ -180,8 +180,8 @@ void main() | |||
| 180 | 180 | ||
| 181 | messnum = pidst.st_ino; | 181 | messnum = pidst.st_ino; |
| 182 | messfn = fnnum("mess/",1); | 182 | messfn = fnnum("mess/",1); |
| 183 | todofn = fnnum("todo/",0); | 183 | todofn = fnnum("todo/",1); |
| 184 | intdfn = fnnum("intd/",0); | 184 | intdfn = fnnum("intd/",1); |
| 185 | 185 | ||
| 186 | if (link(pidfn,messfn) == -1) die(64); | 186 | if (link(pidfn,messfn) == -1) die(64); |
| 187 | if (unlink(pidfn) == -1) die(63); | 187 | if (unlink(pidfn) == -1) die(63); |
diff --git a/qmail-send.c b/qmail-send.c index c31b522..7e6a8ac 100644 --- a/qmail-send.c +++ b/qmail-send.c | |||
| @@ -96,7 +96,7 @@ void fnmake_init() | |||
| 96 | } | 96 | } |
| 97 | 97 | ||
| 98 | void fnmake_info(id) unsigned long id; { fn.len = fmtqfn(fn.s,"info/",id,1); } | 98 | void fnmake_info(id) unsigned long id; { fn.len = fmtqfn(fn.s,"info/",id,1); } |
| 99 | void fnmake_todo(id) unsigned long id; { fn.len = fmtqfn(fn.s,"todo/",id,0); } | 99 | void fnmake_todo(id) unsigned long id; { fn.len = fmtqfn(fn.s,"todo/",id,1); } |
| 100 | void fnmake_mess(id) unsigned long id; { fn.len = fmtqfn(fn.s,"mess/",id,1); } | 100 | void fnmake_mess(id) unsigned long id; { fn.len = fmtqfn(fn.s,"mess/",id,1); } |
| 101 | void fnmake_foop(id) unsigned long id; { fn.len = fmtqfn(fn.s,"foop/",id,0); } | 101 | void fnmake_foop(id) unsigned long id; { fn.len = fmtqfn(fn.s,"foop/",id,0); } |
| 102 | void fnmake_split(id) unsigned long id; { fn.len = fmtqfn(fn.s,"",id,1); } | 102 | void fnmake_split(id) unsigned long id; { fn.len = fmtqfn(fn.s,"",id,1); } |
| @@ -1216,7 +1216,8 @@ void pass_do() | |||
| 1216 | /* this file is too long ---------------------------------------------- TODO */ | 1216 | /* this file is too long ---------------------------------------------- TODO */ |
| 1217 | 1217 | ||
| 1218 | datetime_sec nexttodorun; | 1218 | datetime_sec nexttodorun; |
| 1219 | DIR *tododir; /* if 0, have to opendir again */ | 1219 | int flagtododir = 0; /* if 0, have to readsubdir_init again */ |
| 1220 | readsubdir todosubdir; | ||
| 1220 | stralloc todoline = {0}; | 1221 | stralloc todoline = {0}; |
| 1221 | char todobuf[SUBSTDIO_INSIZE]; | 1222 | char todobuf[SUBSTDIO_INSIZE]; |
| 1222 | char todobufinfo[512]; | 1223 | char todobufinfo[512]; |
| @@ -1224,7 +1225,7 @@ char todobufchan[CHANNELS][1024]; | |||
| 1224 | 1225 | ||
| 1225 | void todo_init() | 1226 | void todo_init() |
| 1226 | { | 1227 | { |
| 1227 | tododir = 0; | 1228 | flagtododir = 0; |
| 1228 | nexttodorun = now(); | 1229 | nexttodorun = now(); |
| 1229 | trigger_set(); | 1230 | trigger_set(); |
| 1230 | } | 1231 | } |
| @@ -1236,7 +1237,7 @@ datetime_sec *wakeup; | |||
| 1236 | { | 1237 | { |
| 1237 | if (flagexitasap) return; | 1238 | if (flagexitasap) return; |
| 1238 | trigger_selprep(nfds,rfds); | 1239 | trigger_selprep(nfds,rfds); |
| 1239 | if (tododir) *wakeup = 0; | 1240 | if (flagtododir) *wakeup = 0; |
| 1240 | if (*wakeup > nexttodorun) *wakeup = nexttodorun; | 1241 | if (*wakeup > nexttodorun) *wakeup = nexttodorun; |
| 1241 | } | 1242 | } |
| 1242 | 1243 | ||
| @@ -1253,8 +1254,7 @@ fd_set *rfds; | |||
| 1253 | char ch; | 1254 | char ch; |
| 1254 | int match; | 1255 | int match; |
| 1255 | unsigned long id; | 1256 | unsigned long id; |
| 1256 | unsigned int len; | 1257 | int z; |
| 1257 | direntry *d; | ||
| 1258 | int c; | 1258 | int c; |
| 1259 | unsigned long uid; | 1259 | unsigned long uid; |
| 1260 | unsigned long pid; | 1260 | unsigned long pid; |
| @@ -1265,32 +1265,26 @@ fd_set *rfds; | |||
| 1265 | 1265 | ||
| 1266 | if (flagexitasap) return; | 1266 | if (flagexitasap) return; |
| 1267 | 1267 | ||
| 1268 | if (!tododir) | 1268 | if (!flagtododir) |
| 1269 | { | 1269 | { |
| 1270 | if (!trigger_pulled(rfds)) | 1270 | if (!trigger_pulled(rfds)) |
| 1271 | if (recent < nexttodorun) | 1271 | if (recent < nexttodorun) |
| 1272 | return; | 1272 | return; |
| 1273 | trigger_set(); | 1273 | trigger_set(); |
| 1274 | tododir = opendir("todo"); | 1274 | readsubdir_init(&todosubdir, "todo", pausedir); |
| 1275 | if (!tododir) | 1275 | flagtododir = 1; |
| 1276 | { | ||
| 1277 | pausedir("todo"); | ||
| 1278 | return; | ||
| 1279 | } | ||
| 1280 | nexttodorun = recent + SLEEP_TODO; | 1276 | nexttodorun = recent + SLEEP_TODO; |
| 1281 | } | 1277 | } |
| 1282 | 1278 | ||
| 1283 | d = readdir(tododir); | 1279 | switch(readsubdir_next(&todosubdir, &id)) |
| 1284 | if (!d) | ||
| 1285 | { | 1280 | { |
| 1286 | closedir(tododir); | 1281 | case 1: |
| 1287 | tododir = 0; | 1282 | break; |
| 1288 | return; | 1283 | case 0: |
| 1284 | flagtododir = 0; | ||
| 1285 | default: | ||
| 1286 | return; | ||
| 1289 | } | 1287 | } |
| 1290 | if (str_equal(d->d_name,".")) return; | ||
| 1291 | if (str_equal(d->d_name,"..")) return; | ||
| 1292 | len = scan_ulong(d->d_name,&id); | ||
| 1293 | if (!len || d->d_name[len]) return; | ||
| 1294 | 1288 | ||
| 1295 | fnmake_todo(id); | 1289 | fnmake_todo(id); |
| 1296 | 1290 | ||
