]> git.ipfire.org Git - thirdparty/mlmmj.git/commitdiff
Add -a switch for archive [yes|no]
authormmj <none@none>
Thu, 27 May 2004 07:16:50 +0000 (17:16 +1000)
committermmj <none@none>
Thu, 27 May 2004 07:16:50 +0000 (17:16 +1000)
src/mlmmj-maintd.c
src/mlmmj-send.c

index 0b3675326c1856a340bfa872ea1388dc3a7b1793..efa8cd7d1fcc761291944fd4b3f2998f79186969 100644 (file)
@@ -30,14 +30,13 @@ static void print_help(const char *prg)
 
 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;
 }
index cc8bff27f5fb1edcdcfb819b0161083cc60194b0..91347e4a5860d1aae70214a2dc0c094a86deb48c 100644 (file)
@@ -359,8 +359,9 @@ void sig_child(int sig)
 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 @@ int main(int argc, char **argv)
 {
        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 @@ int main(int argc, char **argv)
        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 @@ int main(int argc, char **argv)
 
        if(listctrl[0] != '1' && listctrl[0] != '2')
                listaddr = getlistaddr(listdir);
+       else
+               archive = 0;
        
        /* initialize file with mail to send */
 
@@ -486,7 +492,7 @@ int main(int argc, char **argv)
        }
 
        /* 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 @@ int main(int argc, char **argv)
                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