From a620bf4593c31772e75dda6465f57a4031ce6109 Mon Sep 17 00:00:00 2001 From: Peter Simons Date: Tue, 16 Jan 2001 12:09:12 +0000 Subject: [PATCH] When a request for confirmation is required, the originator of the command will receive a short mail, telling him that this is so, so that he knows what's going on. --- subscribe.c | 28 +++++++++++++++++++++++----- unsubscribe.c | 23 +++++++++++++++++++++-- 2 files changed, 44 insertions(+), 7 deletions(-) diff --git a/subscribe.c b/subscribe.c index 9b78eae..4db22cb 100644 --- a/subscribe.c +++ b/subscribe.c @@ -186,11 +186,9 @@ AddAddress(struct Mail * MailStruct, fh = vOpenMailer(envelope, originator, NULL); if (fh != NULL) { - fprintf(fh, "From: %s-request@%s (Petidomo Mailing List Server)\n", - listname, ListConfig->fqdn); + fprintf(fh, "From: %s-request@%s (Petidomo Mailing List Server)\n", listname, ListConfig->fqdn); fprintf(fh, "To: %s\n", originator); - fprintf(fh, "Subject: Petidomo: Your request \"subscribe %s %s\"\n", - address, listname); + fprintf(fh, "Subject: Petidomo: Your request \"subscribe %s %s\"\n", address, listname); if (MailStruct->Message_Id != NULL) fprintf(fh, "In-Reply-To: %s\n", MailStruct->Message_Id); fprintf(fh, "Precedence: junk\n"); @@ -235,13 +233,33 @@ AddAddress(struct Mail * MailStruct, fprintf(fh, "\n %s\n\n", cookie); fprintf(fh, "in your reply.\n"); CloseMailer(fh); + + fh = vOpenMailer(envelope, originator, NULL); + if (fh != NULL) + { + fprintf(fh, "From: %s-request@%s (Petidomo Mailing List Server)\n", listname, ListConfig->fqdn); + fprintf(fh, "To: %s\n", originator); + fprintf(fh, "Subject: Petidomo: Your request \"subscribe %s %s\"\n", address, listname); + if (MailStruct->Message_Id != NULL) + fprintf(fh, "In-Reply-To: %s\n", MailStruct->Message_Id); + fprintf(fh, "Precedence: junk\n"); + fprintf(fh, "Sender: %s\n", envelope); + fprintf(fh, "\n"); + fprintf(fh, "Subscribing the address will need confirmation. Such a\n"); + fprintf(fh, "request has been sent to the address already, so don't move!\n"); + CloseMailer(fh); + } + else + { + syslog(LOG_ERR, "Failed to send email to \"%s\" concerning his request.", originator); + return -1; + } } else { syslog(LOG_ERR, "Failed to send email to \"%s\"!", owner); return -1; } - return 0; } diff --git a/unsubscribe.c b/unsubscribe.c index a2d8692..809e420 100644 --- a/unsubscribe.c +++ b/unsubscribe.c @@ -218,8 +218,6 @@ DeleteAddress(struct Mail * MailStruct, char* command = text_easy_sprintf("unsubscribe %s %s", address, listname); char* cookie = queue_command(MailStruct, command); - /* Notify the owner. */ - fh = vOpenMailer(envelope, address, NULL); if (fh != NULL) { @@ -245,6 +243,27 @@ DeleteAddress(struct Mail * MailStruct, return -1; } + fh = vOpenMailer(envelope, originator, NULL); + if (fh != NULL) + { + fprintf(fh, "From: %s-request@%s (Petidomo Mailing List Server)\n", listname, ListConfig->fqdn); + fprintf(fh, "To: %s\n", originator); + fprintf(fh, "Subject: Petidomo: Your request \"unsubscribe %s %s\"\n", address, listname); + if (MailStruct->Message_Id != NULL) + fprintf(fh, "In-Reply-To: %s\n", MailStruct->Message_Id); + fprintf(fh, "Precedence: junk\n"); + fprintf(fh, "Sender: %s\n", envelope); + fprintf(fh, "\n"); + fprintf(fh, "Unsubscribing the address will need confirmation. Such a\n"); + fprintf(fh, "request has been sent to the address already, so don't move!\n"); + CloseMailer(fh); + } + else + { + syslog(LOG_ERR, "Failed to send email to \"%s\" concerning his request.", originator); + return -1; + } + return 0; }