]> git.ipfire.org Git - thirdparty/mlmmj.git/commitdiff
mlmmj-maintd work (still in progress)
authormmj <none@none>
Tue, 1 Jun 2004 22:12:46 +0000 (08:12 +1000)
committermmj <none@none>
Tue, 1 Jun 2004 22:12:46 +0000 (08:12 +1000)
src/Makefile.am
src/mlmmj-maintd.c

index 0ac97f9a72ac1877d954ac5898f71fe3ab832548..2b0c12753183588d6fc059ce9fb0a1ae7ba8683b 100644 (file)
@@ -41,4 +41,4 @@ mlmmj_bounce_SOURCES = mlmmj-bounce.c print-version.c log_error.c \
                       subscriberfuncs.c strgen.c random-int.c writen.c
 
 mlmmj_maintd_SOURCES = mlmmj-maintd.c print-version.c log_error.c mygetline.c \
-                      strgen.c random-int.c
+                      strgen.c random-int.c chomp.c
index 0cc610de74bc1eaa50361db113d68aaac36b3f85..99c24948e581fd032d9d507dec8caa4f8328346e 100644 (file)
@@ -18,6 +18,7 @@
 #include "mlmmj-maintd.h"
 #include "mlmmj.h"
 #include "strgen.h"
+#include "chomp.h"
 #include "log_error.h"
 #include "mygetline.h"
 
@@ -115,10 +116,8 @@ int resend_queue(const char *listdir, const char *mlmmjsend)
        char *discardedname = NULL;
        char *dirname = concatstr(2, listdir, "/queue/");
        FILE *ffrom, *fto, *f;
-       size_t len;
        pid_t pid;
        struct stat st;
-       time_t t;
        int discarded = 0;
 
        if(chdir(dirname) < 0) {
@@ -133,7 +132,7 @@ int resend_queue(const char *listdir, const char *mlmmjsend)
        }
 
        while((dp = readdir(queuedir)) != NULL) {
-               if(strchr(dp->d_name, "."))
+               if(strchr(dp->d_name, '.'))
                        continue;
                if(stat(dp->d_name, &st) < 0) {
                        log_error(LOG_ARGS, "Could not stat(%s)",dp->d_name);
@@ -157,6 +156,7 @@ int resend_queue(const char *listdir, const char *mlmmjsend)
                        } else {
                                log_error(LOG_ARGS, "Could not stat(%s)",
                                                dp->d_name);
+                       }
                }
 
                toname = concatstr(2, mailname, ".reciptto");
@@ -168,6 +168,9 @@ int resend_queue(const char *listdir, const char *mlmmjsend)
                                discarded = discardmail(mailname,
                                                        discardedname,
                                                        3600);
+                       } else {
+                               log_error(LOG_ARGS, "Could not stat(%s)",
+                                               dp->d_name);
                        }
                }
                
@@ -192,10 +195,12 @@ int resend_queue(const char *listdir, const char *mlmmjsend)
                }
 
                from = myfgetline(ffrom);
+               chomp(from);
                fclose(ffrom);
                unlink(fromname);
                free(fromname);
                to = myfgetline(fto);
+               chomp(to);
                fclose(fto);
                unlink(toname);
                free(toname);
@@ -205,6 +210,7 @@ int resend_queue(const char *listdir, const char *mlmmjsend)
                        repto = NULL;
                } else {
                        repto = myfgetline(f);
+                       chomp(repto);
                        fclose(f);
                        unlink(reptoname);
                        free(reptoname);
@@ -213,7 +219,10 @@ int resend_queue(const char *listdir, const char *mlmmjsend)
                pid = fork();
 
                if(pid == 0) {
-                       if(repto)
+                       if(repto) {
+                               printf("%s -l %s -m %s -F %s -T %s -R %s -a\n",
+                                               mlmmjsend, "1", mailname, from,
+                                               to, repto);
                                execlp(mlmmjsend, mlmmjsend,
                                                "-l", "1",
                                                "-m", mailname,
@@ -221,14 +230,18 @@ int resend_queue(const char *listdir, const char *mlmmjsend)
                                                "-T", to,
                                                "-R", repto,
                                                "-a", 0);
-                       else
+                       } else {
+                               printf("%s -l %s -m %s -F %s -T %s -a\n",
+                                               mlmmjsend, "1", mailname, from, to);
                                execlp(mlmmjsend, mlmmjsend,
                                                "-l", "1",
                                                "-m", mailname,
                                                "-F", from,
                                                "-T", to,
                                                "-a", 0);
+                       }
                }
+       }
 
        return 0;
 }