Be a little smarter about return-path generation.
authorArt Cancro <ajc@citadel.org>
Wed, 27 Jun 2007 05:32:56 +0000 (05:32 +0000)
committerArt Cancro <ajc@citadel.org>
Wed, 27 Jun 2007 05:32:56 +0000 (05:32 +0000)
citadel/msgbase.c

index eadb635c384b78c786b5ea0a2b1a045c801b258b..97397b52b7511c6ce7487678712dc7e3ad10085e 100644 (file)
@@ -2931,6 +2931,7 @@ struct CtdlMessage *CtdlMakeMessage(
        char dest_node[256];
        char buf[1024];
        struct CtdlMessage *msg;
+       int i;
 
        msg = malloc(sizeof(struct CtdlMessage));
        memset(msg, 0, sizeof(struct CtdlMessage));
@@ -2944,8 +2945,21 @@ struct CtdlMessage *CtdlMakeMessage(
        striplt(recipient);
        striplt(recp_cc);
 
-       snprintf(buf, sizeof buf, "cit%ld", author->usernum);   /* Path */
-       msg->cm_fields['P'] = strdup(buf);
+       /* Path or Return-Path */
+       if (my_email == NULL) my_email = "";
+
+       if (strlen(my_email) > 0) {
+               msg->cm_fields['P'] = strdup(my_email);
+       }
+       else {
+               snprintf(buf, sizeof buf, "%s", author->fullname);
+               msg->cm_fields['P'] = strdup(buf);
+       }
+       for (i=0; (msg->cm_fields['P'][i]!=0); ++i) {
+               if (isspace(msg->cm_fields['P'][i])) {
+                       msg->cm_fields['P'][i] = '_';
+               }
+       }
 
        snprintf(buf, sizeof buf, "%ld", (long)time(NULL));     /* timestamp */
        msg->cm_fields['T'] = strdup(buf);