changeset 116:f619b85b02d1

Add -a switch for archive [yes|no]
author mmj
date Thu, 27 May 2004 17:16:50 +1000
parents 4596dfc0d895
children 9a39dff171fa
files src/mlmmj-maintd.c src/mlmmj-send.c
diffstat 2 files changed, 13 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/src/mlmmj-maintd.c	Thu May 27 15:44:01 2004 +1000
+++ b/src/mlmmj-maintd.c	Thu May 27 17:16:50 2004 +1000
@@ -30,15 +30,14 @@
 
 int clean_moderation(const char *listdir)
 {
-#if 0
 	DIR *moddir;
 	struct dirent *dp;
-#endif
 
 	/* TODO: Go through the moderation/ directory and delete mails
 	 * older than MODREQLIFE (control/modreqlife later on)
 	 */
 		
+		
 	return 0;
 }
 
--- a/src/mlmmj-send.c	Thu May 27 15:44:01 2004 +1000
+++ b/src/mlmmj-send.c	Thu May 27 17:16:50 2004 +1000
@@ -359,8 +359,9 @@
 static void print_help(const char *prg)
 {
         printf("Usage: %s [-L /path/to/list || -l listctrl] -m /path/to/mail "
-	       "[-D] [-F] [-h]\n"
-	       "       [-r] [-R] [-T] [-V]\n"
+	       "[-a] [-D] [-F]\n"
+	       "       [-h] [-r] [-R] [-T] [-V]\n"
+	       " -a: Don't archive the mail\n"
 	       " -D: Don't delete the mail after it's sent\n"
 	       " -F: What to use as MAIL FROM:\n"
 	       " -h: This help\n"
@@ -380,7 +381,7 @@
 {
 	size_t len = 0;
 	int sockfd = 0, opt, mindex;
-	int deletewhensent = 1, *newsockfd, sendres;
+	int deletewhensent = 1, *newsockfd, sendres, archive = 1;
 	char *listaddr, *mailfilename = NULL, *subfilename = NULL;
 	char *replyto = NULL, *bounceaddr = NULL, *to_addr = NULL;
 	char *relayhost = NULL, *archivefilename = NULL, *tmpstr;
@@ -397,8 +398,11 @@
 	mlmmjbounce = concatstr(2, dirname(argv0), "/mlmmj-bounce");
 	free(argv0);
 	
-	while ((opt = getopt(argc, argv, "VDhm:l:L:R:F:T:r:")) != -1){
+	while ((opt = getopt(argc, argv, "aVDhm:l:L:R:F:T:r:")) != -1){
 		switch(opt) {
+		case 'a':
+			archive = 0;
+			break
 		case 'D':
 			deletewhensent = 0;
 			break;
@@ -458,6 +462,8 @@
 
 	if(listctrl[0] != '1' && listctrl[0] != '2')
 		listaddr = getlistaddr(listdir);
+	else
+		archive = 0;
 	
 	/* initialize file with mail to send */
 
@@ -486,7 +492,7 @@
 	}
 
 	/* initialize the archive filename */
-	if(listctrl[0] != '1' && listctrl[0] != '2') {
+	if(archive) {
 		mindex = incindexfile((const char *)listdir);
 		len = strlen(listdir) + 9 + 20;
 		archivefilename = malloc(len);
@@ -593,7 +599,7 @@
 		break;
 	}
 	
-	if(listctrl[0] != '1' && listctrl[0] != '2') {
+	if(archive) {
 		/* It is safe to rename() the mail file at this point, because
 		   the child processes (who might still be running) inherit a
 		   handle to the open file, so they don't care if it is moved