diff 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
line wrap: on
line diff
--- a/src/post.c	Sun Apr 16 07:20:58 2006 +0100
+++ b/src/post.c	Wed Jul 12 20:26:41 2006 +0100
@@ -1,7 +1,7 @@
 /*
   post.c
 
-  $Id: post.c 517 2003-04-03 17:21:24Z bears $
+  $Id: post.c 645 2006-07-12 19:26:41Z bears $
 */
 
 #if HAVE_CONFIG_H
@@ -182,6 +182,10 @@
     Bool continuation;
     time_t t;
     int sigLines;
+    Bool addMsgIdIfMissing;
+    Bool processMsgId = TRUE;
+
+    addMsgIdIfMissing = Cfg_addMsgIdIfMissing();
 
     s = new_DynStr( 10000 );
     article.text = s;
@@ -356,6 +360,9 @@
     {
 	Prt_genMsgId( article.over.msgId, article.over.from, "NOFFLE" );
 	Log_inf( "Adding missing Message-ID '%s'", article.over.msgId );
+
+        if ( ! addMsgIdIfMissing )
+            processMsgId = FALSE;
     }
     else if ( ! Prt_isValidMsgId( article.over.msgId ) || Cfg_replaceMsgId() )
     {
@@ -364,8 +371,14 @@
 		 "Replacing Message-ID with '%s'",
 		 article.over.msgId );
     }
-    DynStr_app( s, "Message-ID: " );
-    DynStr_appLn( s, article.over.msgId );
+
+    if ( processMsgId )
+    {
+        DynStr_app( s, "Message-ID: " );
+        DynStr_appLn( s, article.over.msgId );
+    }
+    else
+        Log_inf( "Not storing Message-ID '%s' in message.", article.over.msgId );
 
     /* Ensure Path header */
     if ( ! pathFound )