Fossil SCM
Do not include the List-Id in announcement messages to non-subscribers. But do include the List-Id for renewal notices.
Commit
908612e3342cae52876e322f754be9a4fabc737ba0a3d9d8d4fe87115b458afc
Parent
7ebd9441cf2608f…
1 file changed
+31
-17
+31
-17
| --- src/alerts.c | ||
| +++ src/alerts.c | ||
| @@ -984,13 +984,10 @@ | ||
| 984 | 984 | blob_appendf(pOut, "Sender: <%s>\r\n", p->zFrom); |
| 985 | 985 | }else{ |
| 986 | 986 | blob_appendf(pOut, "From: <%s>\r\n", p->zFrom); |
| 987 | 987 | } |
| 988 | 988 | blob_appendf(pOut, "Date: %z\r\n", cgi_rfc822_datestamp(time(0))); |
| 989 | - if( p->zListId && p->zListId[0] ){ | |
| 990 | - blob_appendf(pOut, "List-Id: %s\r\n", p->zListId); | |
| 991 | - } | |
| 992 | 989 | if( strstr(blob_str(pHdr), "\r\nMessage-Id:")==0 ){ |
| 993 | 990 | /* Message-id format: "<$(date)x$(random)@$(from-host)>" where $(date) is |
| 994 | 991 | ** the current unix-time in hex, $(random) is a 64-bit random number, |
| 995 | 992 | ** and $(from) is the domain part of the email-self setting. */ |
| 996 | 993 | sqlite3_randomness(sizeof(r1), &r1); |
| @@ -3215,18 +3212,21 @@ | ||
| 3215 | 3212 | Blob fhdr, fbody; |
| 3216 | 3213 | blob_init(&fhdr, 0, 0); |
| 3217 | 3214 | blob_appendf(&fhdr, "To: <%s>\r\n", zEmail); |
| 3218 | 3215 | blob_append(&fhdr, blob_buffer(&p->hdr), blob_size(&p->hdr)); |
| 3219 | 3216 | blob_init(&fbody, blob_buffer(&p->txt), blob_size(&p->txt)); |
| 3220 | - blob_appendf(&fhdr, "List-Unsubscribe: <%s/oneclickunsub/%s>\r\n", | |
| 3221 | - zUrl, zCode); | |
| 3222 | - blob_appendf(&fhdr, | |
| 3223 | - "List-Unsubscribe-Post: List-Unsubscribe=One-Click\r\n"); | |
| 3224 | - blob_appendf(&fbody, "\n-- \nUnsubscribe: %s/unsubscribe/%s\n", | |
| 3225 | - zUrl, zCode); | |
| 3226 | - /* blob_appendf(&fbody, "Subscription settings: %s/alerts/%s\n", | |
| 3227 | - ** zUrl, zCode); */ | |
| 3217 | + if( pSender->zListId && pSender->zListId[0] ){ | |
| 3218 | + blob_appendf(&fhdr, "List-Id: %s\r\n", pSender->zListId); | |
| 3219 | + blob_appendf(&fhdr, "List-Unsubscribe: <%s/oneclickunsub/%s>\r\n", | |
| 3220 | + zUrl, zCode); | |
| 3221 | + blob_appendf(&fhdr, | |
| 3222 | + "List-Unsubscribe-Post: List-Unsubscribe=One-Click\r\n"); | |
| 3223 | + blob_appendf(&fbody, "\n-- \nUnsubscribe: %s/unsubscribe/%s\n", | |
| 3224 | + zUrl, zCode); | |
| 3225 | + /* blob_appendf(&fbody, "Subscription settings: %s/alerts/%s\n", | |
| 3226 | + ** zUrl, zCode); */ | |
| 3227 | + } | |
| 3228 | 3228 | alert_send(pSender,&fhdr,&fbody,p->zFromName); |
| 3229 | 3229 | nSent++; |
| 3230 | 3230 | blob_reset(&fhdr); |
| 3231 | 3231 | blob_reset(&fbody); |
| 3232 | 3232 | }else{ |
| @@ -3245,15 +3245,19 @@ | ||
| 3245 | 3245 | blob_append(&body, "\n", 1); |
| 3246 | 3246 | blob_append(&body, blob_buffer(&p->txt), blob_size(&p->txt)); |
| 3247 | 3247 | } |
| 3248 | 3248 | } |
| 3249 | 3249 | if( nHit==0 ) continue; |
| 3250 | - blob_appendf(&hdr, "List-Unsubscribe: <%s/oneclickunsub/%s>\r\n", | |
| 3251 | - zUrl, zCode); | |
| 3252 | - blob_appendf(&hdr, "List-Unsubscribe-Post: List-Unsubscribe=One-Click\r\n"); | |
| 3253 | - blob_appendf(&body,"\n-- \nSubscription info: %s/alerts/%s\n", | |
| 3254 | - zUrl, zCode); | |
| 3250 | + if( pSender->zListId && pSender->zListId[0] ){ | |
| 3251 | + blob_appendf(&hdr, "List-Id: %s\r\n", pSender->zListId); | |
| 3252 | + blob_appendf(&hdr, "List-Unsubscribe: <%s/oneclickunsub/%s>\r\n", | |
| 3253 | + zUrl, zCode); | |
| 3254 | + blob_appendf(&hdr, | |
| 3255 | + "List-Unsubscribe-Post: List-Unsubscribe=One-Click\r\n"); | |
| 3256 | + blob_appendf(&body,"\n-- \nSubscription info: %s/alerts/%s\n", | |
| 3257 | + zUrl, zCode); | |
| 3258 | + } | |
| 3255 | 3259 | alert_send(pSender,&hdr,&body,0); |
| 3256 | 3260 | nSent++; |
| 3257 | 3261 | blob_truncate(&hdr, 0); |
| 3258 | 3262 | blob_truncate(&body, 0); |
| 3259 | 3263 | } |
| @@ -3295,18 +3299,28 @@ | ||
| 3295 | 3299 | " AND length(sdigest)>0", |
| 3296 | 3300 | iNewWarn, iOldWarn |
| 3297 | 3301 | ); |
| 3298 | 3302 | while( db_step(&q)==SQLITE_ROW ){ |
| 3299 | 3303 | Blob hdr, body; |
| 3304 | + const char *zCode = db_column_text(&q,0); | |
| 3300 | 3305 | blob_init(&hdr, 0, 0); |
| 3301 | 3306 | blob_init(&body, 0, 0); |
| 3302 | 3307 | alert_renewal_msg(&hdr, &body, |
| 3303 | - db_column_text(&q,0), | |
| 3308 | + zCode, | |
| 3304 | 3309 | db_column_int(&q,1), |
| 3305 | 3310 | db_column_text(&q,2), |
| 3306 | 3311 | db_column_text(&q,3), |
| 3307 | 3312 | zRepoName, zUrl); |
| 3313 | + if( pSender->zListId && pSender->zListId[0] ){ | |
| 3314 | + blob_appendf(&hdr, "List-Id: %s\r\n", pSender->zListId); | |
| 3315 | + blob_appendf(&hdr, "List-Unsubscribe: <%s/oneclickunsub/%s>\r\n", | |
| 3316 | + zUrl, zCode); | |
| 3317 | + blob_appendf(&hdr, | |
| 3318 | + "List-Unsubscribe-Post: List-Unsubscribe=One-Click\r\n"); | |
| 3319 | + blob_appendf(&body, "\n-- \nUnsubscribe: %s/unsubscribe/%s\n", | |
| 3320 | + zUrl, zCode); | |
| 3321 | + } | |
| 3308 | 3322 | alert_send(pSender,&hdr,&body,0); |
| 3309 | 3323 | blob_reset(&hdr); |
| 3310 | 3324 | blob_reset(&body); |
| 3311 | 3325 | } |
| 3312 | 3326 | db_finalize(&q); |
| 3313 | 3327 |
| --- src/alerts.c | |
| +++ src/alerts.c | |
| @@ -984,13 +984,10 @@ | |
| 984 | blob_appendf(pOut, "Sender: <%s>\r\n", p->zFrom); |
| 985 | }else{ |
| 986 | blob_appendf(pOut, "From: <%s>\r\n", p->zFrom); |
| 987 | } |
| 988 | blob_appendf(pOut, "Date: %z\r\n", cgi_rfc822_datestamp(time(0))); |
| 989 | if( p->zListId && p->zListId[0] ){ |
| 990 | blob_appendf(pOut, "List-Id: %s\r\n", p->zListId); |
| 991 | } |
| 992 | if( strstr(blob_str(pHdr), "\r\nMessage-Id:")==0 ){ |
| 993 | /* Message-id format: "<$(date)x$(random)@$(from-host)>" where $(date) is |
| 994 | ** the current unix-time in hex, $(random) is a 64-bit random number, |
| 995 | ** and $(from) is the domain part of the email-self setting. */ |
| 996 | sqlite3_randomness(sizeof(r1), &r1); |
| @@ -3215,18 +3212,21 @@ | |
| 3215 | Blob fhdr, fbody; |
| 3216 | blob_init(&fhdr, 0, 0); |
| 3217 | blob_appendf(&fhdr, "To: <%s>\r\n", zEmail); |
| 3218 | blob_append(&fhdr, blob_buffer(&p->hdr), blob_size(&p->hdr)); |
| 3219 | blob_init(&fbody, blob_buffer(&p->txt), blob_size(&p->txt)); |
| 3220 | blob_appendf(&fhdr, "List-Unsubscribe: <%s/oneclickunsub/%s>\r\n", |
| 3221 | zUrl, zCode); |
| 3222 | blob_appendf(&fhdr, |
| 3223 | "List-Unsubscribe-Post: List-Unsubscribe=One-Click\r\n"); |
| 3224 | blob_appendf(&fbody, "\n-- \nUnsubscribe: %s/unsubscribe/%s\n", |
| 3225 | zUrl, zCode); |
| 3226 | /* blob_appendf(&fbody, "Subscription settings: %s/alerts/%s\n", |
| 3227 | ** zUrl, zCode); */ |
| 3228 | alert_send(pSender,&fhdr,&fbody,p->zFromName); |
| 3229 | nSent++; |
| 3230 | blob_reset(&fhdr); |
| 3231 | blob_reset(&fbody); |
| 3232 | }else{ |
| @@ -3245,15 +3245,19 @@ | |
| 3245 | blob_append(&body, "\n", 1); |
| 3246 | blob_append(&body, blob_buffer(&p->txt), blob_size(&p->txt)); |
| 3247 | } |
| 3248 | } |
| 3249 | if( nHit==0 ) continue; |
| 3250 | blob_appendf(&hdr, "List-Unsubscribe: <%s/oneclickunsub/%s>\r\n", |
| 3251 | zUrl, zCode); |
| 3252 | blob_appendf(&hdr, "List-Unsubscribe-Post: List-Unsubscribe=One-Click\r\n"); |
| 3253 | blob_appendf(&body,"\n-- \nSubscription info: %s/alerts/%s\n", |
| 3254 | zUrl, zCode); |
| 3255 | alert_send(pSender,&hdr,&body,0); |
| 3256 | nSent++; |
| 3257 | blob_truncate(&hdr, 0); |
| 3258 | blob_truncate(&body, 0); |
| 3259 | } |
| @@ -3295,18 +3299,28 @@ | |
| 3295 | " AND length(sdigest)>0", |
| 3296 | iNewWarn, iOldWarn |
| 3297 | ); |
| 3298 | while( db_step(&q)==SQLITE_ROW ){ |
| 3299 | Blob hdr, body; |
| 3300 | blob_init(&hdr, 0, 0); |
| 3301 | blob_init(&body, 0, 0); |
| 3302 | alert_renewal_msg(&hdr, &body, |
| 3303 | db_column_text(&q,0), |
| 3304 | db_column_int(&q,1), |
| 3305 | db_column_text(&q,2), |
| 3306 | db_column_text(&q,3), |
| 3307 | zRepoName, zUrl); |
| 3308 | alert_send(pSender,&hdr,&body,0); |
| 3309 | blob_reset(&hdr); |
| 3310 | blob_reset(&body); |
| 3311 | } |
| 3312 | db_finalize(&q); |
| 3313 |
| --- src/alerts.c | |
| +++ src/alerts.c | |
| @@ -984,13 +984,10 @@ | |
| 984 | blob_appendf(pOut, "Sender: <%s>\r\n", p->zFrom); |
| 985 | }else{ |
| 986 | blob_appendf(pOut, "From: <%s>\r\n", p->zFrom); |
| 987 | } |
| 988 | blob_appendf(pOut, "Date: %z\r\n", cgi_rfc822_datestamp(time(0))); |
| 989 | if( strstr(blob_str(pHdr), "\r\nMessage-Id:")==0 ){ |
| 990 | /* Message-id format: "<$(date)x$(random)@$(from-host)>" where $(date) is |
| 991 | ** the current unix-time in hex, $(random) is a 64-bit random number, |
| 992 | ** and $(from) is the domain part of the email-self setting. */ |
| 993 | sqlite3_randomness(sizeof(r1), &r1); |
| @@ -3215,18 +3212,21 @@ | |
| 3212 | Blob fhdr, fbody; |
| 3213 | blob_init(&fhdr, 0, 0); |
| 3214 | blob_appendf(&fhdr, "To: <%s>\r\n", zEmail); |
| 3215 | blob_append(&fhdr, blob_buffer(&p->hdr), blob_size(&p->hdr)); |
| 3216 | blob_init(&fbody, blob_buffer(&p->txt), blob_size(&p->txt)); |
| 3217 | if( pSender->zListId && pSender->zListId[0] ){ |
| 3218 | blob_appendf(&fhdr, "List-Id: %s\r\n", pSender->zListId); |
| 3219 | blob_appendf(&fhdr, "List-Unsubscribe: <%s/oneclickunsub/%s>\r\n", |
| 3220 | zUrl, zCode); |
| 3221 | blob_appendf(&fhdr, |
| 3222 | "List-Unsubscribe-Post: List-Unsubscribe=One-Click\r\n"); |
| 3223 | blob_appendf(&fbody, "\n-- \nUnsubscribe: %s/unsubscribe/%s\n", |
| 3224 | zUrl, zCode); |
| 3225 | /* blob_appendf(&fbody, "Subscription settings: %s/alerts/%s\n", |
| 3226 | ** zUrl, zCode); */ |
| 3227 | } |
| 3228 | alert_send(pSender,&fhdr,&fbody,p->zFromName); |
| 3229 | nSent++; |
| 3230 | blob_reset(&fhdr); |
| 3231 | blob_reset(&fbody); |
| 3232 | }else{ |
| @@ -3245,15 +3245,19 @@ | |
| 3245 | blob_append(&body, "\n", 1); |
| 3246 | blob_append(&body, blob_buffer(&p->txt), blob_size(&p->txt)); |
| 3247 | } |
| 3248 | } |
| 3249 | if( nHit==0 ) continue; |
| 3250 | if( pSender->zListId && pSender->zListId[0] ){ |
| 3251 | blob_appendf(&hdr, "List-Id: %s\r\n", pSender->zListId); |
| 3252 | blob_appendf(&hdr, "List-Unsubscribe: <%s/oneclickunsub/%s>\r\n", |
| 3253 | zUrl, zCode); |
| 3254 | blob_appendf(&hdr, |
| 3255 | "List-Unsubscribe-Post: List-Unsubscribe=One-Click\r\n"); |
| 3256 | blob_appendf(&body,"\n-- \nSubscription info: %s/alerts/%s\n", |
| 3257 | zUrl, zCode); |
| 3258 | } |
| 3259 | alert_send(pSender,&hdr,&body,0); |
| 3260 | nSent++; |
| 3261 | blob_truncate(&hdr, 0); |
| 3262 | blob_truncate(&body, 0); |
| 3263 | } |
| @@ -3295,18 +3299,28 @@ | |
| 3299 | " AND length(sdigest)>0", |
| 3300 | iNewWarn, iOldWarn |
| 3301 | ); |
| 3302 | while( db_step(&q)==SQLITE_ROW ){ |
| 3303 | Blob hdr, body; |
| 3304 | const char *zCode = db_column_text(&q,0); |
| 3305 | blob_init(&hdr, 0, 0); |
| 3306 | blob_init(&body, 0, 0); |
| 3307 | alert_renewal_msg(&hdr, &body, |
| 3308 | zCode, |
| 3309 | db_column_int(&q,1), |
| 3310 | db_column_text(&q,2), |
| 3311 | db_column_text(&q,3), |
| 3312 | zRepoName, zUrl); |
| 3313 | if( pSender->zListId && pSender->zListId[0] ){ |
| 3314 | blob_appendf(&hdr, "List-Id: %s\r\n", pSender->zListId); |
| 3315 | blob_appendf(&hdr, "List-Unsubscribe: <%s/oneclickunsub/%s>\r\n", |
| 3316 | zUrl, zCode); |
| 3317 | blob_appendf(&hdr, |
| 3318 | "List-Unsubscribe-Post: List-Unsubscribe=One-Click\r\n"); |
| 3319 | blob_appendf(&body, "\n-- \nUnsubscribe: %s/unsubscribe/%s\n", |
| 3320 | zUrl, zCode); |
| 3321 | } |
| 3322 | alert_send(pSender,&hdr,&body,0); |
| 3323 | blob_reset(&hdr); |
| 3324 | blob_reset(&body); |
| 3325 | } |
| 3326 | db_finalize(&q); |
| 3327 |