updated on Mon Jan 16 00:01:41 UTC 2012
[aur-mirror.git] / qmail / ext_todo-20020524-add-big-todo.patch
blob8ac673feeeb59d43760dc4440dadbd1d7f47f3d8
1 This patch makes the ext_todo patch work with Russell Nelson's
2 big-todo patch. Apply big-todo, then ext_todo, then this patch.
4 Please report any comments or bugs in this patch to
5 Andreas Aardal Hanssen <andreas@hanssen.name> (protected by tmda).
7 Updated 2002-07-12 17:17:00 CET: Removed last section in patch,
8 which caused message sizes to not get calculated.
11 diff -uN qmail-1.03/qmail-todo.c qmail-1.03-fixed/qmail-todo.c
12 --- qmail-1.03/qmail-todo.c Fri Jul 5 11:22:12 2002
13 +++ qmail-1.03-fixed/qmail-todo.c Fri Jul 5 11:18:27 2002
14 @@ -74,7 +82,7 @@
17 void fnmake_info(unsigned long id) { fn.len = fmtqfn(fn.s,"info/",id,1); }
18 -void fnmake_todo(unsigned long id) { fn.len = fmtqfn(fn.s,"todo/",id,0); }
19 +void fnmake_todo(unsigned long id) { fn.len = fmtqfn(fn.s,"todo/",id,1); }
20 void fnmake_mess(unsigned long id) { fn.len = fmtqfn(fn.s,"mess/",id,1); }
21 void fnmake_chanaddr(unsigned long id, int c)
22 { fn.len = fmtqfn(fn.s,chanaddr[c],id,1); }
23 @@ -329,7 +392,8 @@
24 /* this file is not too long ------------------------------------------ TODO */
26 datetime_sec nexttodorun;
27 -DIR *tododir; /* if 0, have to opendir again */
28 +int flagtododir = 0; /* if 0, have to readsubdir_init again */
29 +readsubdir todosubdir;
30 stralloc todoline = {0};
31 char todobuf[SUBSTDIO_INSIZE];
32 char todobufinfo[512];
33 @@ -337,7 +401,7 @@
35 void todo_init(void)
37 - tododir = 0;
38 + flagtododir = 0;
39 nexttodorun = now();
40 trigger_set();
42 @@ -346,7 +410,7 @@
44 if (flagexitasap) return;
45 trigger_selprep(nfds,rfds);
46 - if (tododir) *wakeup = 0;
47 + if (flagtododir) *wakeup = 0;
48 if (*wakeup > nexttodorun) *wakeup = nexttodorun;
51 @@ -361,8 +425,7 @@
52 char ch;
53 int match;
54 unsigned long id;
55 - unsigned int len;
56 - direntry *d;
57 + int z;
58 int c;
59 unsigned long uid;
60 unsigned long pid;
61 @@ -373,32 +436,26 @@
63 if (flagexitasap) return;
65 - if (!tododir)
66 + if (!flagtododir)
68 if (!trigger_pulled(rfds))
69 if (recent < nexttodorun)
70 return;
71 trigger_set();
72 - tododir = opendir("todo");
73 - if (!tododir)
74 - {
75 - pausedir("todo");
76 - return;
77 - }
78 + readsubdir_init(&todosubdir, "todo", pausedir);
79 + flagtododir = 1;
80 nexttodorun = recent + SLEEP_TODO;
83 - d = readdir(tododir);
84 - if (!d)
85 + switch(readsubdir_next(&todosubdir, &id))
87 - closedir(tododir);
88 - tododir = 0;
89 - return;
90 + case 1:
91 + break;
92 + case 0:
93 + flagtododir = 0;
94 + default:
95 + return;
97 - if (str_equal(d->d_name,".")) return;
98 - if (str_equal(d->d_name,"..")) return;
99 - len = scan_ulong(d->d_name,&id);
100 - if (!len || d->d_name[len]) return;
102 fnmake_todo(id);