From a047399b38559dc8f031f2cce4587d8505ad2264 Mon Sep 17 00:00:00 2001 From: "Ralf S. Engelschall" Date: Sat, 20 Jan 2001 13:52:41 +0000 Subject: [PATCH] First bunch of cosmetic adjustments to text messages. Additionally --masterconf=FILE is also passed through to files created in acknowledge directory. --- config-files.c | 10 +++++----- hermes.c | 8 ++++---- main.c | 2 +- petidomo.h | 3 ++- queue-command.c | 5 ++--- subscribe.c | 26 +++++++++++++++----------- unsubscribe.c | 24 ++++++++++++++---------- 7 files changed, 43 insertions(+), 35 deletions(-) diff --git a/config-files.c b/config-files.c index 13dba19..b6ed93a 100644 --- a/config-files.c +++ b/config-files.c @@ -43,7 +43,7 @@ static char* index_file = LOCALSTATEDIR "/index"; static char* list_dir = LOCALSTATEDIR "/lists"; static char* ack_queue_dir = LOCALSTATEDIR "/ack_queue"; -int InitPetidomo(const char* masterconfig_path) +int InitPetidomo(const char* masterconfig) { int rc; @@ -78,7 +78,7 @@ int InitPetidomo(const char* masterconfig_path) /* Parse the config file. */ - rc = ReadConfig(masterconfig_path, MasterCF); + rc = ReadConfig(masterconfig, MasterCF); if (rc != 0) { syslog(LOG_ERR, "Failed to parse the master config file."); @@ -89,17 +89,17 @@ int InitPetidomo(const char* masterconfig_path) if (fqdn == NULL) { - syslog(LOG_ERR, "The master config file \"%s\" doesn't set the host name.", masterconfig_path); + syslog(LOG_ERR, "The master config file \"%s\" doesn't set the host name.", masterconfig); return -1; } if (mta == NULL) { - syslog(LOG_ERR, "The master config file \"%s\" doesn't set the MTA.", masterconfig_path); + syslog(LOG_ERR, "The master config file \"%s\" doesn't set the MTA.", masterconfig); return -1; } if (master_password == NULL) { - syslog(LOG_ERR, "The master config file \"%s\" doesn't set the admin password.", masterconfig_path); + syslog(LOG_ERR, "The master config file \"%s\" doesn't set the admin password.", masterconfig); return -1; } if (strstr(mta_options, "%s") == NULL) diff --git a/hermes.c b/hermes.c index e11494b..d498ac8 100644 --- a/hermes.c +++ b/hermes.c @@ -200,11 +200,11 @@ hermes_main(char * incoming_mail, const char * listname) { fprintf(fh, "From: petidomo-approve@%s (Petidomo Mailing List Server)\n", ListConfig->fqdn); fprintf(fh, "To: %s\n", originator); - fprintf(fh, "Subject: Petidomo: CONFIRM %s@%s: Your posting to list \"%s\"\n", listname, ListConfig->fqdn, listname); + fprintf(fh, "Subject: Petidomo: APPROVE %s@%s: Your posting to list \"%s\"\n", listname, ListConfig->fqdn, listname); fprintf(fh, "Precedence: junk\n"); fprintf(fh, "Sender: %s\n", owner); fprintf(fh, "\n"); - fprintf(fh, "Your posting needs to be confirmed. Do this by replying\n"); + fprintf(fh, "Your posting needs to be approved. Do this by replying\n"); fprintf(fh, "to this mail and citing the string\n"); fprintf(fh, "\n"); fprintf(fh, " %s\n", cookie); @@ -260,12 +260,12 @@ hermes_main(char * incoming_mail, const char * listname) { fprintf(fh, "From: petidomo-approve@%s (Petidomo Mailing List Server)\n", ListConfig->fqdn); fprintf(fh, "To: %s\n", originator); - fprintf(fh, "Subject: Petidomo: CONFIRM %s@%s: Your posting to list \"%s\"\n", + fprintf(fh, "Subject: Petidomo: APPROVE %s@%s: Your posting to list \"%s\"\n", listname, ListConfig->fqdn, listname); fprintf(fh, "Precedence: junk\n"); fprintf(fh, "Sender: %s\n", owner); fprintf(fh, "\n"); - fprintf(fh, "Your posting needs to be confirmed. Do this by replying\n"); + fprintf(fh, "Your posting needs to be approved. Do this by replying\n"); fprintf(fh, "to this mail and citing the string\n"); fprintf(fh, "\n"); fprintf(fh, " %s\n", cookie); diff --git a/main.c b/main.c index 48fe9da..c61144a 100644 --- a/main.c +++ b/main.c @@ -37,7 +37,7 @@ static char* listname = NULL; static char* mode = NULL; -static char* masterconfig_path = SYSCONFDIR "/petidomo.conf"; +char* masterconfig_path = SYSCONFDIR "/petidomo.conf"; char g_is_approved = ARGV_FALSE; const char* who_am_i; diff --git a/petidomo.h b/petidomo.h index 616ca89..b2fac5a 100644 --- a/petidomo.h +++ b/petidomo.h @@ -51,6 +51,7 @@ extern char g_is_approved; extern const char* who_am_i; +extern char* masterconfig_path; /********** config.c **********/ @@ -104,7 +105,7 @@ struct List_Config char * ack_file; }; -int InitPetidomo(const char* masterconfig_path); +int InitPetidomo(const char*); const struct PD_Config *getMasterConfig(void); const struct List_Config *getListConfig(const char* listname); diff --git a/queue-command.c b/queue-command.c index 7580a88..a8dd771 100644 --- a/queue-command.c +++ b/queue-command.c @@ -39,9 +39,8 @@ char* queue_command(const struct Mail* mail, const char* command) syslog(LOG_ERR, "Opening ack spool file \"%s\" failed: %s", buffer, strerror(errno)); exit(1); } - fprintf(fh, "#! /bin/sh\n"); - fprintf(fh, "\n"); - fprintf(fh, "%s --mode=listserv --approved <<[end-of-%s-marker]\n", who_am_i, cookie); + fprintf(fh, "#!/bin/sh\n"); + fprintf(fh, "%s \\\n--masterconf=%s \\\n--mode=listserv --approved \\\n<<[end-of-%s-marker]\n", who_am_i, masterconfig_path, cookie); fprintf(fh, "Sender: %s\n", mail->Envelope); fprintf(fh, "From: %s\n", mail->From); if (mail->Reply_To) diff --git a/subscribe.c b/subscribe.c index f40741b..9153fbe 100644 --- a/subscribe.c +++ b/subscribe.c @@ -88,9 +88,9 @@ AddAddress(struct Mail * MailStruct, fprintf(fh, "\n"); buffer = text_easy_sprintf("You tried to subscribe the address \"%s\" to a mailing list. " \ "Unfortunately, your request could not be processed, because " \ - "you didn't specify a valid mailing list name to which the " \ + "you did not specify a valid mailing list name to which the " \ "address should be subscribed to. You may use the command INDEX " \ - "to receive an overview over the available mailing lists. Also, " \ + "to receive an overview of the available mailing lists. Also, " \ "use the command HELP to verify that you got the command syntax " \ "right.", address); text_wordwrap(buffer, 70); @@ -212,7 +212,7 @@ AddAddress(struct Mail * MailStruct, if (isValidAdminPassword(getPassword(), listname) == FALSE && ListConfig->subtype == SUBSCRIPTION_ACKED && !g_is_approved) { - /* Require confirmation. */ + /* Require approval. */ char* command; char* cookie; @@ -223,25 +223,28 @@ AddAddress(struct Mail * MailStruct, command = text_easy_sprintf("subscribe %s %s", address, listname); cookie = queue_command(MailStruct, command); - /* Send request for confirmation to the user. */ + /* Send request for approval to the user. */ fh = vOpenMailer(envelope, address, NULL); if (fh != NULL) { fprintf(fh, "From: petidomo-approve@%s (Petidomo Mailing List Server)\n", ListConfig->fqdn); fprintf(fh, "To: %s\n", address); - fprintf(fh, "Subject: Petidomo: CONFIRM %s@%s: Request from \"%s\"\n", listname, ListConfig->fqdn, originator); + if (strcasecmp(address, originator) == 0) + fprintf(fh, "Subject: Petidomo: APPROVE %s@%s: Your request \"subscribe %s\"\n", listname, ListConfig->fqdn, listname); + else + fprintf(fh, "Subject: Petidomo: APPROVE %s@%s: Request \"subscribe %s\" from \"%s\"\n", listname, ListConfig->fqdn, listname, originator); fprintf(fh, "Precedence: junk\n"); fprintf(fh, "Sender: %s\n", envelope); fprintf(fh, "\n"); if (strcasecmp(address, originator) == 0) buffer = text_easy_sprintf("You requested that the address \"%s\" should be subscribed to " \ - "the mailing list \"%s\". This will not happen unless you confirm the " \ + "the mailing list \"%s\". This will not happen unless you approve the " \ "request by replying to this mail and citing the string", address, listname); else buffer = text_easy_sprintf("Per request from \"%s\", the address \"%s\" should be subscribed to " \ - "the mailing list \"%s\". This will not happen unless you confirm the " \ + "the mailing list \"%s\". This will not happen unless you approve the " \ "request by replying to this mail and citing the string", originator, address, listname); text_wordwrap(buffer, 70); @@ -250,7 +253,7 @@ AddAddress(struct Mail * MailStruct, fprintf(fh, "in your reply.\n"); CloseMailer(fh); - /* If the request for confirmation has been sent to an + /* If the request for approval has been sent to an address different to that of the originator, notify him what happened. */ @@ -267,8 +270,9 @@ AddAddress(struct Mail * MailStruct, 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"); + fprintf(fh, "Subscribing the address \"%s\" to the list \"%s\"\n", address, listname); + fprintf(fh, "requires additional approval by \"%s\". A request\n", address); + fprintf(fh, "has been sent to this address. We are now awaiting the approval.\n"); CloseMailer(fh); } else @@ -361,7 +365,7 @@ AddAddress(struct Mail * MailStruct, fprintf(fh, "From: %s-request@%s (Petidomo Mailing List Server)\n", listname, ListConfig->fqdn); fprintf(fh, "To: %s\n", address); - fprintf(fh, "Subject: Petidomo: Welcome to the \"%s\" mailing list!\n", listname); + fprintf(fh, "Subject: Petidomo: Welcome to \"%s@%s\"!\n", listname, ListConfig->fqdn); if (MailStruct->Message_Id != NULL) fprintf(fh, "In-Reply-To: %s\n", MailStruct->Message_Id); fprintf(fh, "Precedence: junk\n"); diff --git a/unsubscribe.c b/unsubscribe.c index e1b3977..d19a59a 100644 --- a/unsubscribe.c +++ b/unsubscribe.c @@ -89,9 +89,9 @@ DeleteAddress(struct Mail * MailStruct, fprintf(fh, "\n"); buffer = text_easy_sprintf("You tried to unsubscribe the address \"%s\" from a mailing list. " \ "Unfortunately, your request could not be processed, because " \ - "you didn't specify a valid mailing list name from which the " \ + "you did not specify a valid mailing list name from which the " \ "address should be unsubscribed. You may use the command INDEX " \ - "to receive an overview over the available mailing lists. Also, " \ + "to receive an overview of the available mailing lists. Also, " \ "use the command HELP to verify that you got the command syntax " \ "right.", address); text_wordwrap(buffer, 70); @@ -215,7 +215,7 @@ DeleteAddress(struct Mail * MailStruct, if (isValidAdminPassword(getPassword(), listname) == FALSE && ListConfig->subtype == SUBSCRIPTION_ACKED && !g_is_approved) { - /* Require confirmation. */ + /* Require approval. */ char* command; char* cookie; @@ -226,25 +226,28 @@ DeleteAddress(struct Mail * MailStruct, command = text_easy_sprintf("unsubscribe %s %s", address, listname); cookie = queue_command(MailStruct, command); - /* Send request for confirmation to the user. */ + /* Send request for approval to the user. */ fh = vOpenMailer(envelope, address, NULL); if (fh != NULL) { fprintf(fh, "From: petidomo-approve@%s (Petidomo Mailing List Server)\n", ListConfig->fqdn); fprintf(fh, "To: %s\n", address); - fprintf(fh, "Subject: Petidomo: CONFIRM %s@%s: Request from \"%s\"\n", listname, ListConfig->fqdn, originator); + if (strcasecmp(address, originator) == 0) + fprintf(fh, "Subject: Petidomo: APPROVE %s@%s: Your request \"subscribe %s\"\n", listname, ListConfig->fqdn, listname); + else + fprintf(fh, "Subject: Petidomo: APPROVE %s@%s: Request \"subscribe %s\" from \"%s\"\n", listname, ListConfig->fqdn, listname, originator); fprintf(fh, "Precedence: junk\n"); fprintf(fh, "Sender: %s\n", envelope); fprintf(fh, "\n"); if (strcasecmp(address, originator) == 0) buffer = text_easy_sprintf("You requested that the address \"%s\" should be unsubscribed from " \ - "the mailing list \"%s\". This will not happen unless you confirm the " \ + "the mailing list \"%s\". This will not happen unless you approve the " \ "request by replying to this mail and citing the string", originator, address, listname); else buffer = text_easy_sprintf("Per request from \"%s\", the address \"%s\" should be unsubscribed from " \ - "the mailing list \"%s\". This will not happen unless you confirm the " \ + "the mailing list \"%s\". This will not happen unless you approve the " \ "request by replying to this mail and citing the string", originator, address, listname); text_wordwrap(buffer, 70); @@ -259,7 +262,7 @@ DeleteAddress(struct Mail * MailStruct, return -1; } - /* If the request for confirmation has been sent to an + /* If the request for approval has been sent to an address different to that of the originator, notify him what happened. */ @@ -276,8 +279,9 @@ DeleteAddress(struct Mail * MailStruct, 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"); + fprintf(fh, "Unsubscribing the address \"%s\" from the list \"%s\"\n", address, listname); + fprintf(fh, "requires additional approval by \"%s\". A request\n", address); + fprintf(fh, "has been sent to this address. We are now awaiting the approval.\n"); CloseMailer(fh); } else