--- ipurge.c.orig 2002-11-14 11:47:52.000000000 -0400 +++ ipurge.c 2003-03-11 15:55:35.000000000 -0400 @@ -82,6 +82,7 @@ int exact = -1; int pattern = -1; int skipflagged = 0; +int onlydeleted = 0; /* for statistical purposes */ typedef struct mbox_stats_s { @@ -115,7 +116,7 @@ usage(argv[0]); } - while ((option = getopt(argc, argv, "C:hxd:b:k:m:fs")) != EOF) { + while ((option = getopt(argc, argv, "C:hxd:b:k:m:fso")) != EOF) { switch (option) { case 'C': /* alt config file */ alt_config = optarg; @@ -153,6 +154,9 @@ case 's' : { skipflagged = 1; } break; + case 'o' : { + onlydeleted = 1; + } break; case 'h': default: usage(argv[0]); } @@ -196,12 +200,13 @@ int usage(char *name) { - printf("usage: %s [-f] [-s] [-C <alt_config>] [-x] {-d days &| -b bytes|-k Kbytes|-m Mbytes}\n\t[mboxpattern1 ... [mboxpatternN]]\n", name); + printf("usage: %s [-f] [-s] [-o] [-C <alt_config>] [-x] {-d days &| -b bytes|-k Kbytes|-m Mbytes}\n\t[mboxpattern1 ... [mboxpatternN]]\n", name); printf("\tthere are no defaults and at least one of -d, -b, -k, -m\n\tmust be specified\n"); printf("\tif no mboxpattern is given %s works on all mailboxes\n", name); printf("\t -x specifies an exact match for days or size\n"); printf("\t -f force also to delete mail below user.* and INBOX.*\n"); printf("\t -s skip over messages that are flagged.\n"); + printf("\t -o only process messages that are deleted.\n"); exit(0); } @@ -270,10 +275,12 @@ bit32 senttime; bit32 msgsize; bit32 flagged; + bit32 delete_flagged; senttime = ntohl(*((bit32 *)(buf + OFFSET_SENTDATE))); msgsize = ntohl(*((bit32 *)(buf + OFFSET_SIZE))); flagged = ntohl(*((bit32 *)(buf + OFFSET_SYSTEM_FLAGS))) & FLAG_FLAGGED; + delete_flagged = ntohl(*((bit32 *)(buf + OFFSET_SYSTEM_FLAGS))) & FLAG_DELETED; stats->total++; stats->total_bytes += msgsize; @@ -281,6 +288,9 @@ if (skipflagged && flagged) return 0; + if (onlydeleted && !delete_flagged) + return 0; + if (exact == 1) { if (days >= 0) { my_time = time(0);
I altered ipurce.c a bit to include a -o option. The -o option will only
purge messages with the deleted flag set. Attached is the diff.