Fossil SCM
Provide the ability to add a List-Id: header on out-bound notification emails.
Commit
e50c3629b8cd6c8f2bb24ff9ab8fe4ec5fb37f8334113165269fe99a152c4aca
Parent
c8a16fda7f18037…
1 file changed
+19
+19
| --- src/alerts.c | ||
| +++ src/alerts.c | ||
| @@ -278,10 +278,18 @@ | ||
| 278 | 278 | @ the "From:" address of the email notification. |
| 279 | 279 | @ The system administrator should arrange for emails sent to this address |
| 280 | 280 | @ to be handed off to the "fossil email incoming" command so that Fossil |
| 281 | 281 | @ can handle bounces. (Property: "email-self")</p> |
| 282 | 282 | @ <hr> |
| 283 | + | |
| 284 | + entry_attribute("List-ID", 40, "email-listid", | |
| 285 | + "elistid", "", 0); | |
| 286 | + @ <p> | |
| 287 | + @ If this is not an empty string, then it becomes the argument to | |
| 288 | + @ a "List-ID:" header on all out-bound notification emails. | |
| 289 | + @ (Property: "email-listid")</p> | |
| 290 | + @ <hr> | |
| 283 | 291 | |
| 284 | 292 | entry_attribute("Repository Nickname", 16, "email-subname", |
| 285 | 293 | "enn", "", 0); |
| 286 | 294 | @ <p><b>Required.</b> |
| 287 | 295 | @ This is short name used to identifies the repository in the |
| @@ -409,10 +417,11 @@ | ||
| 409 | 417 | const char *zDest; /* How to send email. */ |
| 410 | 418 | const char *zDb; /* Name of database file */ |
| 411 | 419 | const char *zDir; /* Directory in which to store as email files */ |
| 412 | 420 | const char *zCmd; /* Command to run for each email */ |
| 413 | 421 | const char *zFrom; /* Emails come from here */ |
| 422 | + const char *zListId; /* Argument to List-ID header */ | |
| 414 | 423 | SmtpSession *pSmtp; /* SMTP relay connection */ |
| 415 | 424 | Blob out; /* For zDest=="blob" */ |
| 416 | 425 | char *zErr; /* Error message */ |
| 417 | 426 | u32 mFlags; /* Flags */ |
| 418 | 427 | int bImmediateFail; /* On any error, call fossil_fatal() */ |
| @@ -434,10 +443,11 @@ | ||
| 434 | 443 | sqlite3_close(p->db); |
| 435 | 444 | p->db = 0; |
| 436 | 445 | p->zDb = 0; |
| 437 | 446 | p->zDir = 0; |
| 438 | 447 | p->zCmd = 0; |
| 448 | + p->zListId = 0; | |
| 439 | 449 | if( p->pSmtp ){ |
| 440 | 450 | smtp_client_quit(p->pSmtp); |
| 441 | 451 | smtp_session_free(p->pSmtp); |
| 442 | 452 | p->pSmtp = 0; |
| 443 | 453 | } |
| @@ -514,10 +524,11 @@ | ||
| 514 | 524 | }else{ |
| 515 | 525 | p->zDest = db_get("email-send-method",0); |
| 516 | 526 | } |
| 517 | 527 | if( fossil_strcmp(p->zDest,"off")==0 ) return p; |
| 518 | 528 | if( emailerGetSetting(p, &p->zFrom, "email-self") ) return p; |
| 529 | + p->zListId = db_get("email-listid", 0); | |
| 519 | 530 | if( fossil_strcmp(p->zDest,"db")==0 ){ |
| 520 | 531 | char *zErr; |
| 521 | 532 | int rc; |
| 522 | 533 | if( emailerGetSetting(p, &p->zDb, "email-send-db") ) return p; |
| 523 | 534 | rc = sqlite3_open(p->zDb, &p->db); |
| @@ -881,10 +892,13 @@ | ||
| 881 | 892 | blob_appendf(pOut, "Sender: <%s>\r\n", p->zFrom); |
| 882 | 893 | }else{ |
| 883 | 894 | blob_appendf(pOut, "From: <%s>\r\n", p->zFrom); |
| 884 | 895 | } |
| 885 | 896 | blob_appendf(pOut, "Date: %z\r\n", cgi_rfc822_datestamp(time(0))); |
| 897 | + if( p->zListId && p->zListId[0] ){ | |
| 898 | + blob_appendf(pOut, "List-Id: %s\r\n", p->zListId); | |
| 899 | + } | |
| 886 | 900 | if( strstr(blob_str(pHdr), "\r\nMessage-Id:")==0 ){ |
| 887 | 901 | /* Message-id format: "<$(date)x$(random)@$(from-host)>" where $(date) is |
| 888 | 902 | ** the current unix-time in hex, $(random) is a 64-bit random number, |
| 889 | 903 | ** and $(from) is the domain part of the email-self setting. */ |
| 890 | 904 | sqlite3_randomness(sizeof(r1), &r1); |
| @@ -1029,10 +1043,15 @@ | ||
| 1029 | 1043 | /* |
| 1030 | 1044 | ** SETTING: email-self width=40 |
| 1031 | 1045 | ** This is the email address for the repository. Outbound emails add |
| 1032 | 1046 | ** this email address as the "From:" field. |
| 1033 | 1047 | */ |
| 1048 | +/* | |
| 1049 | +** SETTING: email-listid width=40 | |
| 1050 | +** If this setting is not an empty string, then it becomes the argument to | |
| 1051 | +** a "List-ID:" header that is added to all out-bound notification emails. | |
| 1052 | +*/ | |
| 1034 | 1053 | /* |
| 1035 | 1054 | ** SETTING: email-send-relayhost width=40 sensitive |
| 1036 | 1055 | ** This is the hostname and TCP port to which output email messages |
| 1037 | 1056 | ** are sent when email-send-method is "relay". There should be an |
| 1038 | 1057 | ** SMTP server configured as a Mail Submission Agent listening on the |
| 1039 | 1058 |
| --- src/alerts.c | |
| +++ src/alerts.c | |
| @@ -278,10 +278,18 @@ | |
| 278 | @ the "From:" address of the email notification. |
| 279 | @ The system administrator should arrange for emails sent to this address |
| 280 | @ to be handed off to the "fossil email incoming" command so that Fossil |
| 281 | @ can handle bounces. (Property: "email-self")</p> |
| 282 | @ <hr> |
| 283 | |
| 284 | entry_attribute("Repository Nickname", 16, "email-subname", |
| 285 | "enn", "", 0); |
| 286 | @ <p><b>Required.</b> |
| 287 | @ This is short name used to identifies the repository in the |
| @@ -409,10 +417,11 @@ | |
| 409 | const char *zDest; /* How to send email. */ |
| 410 | const char *zDb; /* Name of database file */ |
| 411 | const char *zDir; /* Directory in which to store as email files */ |
| 412 | const char *zCmd; /* Command to run for each email */ |
| 413 | const char *zFrom; /* Emails come from here */ |
| 414 | SmtpSession *pSmtp; /* SMTP relay connection */ |
| 415 | Blob out; /* For zDest=="blob" */ |
| 416 | char *zErr; /* Error message */ |
| 417 | u32 mFlags; /* Flags */ |
| 418 | int bImmediateFail; /* On any error, call fossil_fatal() */ |
| @@ -434,10 +443,11 @@ | |
| 434 | sqlite3_close(p->db); |
| 435 | p->db = 0; |
| 436 | p->zDb = 0; |
| 437 | p->zDir = 0; |
| 438 | p->zCmd = 0; |
| 439 | if( p->pSmtp ){ |
| 440 | smtp_client_quit(p->pSmtp); |
| 441 | smtp_session_free(p->pSmtp); |
| 442 | p->pSmtp = 0; |
| 443 | } |
| @@ -514,10 +524,11 @@ | |
| 514 | }else{ |
| 515 | p->zDest = db_get("email-send-method",0); |
| 516 | } |
| 517 | if( fossil_strcmp(p->zDest,"off")==0 ) return p; |
| 518 | if( emailerGetSetting(p, &p->zFrom, "email-self") ) return p; |
| 519 | if( fossil_strcmp(p->zDest,"db")==0 ){ |
| 520 | char *zErr; |
| 521 | int rc; |
| 522 | if( emailerGetSetting(p, &p->zDb, "email-send-db") ) return p; |
| 523 | rc = sqlite3_open(p->zDb, &p->db); |
| @@ -881,10 +892,13 @@ | |
| 881 | blob_appendf(pOut, "Sender: <%s>\r\n", p->zFrom); |
| 882 | }else{ |
| 883 | blob_appendf(pOut, "From: <%s>\r\n", p->zFrom); |
| 884 | } |
| 885 | blob_appendf(pOut, "Date: %z\r\n", cgi_rfc822_datestamp(time(0))); |
| 886 | if( strstr(blob_str(pHdr), "\r\nMessage-Id:")==0 ){ |
| 887 | /* Message-id format: "<$(date)x$(random)@$(from-host)>" where $(date) is |
| 888 | ** the current unix-time in hex, $(random) is a 64-bit random number, |
| 889 | ** and $(from) is the domain part of the email-self setting. */ |
| 890 | sqlite3_randomness(sizeof(r1), &r1); |
| @@ -1029,10 +1043,15 @@ | |
| 1029 | /* |
| 1030 | ** SETTING: email-self width=40 |
| 1031 | ** This is the email address for the repository. Outbound emails add |
| 1032 | ** this email address as the "From:" field. |
| 1033 | */ |
| 1034 | /* |
| 1035 | ** SETTING: email-send-relayhost width=40 sensitive |
| 1036 | ** This is the hostname and TCP port to which output email messages |
| 1037 | ** are sent when email-send-method is "relay". There should be an |
| 1038 | ** SMTP server configured as a Mail Submission Agent listening on the |
| 1039 |
| --- src/alerts.c | |
| +++ src/alerts.c | |
| @@ -278,10 +278,18 @@ | |
| 278 | @ the "From:" address of the email notification. |
| 279 | @ The system administrator should arrange for emails sent to this address |
| 280 | @ to be handed off to the "fossil email incoming" command so that Fossil |
| 281 | @ can handle bounces. (Property: "email-self")</p> |
| 282 | @ <hr> |
| 283 | |
| 284 | entry_attribute("List-ID", 40, "email-listid", |
| 285 | "elistid", "", 0); |
| 286 | @ <p> |
| 287 | @ If this is not an empty string, then it becomes the argument to |
| 288 | @ a "List-ID:" header on all out-bound notification emails. |
| 289 | @ (Property: "email-listid")</p> |
| 290 | @ <hr> |
| 291 | |
| 292 | entry_attribute("Repository Nickname", 16, "email-subname", |
| 293 | "enn", "", 0); |
| 294 | @ <p><b>Required.</b> |
| 295 | @ This is short name used to identifies the repository in the |
| @@ -409,10 +417,11 @@ | |
| 417 | const char *zDest; /* How to send email. */ |
| 418 | const char *zDb; /* Name of database file */ |
| 419 | const char *zDir; /* Directory in which to store as email files */ |
| 420 | const char *zCmd; /* Command to run for each email */ |
| 421 | const char *zFrom; /* Emails come from here */ |
| 422 | const char *zListId; /* Argument to List-ID header */ |
| 423 | SmtpSession *pSmtp; /* SMTP relay connection */ |
| 424 | Blob out; /* For zDest=="blob" */ |
| 425 | char *zErr; /* Error message */ |
| 426 | u32 mFlags; /* Flags */ |
| 427 | int bImmediateFail; /* On any error, call fossil_fatal() */ |
| @@ -434,10 +443,11 @@ | |
| 443 | sqlite3_close(p->db); |
| 444 | p->db = 0; |
| 445 | p->zDb = 0; |
| 446 | p->zDir = 0; |
| 447 | p->zCmd = 0; |
| 448 | p->zListId = 0; |
| 449 | if( p->pSmtp ){ |
| 450 | smtp_client_quit(p->pSmtp); |
| 451 | smtp_session_free(p->pSmtp); |
| 452 | p->pSmtp = 0; |
| 453 | } |
| @@ -514,10 +524,11 @@ | |
| 524 | }else{ |
| 525 | p->zDest = db_get("email-send-method",0); |
| 526 | } |
| 527 | if( fossil_strcmp(p->zDest,"off")==0 ) return p; |
| 528 | if( emailerGetSetting(p, &p->zFrom, "email-self") ) return p; |
| 529 | p->zListId = db_get("email-listid", 0); |
| 530 | if( fossil_strcmp(p->zDest,"db")==0 ){ |
| 531 | char *zErr; |
| 532 | int rc; |
| 533 | if( emailerGetSetting(p, &p->zDb, "email-send-db") ) return p; |
| 534 | rc = sqlite3_open(p->zDb, &p->db); |
| @@ -881,10 +892,13 @@ | |
| 892 | blob_appendf(pOut, "Sender: <%s>\r\n", p->zFrom); |
| 893 | }else{ |
| 894 | blob_appendf(pOut, "From: <%s>\r\n", p->zFrom); |
| 895 | } |
| 896 | blob_appendf(pOut, "Date: %z\r\n", cgi_rfc822_datestamp(time(0))); |
| 897 | if( p->zListId && p->zListId[0] ){ |
| 898 | blob_appendf(pOut, "List-Id: %s\r\n", p->zListId); |
| 899 | } |
| 900 | if( strstr(blob_str(pHdr), "\r\nMessage-Id:")==0 ){ |
| 901 | /* Message-id format: "<$(date)x$(random)@$(from-host)>" where $(date) is |
| 902 | ** the current unix-time in hex, $(random) is a 64-bit random number, |
| 903 | ** and $(from) is the domain part of the email-self setting. */ |
| 904 | sqlite3_randomness(sizeof(r1), &r1); |
| @@ -1029,10 +1043,15 @@ | |
| 1043 | /* |
| 1044 | ** SETTING: email-self width=40 |
| 1045 | ** This is the email address for the repository. Outbound emails add |
| 1046 | ** this email address as the "From:" field. |
| 1047 | */ |
| 1048 | /* |
| 1049 | ** SETTING: email-listid width=40 |
| 1050 | ** If this setting is not an empty string, then it becomes the argument to |
| 1051 | ** a "List-ID:" header that is added to all out-bound notification emails. |
| 1052 | */ |
| 1053 | /* |
| 1054 | ** SETTING: email-send-relayhost width=40 sensitive |
| 1055 | ** This is the hostname and TCP port to which output email messages |
| 1056 | ** are sent when email-send-method is "relay". There should be an |
| 1057 | ** SMTP server configured as a Mail Submission Agent listening on the |
| 1058 |