comparison src/post.c @ 185:fed1334d766b noffle

[svn] * src/client.c: Change variable only used on constant to 'const'. * src/filter.c: Add a couple of 'return's after ASSERT() to remove compiler warnings about functions needing returns. * NEWS,TODO,configure,configure.in,noffle.conf.example,docs/NOTES, docs/noffle.conf.5,src/client.c,src/configfile.c,src/content.c, src/control.c,src/database.c,src/fetch.c,src/fetchlist.c,src/filter.c, src/group.c,src/lock.c,src/log.c,src/log.h,src/noffle.c,src/outgoing.c, src/post.c,src/protocol.c,src/request.c,src/server.c,src/util.c: Debug logging is always compiled and selected via noffle.conf. All debug logs are classified as all, none, config, control, expire, fetch, filter, newsbase, noffle, post, protocol, requests and server.
author bears
date Sun, 05 Aug 2001 09:24:22 +0100
parents f973675760dc
children 28488e0e3630
comparison
equal deleted inserted replaced
184:9854ea5f295f 185:fed1334d766b
1 /* 1 /*
2 post.c 2 post.c
3 3
4 $Id: post.c 278 2001-05-09 11:15:31Z bears $ 4 $Id: post.c 300 2001-08-05 08:24:22Z 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
74 74
75 msgId = article.over.msgId; 75 msgId = article.over.msgId;
76 76
77 Cont_read( grp ); 77 Cont_read( grp );
78 Cont_app( over ); 78 Cont_app( over );
79 Log_dbg( "Added message '%s' to group '%s'.", msgId, grp ); 79 Log_dbg( LOG_DBG_POST, "Added message '%s' to group '%s'.", msgId, grp );
80 80
81 if ( !article.posted ) 81 if ( !article.posted )
82 { 82 {
83 Log_inf( "Added '%s' to database.", msgId ); 83 Log_inf( "Added '%s' to database.", msgId );
84 if ( ! Db_prepareEntry( over, Cont_grp(), Cont_last() ) 84 if ( ! Db_prepareEntry( over, Cont_grp(), Cont_last() )
90 { 90 {
91 Str t; 91 Str t;
92 const char *xref; 92 const char *xref;
93 93
94 xref = Db_xref( msgId ); 94 xref = Db_xref( msgId );
95 Log_dbg( "Adding '%s' to Xref of '%s'", grp, msgId ); 95 Log_dbg( LOG_DBG_POST, "Adding '%s' to Xref of '%s'", grp, msgId );
96 snprintf( t, MAXCHAR, "%s %s:%i", xref, grp, Ov_numb( over ) ); 96 snprintf( t, MAXCHAR, "%s %s:%i", xref, grp, Ov_numb( over ) );
97 Db_setXref( msgId, t ); 97 Db_setXref( msgId, t );
98 } 98 }
99 99
100 Cont_write(); 100 Cont_write();
250 /* Now sort header-related issues */ 250 /* Now sort header-related issues */
251 if ( article.over.from[ 0 ] == '\0' ) 251 if ( article.over.from[ 0 ] == '\0' )
252 { 252 {
253 if ( article.flags & POST_ADD_FROM ) 253 if ( article.flags & POST_ADD_FROM )
254 { 254 {
255 Log_dbg( "Adding From field to posted message." ); 255 Log_dbg( LOG_DBG_POST, "Adding From field to posted message." );
256 DynStr_app( s, "From: " ); 256 DynStr_app( s, "From: " );
257 if ( ! Prt_genFromHdr( article.over.from ) ) 257 if ( ! Prt_genFromHdr( article.over.from ) )
258 { 258 {
259 Log_err( "Can't generate From field" ); 259 Log_err( "Can't generate From field" );
260 return FALSE; 260 return FALSE;
290 290
291 /* Ensure Message ID is present and valid */ 291 /* Ensure Message ID is present and valid */
292 if ( Cfg_replaceMsgId() ) 292 if ( Cfg_replaceMsgId() )
293 { 293 {
294 Prt_genMsgId( article.over.msgId, article.over.from, "NOFFLE" ); 294 Prt_genMsgId( article.over.msgId, article.over.from, "NOFFLE" );
295 Log_dbg( "Replacing Message-ID with '%s'", article.over.msgId ); 295 Log_dbg( LOG_DBG_POST,
296 "Replacing Message-ID with '%s'",
297 article.over.msgId );
296 } 298 }
297 else if ( article.over.msgId[ 0 ] == '\0' ) 299 else if ( article.over.msgId[ 0 ] == '\0' )
298 { 300 {
299 Prt_genMsgId( article.over.msgId, article.over.from, "NOFFLE" ); 301 Prt_genMsgId( article.over.msgId, article.over.from, "NOFFLE" );
300 Log_inf( "Adding missing Message-ID '%s'", article.over.msgId ); 302 Log_inf( "Adding missing Message-ID '%s'", article.over.msgId );
305 /* Ensure Path header */ 307 /* Ensure Path header */
306 if ( ! pathFound ) 308 if ( ! pathFound )
307 { 309 {
308 Str path; 310 Str path;
309 311
310 Log_dbg( "Adding Path field to posted message." ); 312 Log_dbg( LOG_DBG_POST, "Adding Path field to posted message." );
311 DynStr_app( s, "Path: " ); 313 DynStr_app( s, "Path: " );
312 Utl_cpyStr( path, Cfg_pathHeader() ); 314 Utl_cpyStr( path, Cfg_pathHeader() );
313 if ( path[ 0 ] == '\0' ) 315 if ( path[ 0 ] == '\0' )
314 Prt_genPathHdr( path, article.over.from ); 316 Prt_genPathHdr( path, article.over.from );
315 DynStr_appLn( s, path ); 317 DynStr_appLn( s, path );
316 } 318 }
317 319
318 /* Ensure Reply-To header */ 320 /* Ensure Reply-To header */
319 if ( ! replyToFound ) 321 if ( ! replyToFound )
320 { 322 {
321 Log_dbg( "Adding Reply-To field to posted message." ); 323 Log_dbg( LOG_DBG_POST, "Adding Reply-To field to posted message." );
322 DynStr_app( s, "Reply-To: " ); 324 DynStr_app( s, "Reply-To: " );
323 DynStr_appLn( s, article.over.from ); 325 DynStr_appLn( s, article.over.from );
324 } 326 }
325 327
326 /* Ensure Organization header if required */ 328 /* Ensure Organization header if required */
329 Str org; 331 Str org;
330 332
331 Utl_cpyStr( org, Cfg_organization() ); 333 Utl_cpyStr( org, Cfg_organization() );
332 if ( org[ 0 ] != '\0' ) 334 if ( org[ 0 ] != '\0' )
333 { 335 {
334 Log_dbg( "Adding Organization field to posted message." ); 336 Log_dbg( LOG_DBG_POST,
337 "Adding Organization field to posted message." );
335 DynStr_app( s, "Organization: " ); 338 DynStr_app( s, "Organization: " );
336 DynStr_appLn( s, org ); 339 DynStr_appLn( s, org );
337 } 340 }
338 } 341 }
339 342
378 else 381 else
379 { 382 {
380 /* OK, try to add it. */ 383 /* OK, try to add it. */
381 Str sline; 384 Str sline;
382 385
383 Log_dbg( "Adding .signature to posted message." ); 386 Log_dbg( LOG_DBG_POST, "Adding .signature to posted message." );
384 387
385 DynStr_appLn( s, BEGIN_SIG ); 388 DynStr_appLn( s, BEGIN_SIG );
386 sigLines++; 389 sigLines++;
387 while ( Prt_getLn( sline, f, 0 ) ) 390 while ( Prt_getLn( sline, f, 0 ) )
388 { 391 {