comparison src/post.c @ 494:372f8b55506e noffle

[svn] Apply patch from Jan De Luyck. Add new option 'add-messageid-if-missing', which optionally postpones adding a message ID to the upstream server. If this is done, post-locally must be off. This is to deal with an upstream server troubling Jan. It usually (but not always) rejects posts with a Noffle message ID. I have changed Jan's original option of 'add-message-id-if-missing' for consistency with 'replace-messageid' and added the manual page entry. See SourceForge feature request 1513395.
author bears
date Wed, 12 Jul 2006 20:26:41 +0100
parents 21300895412f
children
comparison
equal deleted inserted replaced
493:4d3a1597813a 494:372f8b55506e
1 /* 1 /*
2 post.c 2 post.c
3 3
4 $Id: post.c 517 2003-04-03 17:21:24Z bears $ 4 $Id: post.c 645 2006-07-12 19:26:41Z bears $
5 */ 5 */
6 6
7 #if HAVE_CONFIG_H 7 #if HAVE_CONFIG_H
8 #include <config.h> 8 #include <config.h>
9 #endif 9 #endif
180 Bool newsgroupsFound, pathFound; 180 Bool newsgroupsFound, pathFound;
181 Bool replyToFound, orgFound; 181 Bool replyToFound, orgFound;
182 Bool continuation; 182 Bool continuation;
183 time_t t; 183 time_t t;
184 int sigLines; 184 int sigLines;
185 Bool addMsgIdIfMissing;
186 Bool processMsgId = TRUE;
187
188 addMsgIdIfMissing = Cfg_addMsgIdIfMissing();
185 189
186 s = new_DynStr( 10000 ); 190 s = new_DynStr( 10000 );
187 article.text = s; 191 article.text = s;
188 192
189 /* RFC says only one of these headers. */ 193 /* RFC says only one of these headers. */
354 /* Ensure Message ID is present and valid */ 358 /* Ensure Message ID is present and valid */
355 if ( article.over.msgId[ 0 ] == '\0' ) 359 if ( article.over.msgId[ 0 ] == '\0' )
356 { 360 {
357 Prt_genMsgId( article.over.msgId, article.over.from, "NOFFLE" ); 361 Prt_genMsgId( article.over.msgId, article.over.from, "NOFFLE" );
358 Log_inf( "Adding missing Message-ID '%s'", article.over.msgId ); 362 Log_inf( "Adding missing Message-ID '%s'", article.over.msgId );
363
364 if ( ! addMsgIdIfMissing )
365 processMsgId = FALSE;
359 } 366 }
360 else if ( ! Prt_isValidMsgId( article.over.msgId ) || Cfg_replaceMsgId() ) 367 else if ( ! Prt_isValidMsgId( article.over.msgId ) || Cfg_replaceMsgId() )
361 { 368 {
362 Prt_genMsgId( article.over.msgId, article.over.from, "NOFFLE" ); 369 Prt_genMsgId( article.over.msgId, article.over.from, "NOFFLE" );
363 Log_dbg( LOG_DBG_POST, 370 Log_dbg( LOG_DBG_POST,
364 "Replacing Message-ID with '%s'", 371 "Replacing Message-ID with '%s'",
365 article.over.msgId ); 372 article.over.msgId );
366 } 373 }
367 DynStr_app( s, "Message-ID: " ); 374
368 DynStr_appLn( s, article.over.msgId ); 375 if ( processMsgId )
376 {
377 DynStr_app( s, "Message-ID: " );
378 DynStr_appLn( s, article.over.msgId );
379 }
380 else
381 Log_inf( "Not storing Message-ID '%s' in message.", article.over.msgId );
369 382
370 /* Ensure Path header */ 383 /* Ensure Path header */
371 if ( ! pathFound ) 384 if ( ! pathFound )
372 { 385 {
373 Str path; 386 Str path;