This patch adds support for custom subject lines for the automated
responses to (un)subscription probe and confirmation messages.  To use
this feature, create one or more of the following files within the list
directory:
	subject/sub-confirm
	subject/sub-ok
	subject/unsub-confirm
	subject/unsub-ok
This patch reads the first line in the appropriate file (if present) and
uses it as the subject line.
--
Bruce Guenter <bruceg@em.ca> http://em.ca/~bruceg/ http://untroubled.org/
OpenPGP key: 699980E8 / D0B7 C8DD 365D A395 29DA  2E2A E96F B2DC 6999 80E8

diff -urN -x '*~' -x Makefile -x 'auto*' -x '*.h' -x load -x compile -x 'make*' -x '*systype' ezmlm-0.53/ezmlm-manage.c ezmlm-0.53-customsubj/ezmlm-manage.c
--- ezmlm-0.53/ezmlm-manage.c	Sun Jun 29 21:11:54 1997
+++ ezmlm-0.53-customsubj/ezmlm-manage.c	Tue Mar 26 23:49:59 2002
@@ -49,6 +49,8 @@
 stralloc confirm = {0};
 stralloc line = {0};
 stralloc quoted = {0};
+stralloc subjecttmp = {0};
+stralloc subjectpath = {0};
 
 int hashok(action)
 char *action;
@@ -138,6 +140,8 @@
   char *host;
   char *local;
   char *action;
+  char *subjaction;
+  char *subject;
   int fd;
   int i;
   int flagconfirm;
@@ -234,12 +238,25 @@
   qmail_puts(&qq,"\n");
 
   flaghashok = 1;
-  if (str_start(action,"-sc.")) flaghashok = hashok(action);
-  if (str_start(action,"-uc.")) flaghashok = hashok(action);
+  subjaction = 0;
+  if (str_start(action,"-sc.")) {
+    subjaction = "sub-ok";
+    flaghashok = hashok(action);
+  }
+  if (str_start(action,"-uc.")) {
+    subjaction = "unsub-ok";
+    flaghashok = hashok(action);
+  }
 
   flagconfirm = 0;
-  if (str_equal(action,"-subscribe")) flagconfirm = 1;
-  if (str_equal(action,"-unsubscribe")) flagconfirm = 1;
+  if (str_equal(action,"-subscribe")) {
+    subjaction = "sub-confirm";
+    flagconfirm = 1;
+  }
+  if (str_equal(action,"-unsubscribe")) {
+    subjaction = "unsub-confirm";
+    flagconfirm = 1;
+  }
   if (!flaghashok) flagconfirm = 1;
   
   if (flagconfirm) {
@@ -270,7 +287,26 @@
   }
   if (!stralloc_0(&confirm)) die_nomem();
 
-  qmail_puts(&qq,"Subject: ezmlm response\n");
+  subject = "ezmlm response";
+  if (subjaction) {
+    if (!stralloc_copys(&subjectpath, "subject/")) die_nomem();
+    if (!stralloc_cats(&subjectpath, subjaction)) die_nomem();
+    if (!stralloc_0(&subjectpath)) die_nomem();
+    if (slurp(subjectpath.s, &subjecttmp,256)) {
+      int i;
+      subject = subjecttmp.s;
+      if (subject[i = str_chr(subject, '\n')] != 0) {
+	while (subject[i-1] == '\r' ||
+	       subject[i-1] == '\t' ||
+	       subject[i-1] == ' ')
+	  --i;
+	subject[i] = 0;
+      }
+    }
+  }
+  qmail_puts(&qq,"Subject: ");
+  qmail_puts(&qq,subject);
+  qmail_puts(&qq,"\n");
 
   if (!stralloc_copys(&mydtline,"Delivered-To: responder for ")) die_nomem();
   if (!stralloc_catb(&mydtline,outlocal.s,outlocal.len)) die_nomem();
