OSSP CVS Repository

ossp - Check-in [317]
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [Patchset]  [Tagging/Branching

Check-in Number: 317
Date: 2001-Jan-19 14:31:11 (local)
2001-Jan-19 13:31:11 (UTC)
User:simons
Branch:
Comment: When a un-/subscribe command needs confirmation, the request for confirmation is sent to the address that is supposed to added to or removed from the list. If, and only if, this address is different than the one from which the request came, a short mail is sent to the requestor to inform him what is going on.
Tickets:
Inspections:
Files:
ossp-pkg/petidomo/subscribe.c      1.15 -> 1.16     37 inserted, 24 deleted
ossp-pkg/petidomo/unsubscribe.c      1.14 -> 1.15     38 inserted, 23 deleted

ossp-pkg/petidomo/subscribe.c 1.15 -> 1.16

--- subscribe.c  2001/01/18 20:30:50     1.15
+++ subscribe.c  2001/01/19 13:31:11     1.16
@@ -1,6 +1,6 @@
 /*
    $Source: /v/ossp/cvs/ossp-pkg/petidomo/subscribe.c,v $
-   $Revision: 1.15 $
+   $Revision: 1.16 $
 
    Copyright (C) 2000 by CyberSolutions GmbH, Germany.
 
@@ -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


ossp-pkg/petidomo/unsubscribe.c 1.14 -> 1.15

--- unsubscribe.c        2001/01/18 20:30:50     1.14
+++ unsubscribe.c        2001/01/19 13:31:11     1.15
@@ -1,6 +1,6 @@
 /*
    $Source: /v/ossp/cvs/ossp-pkg/petidomo/unsubscribe.c,v $
-   $Revision: 1.14 $
+   $Revision: 1.15 $
 
    Copyright (C) 2000 by CyberSolutions GmbH, Germany.
 
@@ -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;

CVSTrac 2.0.1