summaryrefslogtreecommitdiffstats
path: root/qmail-send.c
diff options
context:
space:
mode:
Diffstat (limited to 'qmail-send.c')
-rw-r--r--qmail-send.c38
1 files changed, 16 insertions, 22 deletions
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
98void fnmake_info(id) unsigned long id; { fn.len = fmtqfn(fn.s,"info/",id,1); } 98void fnmake_info(id) unsigned long id; { fn.len = fmtqfn(fn.s,"info/",id,1); }
99void fnmake_todo(id) unsigned long id; { fn.len = fmtqfn(fn.s,"todo/",id,0); } 99void fnmake_todo(id) unsigned long id; { fn.len = fmtqfn(fn.s,"todo/",id,1); }
100void fnmake_mess(id) unsigned long id; { fn.len = fmtqfn(fn.s,"mess/",id,1); } 100void fnmake_mess(id) unsigned long id; { fn.len = fmtqfn(fn.s,"mess/",id,1); }
101void fnmake_foop(id) unsigned long id; { fn.len = fmtqfn(fn.s,"foop/",id,0); } 101void fnmake_foop(id) unsigned long id; { fn.len = fmtqfn(fn.s,"foop/",id,0); }
102void fnmake_split(id) unsigned long id; { fn.len = fmtqfn(fn.s,"",id,1); } 102void 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
1218datetime_sec nexttodorun; 1218datetime_sec nexttodorun;
1219DIR *tododir; /* if 0, have to opendir again */ 1219int flagtododir = 0; /* if 0, have to readsubdir_init again */
1220readsubdir todosubdir;
1220stralloc todoline = {0}; 1221stralloc todoline = {0};
1221char todobuf[SUBSTDIO_INSIZE]; 1222char todobuf[SUBSTDIO_INSIZE];
1222char todobufinfo[512]; 1223char todobufinfo[512];
@@ -1224,7 +1225,7 @@ char todobufchan[CHANNELS][1024];
1224 1225
1225void todo_init() 1226void 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