[prev in list] [next in list] [prev in thread] [next in thread] 

List:       listar-dev
Subject:    [EDev] PATCH: Liscript_expand [un]subscribe-confirm.txt
From:       "Marcus Redivo" <mredivo () binarytool ! com>
Date:       2004-09-22 17:12:06
Message-ID: 1052.192.168.1.13.1095873126.squirrel () 192 ! 168 ! 1 ! 13
[Download RAW message or body]

--- src/modules/acctmgr/sub.c.orig	Mon Apr 26 23:45:03 2004
+++ src/modules/acctmgr/sub.c	Tue Sep 21 18:10:01 2004
@@ -3,6 +3,9 @@
 #include <string.h>
 #include <stdio.h>
 #include <stdlib.h>
+#include "mystring.h"
+#include "fileapi.h"
+#include "liscript.h"

 #include "acctmgr-mod.h"

@@ -405,30 +408,38 @@
            LMAPI->smtp_body_line(subdata->description);
        }

-		/* add file from subscribe-confirm-file */
-		if (LMAPI->get_var("subscribe-confirm-file")) {
-       		FILE *infile;
-       		char tempfilename[BIG_BUF]; /* Changed from SMALL_BUF to BIG_BUF due to listdir_file */
-
-       		LMAPI->listdir_file(tempfilename, LMAPI->get_string("list"),
-					LMAPI->get_string("subscribe-confirm-file"));
-
-       		if ((infile = LMAPI->open_file(tempfilename,"r")) != NULL) {
-          		char inputbuffer[BIG_BUF];
-          		char linebuffer[BIG_BUF];
-
-				LMAPI->smtp_body_line("# ");
-          		while(LMAPI->read_file(inputbuffer, sizeof(inputbuffer), infile)) {
-             		LMAPI->buffer_printf(linebuffer, sizeof(linebuffer) - 1, "# %s",
-							inputbuffer);
-					LMAPI->smtp_body_text(linebuffer);
-          		}
-				LMAPI->smtp_body_line("# ");
-          		LMAPI->close_file(infile);
-
-                subscribe_confirm_file_included = 1;
-       		}
-		} /* end if subscribe-confirm-file */
+	/* add file from subscribe-confirm-file */
+	if (LMAPI->get_var("subscribe-confirm-file")) {
+		FILE *infile;
+		char tempfilename[BIG_BUF]; /* Changed from SMALL_BUF to BIG_BUF due to listdir_file */
+
+		LMAPI->listdir_file(tempfilename, LMAPI->get_string("list"),
+				LMAPI->get_string("subscribe-confirm-file"));
+
+		if (exists_file(tempfilename)) {
+			char outfilename[BIG_BUF];
+			buffer_printf(outfilename, sizeof(outfilename) - 1, "%s.expand", tempfilename);
+			if (liscript_parse_file(tempfilename,outfilename)) {
+
+				if ((infile = LMAPI->open_file(outfilename,"r")) != NULL) {
+					char inputbuffer[BIG_BUF];
+					char linebuffer[BIG_BUF];
+
+					LMAPI->smtp_body_line("# ");
+					while(LMAPI->read_file(inputbuffer, sizeof(inputbuffer), infile)) {
+						LMAPI->buffer_printf(linebuffer, sizeof(linebuffer) - 1, "# %s",
+								inputbuffer);
+						LMAPI->smtp_body_text(linebuffer);
+					}
+					LMAPI->smtp_body_line("# ");
+					LMAPI->close_file(infile);
+
+					subscribe_confirm_file_included = 1;
+				}
+				unlink_file(outfilename);
+			}
+		}
+	} /* end if subscribe-confirm-file */

 		if( ! subscribe_confirm_file_included )
 		{
--- src/modules/acctmgr/unsub.c.orig	Mon Apr 26 23:45:03 2004
+++ src/modules/acctmgr/unsub.c	Tue Sep 21 17:51:23 2004
@@ -3,6 +3,9 @@
 #include <string.h>
 #include <stdio.h>
 #include <stdlib.h>
+#include "mystring.h"
+#include "fileapi.h"
+#include "liscript.h"

 #include "acctmgr-mod.h"

@@ -214,20 +217,28 @@
 		   LMAPI->listdir_file(tempfilename, LMAPI->get_string("list"),
 				   LMAPI->get_string("unsubscribe-confirm-file"));

-		   if((infile = LMAPI->open_file(tempfilename, "r")) != NULL) {
-			   char inputbuffer[BIG_BUF];
-			   char linebuffer[BIG_BUF];
-
-			   LMAPI->smtp_body_line("# ");
-			   while(LMAPI->read_file(inputbuffer, sizeof(inputbuffer), infile)) {
-				   LMAPI->buffer_printf(linebuffer, sizeof(linebuffer) - 1, "# %s",
-						   inputbuffer);
-				   LMAPI->smtp_body_text(linebuffer);
+		   if (exists_file(tempfilename)) {
+			   char outfilename[BIG_BUF];
+			   buffer_printf(outfilename, sizeof(outfilename) - 1, "%s.expand", tempfilename);
+			   if (liscript_parse_file(tempfilename,outfilename)) {
+
+				   if((infile = LMAPI->open_file(outfilename, "r")) != NULL) {
+					   char inputbuffer[BIG_BUF];
+					   char linebuffer[BIG_BUF];
+
+					   LMAPI->smtp_body_line("# ");
+					   while(LMAPI->read_file(inputbuffer, sizeof(inputbuffer), infile)) {
+						   LMAPI->buffer_printf(linebuffer, sizeof(linebuffer) - 1, "# %s",
+								   inputbuffer);
+						   LMAPI->smtp_body_text(linebuffer);
+					   }
+					   LMAPI->smtp_body_line("# ");
+					   LMAPI->close_file(infile);
+
+					   unsub_confirm_file_included = 1;
+				   }
+				   unlink_file(outfilename);
 			   }
-			   LMAPI->smtp_body_line("# ");
-			   LMAPI->close_file(infile);
-
-			   unsub_confirm_file_included = 1;
 		   }
 	   }
 	   if(!unsub_confirm_file_included) {




[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic