Index: ossp-pkg/petidomo/subscribe.c RCS File: /v/ossp/cvs/ossp-pkg/petidomo/subscribe.c,v rcsdiff -q -kk '-r1.15' '-r1.16' -u '/v/ossp/cvs/ossp-pkg/petidomo/subscribe.c,v' 2>/dev/null --- subscribe.c 2001/01/18 20:30:50 1.15 +++ subscribe.c 2001/01/19 13:31:11 1.16 @@ -213,7 +213,7 @@ char* command = text_easy_sprintf("subscribe %s %s", address, listname); char* cookie = queue_command(MailStruct, command); - /* Notify the owner. */ + /* Send request for confirmation to the user. */ fh = vOpenMailer(envelope, address, NULL); if (fh != NULL) @@ -224,35 +224,48 @@ fprintf(fh, "Precedence: junk\n"); fprintf(fh, "Sender: %s\n", envelope); fprintf(fh, "\n"); - 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 " \ - "request by replying to this mail and citing the string", - originator, address, listname); + 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 " \ + "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 " \ + "request by replying to this mail and citing the string", + originator, address, listname); text_wordwrap(buffer, 70); fprintf(fh, "%s\n", buffer); 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 + /* If the request for confirmation has been sent to an + address different to that of the originator, notify him + what happened. */ + + if (strcasecmp(address, originator) != 0) { - syslog(LOG_ERR, "Failed to send email to \"%s\" concerning his request.", originator); - 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 \"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 Index: ossp-pkg/petidomo/unsubscribe.c RCS File: /v/ossp/cvs/ossp-pkg/petidomo/unsubscribe.c,v rcsdiff -q -kk '-r1.14' '-r1.15' -u '/v/ossp/cvs/ossp-pkg/petidomo/unsubscribe.c,v' 2>/dev/null --- unsubscribe.c 2001/01/18 20:30:50 1.14 +++ unsubscribe.c 2001/01/19 13:31:11 1.15 @@ -218,6 +218,8 @@ char* command = text_easy_sprintf("unsubscribe %s %s", address, listname); char* cookie = queue_command(MailStruct, command); + /* Send request for confirmation to the user. */ + fh = vOpenMailer(envelope, address, NULL); if (fh != NULL) { @@ -227,10 +229,16 @@ fprintf(fh, "Precedence: junk\n"); fprintf(fh, "Sender: %s\n", envelope); fprintf(fh, "\n"); - 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 " \ - "request by replying to this mail and citing the string", - originator, address, listname); + 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 " \ + "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 " \ + "request by replying to this mail and citing the string", + originator, address, listname); text_wordwrap(buffer, 70); fprintf(fh, "%s\n", buffer); fprintf(fh, "\n %s\n\n", cookie); @@ -243,25 +251,32 @@ 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 + /* If the request for confirmation has been sent to an + address different to that of the originator, notify him + what happened. */ + + if (strcasecmp(address, originator) == 0) { - syslog(LOG_ERR, "Failed to send email to \"%s\" concerning his request.", originator); - 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;