comparison src/client.c @ 386:278a03a392b1 noffle

[svn] * src/client.c: Return correct status from Client_postArt() and add function comment detailing what return code should be, because it's not obvious that the return code should report success when the posting failed for reasons other than connection problems. This should fix problem with failing posting stopping fetches. Thanks to Dan Jacobson for spotting this. * src/client.c: Fix problemette with filter discards not updating remote group article count and so the overview being refetched until and article appears that doesn't fall foul of the filter and thus does update the remove group 'next article' marker. Thanks to Dan Jacobson for spotting this.
author bears
date Thu, 22 May 2003 09:23:33 +0100
parents ff7a2dc6023e
children 44ffdb180788
comparison
equal deleted inserted replaced
385:e3756d005fa4 386:278a03a392b1
1 /* 1 /*
2 client.c 2 client.c
3 3
4 $Id: client.c 466 2003-02-26 11:30:41Z bears $ 4 $Id: client.c 528 2003-05-22 08:23:33Z 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
984 984
985 action = Flt_checkFilters( grp, p, ov, mode ); 985 action = Flt_checkFilters( grp, p, ov, mode );
986 if ( action == FILTER_DISCARD ) 986 if ( action == FILTER_DISCARD )
987 { 987 {
988 del_Over( ov ); 988 del_Over( ov );
989 continue;
990 } 989 }
991 Cont_app( ov ); /* Cont modules owns ov after this */ 990 else
992 prepareEntry( ov ); 991 {
993 if ( action == FILTER_FULL 992 Cont_app( ov ); /* Cont modules owns ov after this */
994 || ( action == FILTER_THREAD && needsMark( ref ) ) ) 993 prepareEntry( ov );
995 { 994 if ( action == FILTER_FULL
996 Req_add( client.serv, msgId ); 995 || ( action == FILTER_THREAD && needsMark( ref ) ) )
997 ++cntMarked; 996 {
998 } 997 Req_add( client.serv, msgId );
998 ++cntMarked;
999 }
1000 }
999 } 1001 }
1000 Grp_setRmtNext( client.grp, rmtNumb + 1 ); 1002 Grp_setRmtNext( client.grp, rmtNumb + 1 );
1001 } 1003 }
1002 if ( oldLast != Cont_last() ) 1004 if ( oldLast != Cont_last() )
1003 { 1005 {
1211 ASSERT( Lock_gotLock() ); 1213 ASSERT( Lock_gotLock() );
1212 *first = client.rmtFirst; 1214 *first = client.rmtFirst;
1213 *last = client.rmtLast; 1215 *last = client.rmtLast;
1214 } 1216 }
1215 1217
1218 /**
1219 * Post an article.
1220 *
1221 * Return status if there's a connection problem. Otherwise return
1222 * STAT_OK. If there's an error in posting, put the error into
1223 * errStr, and return STAT_OK. That is, the return value indicates if
1224 * a proper transaction happened, and errStr indicates if that
1225 * transaction contained a posting error.
1226 */
1216 int 1227 int
1217 Client_postArt( const char *msgId, const char *artTxt, Str errStr ) 1228 Client_postArt( const char *msgId, const char *artTxt, Str errStr )
1218 { 1229 {
1219 int stat; 1230 int stat;
1220 1231
1227 return stat; 1238 return stat;
1228 else if ( stat != STAT_SEND_ART ) 1239 else if ( stat != STAT_SEND_ART )
1229 { 1240 {
1230 Log_err( "Posting of %s not allowed: %s", msgId, client.lastStat ); 1241 Log_err( "Posting of %s not allowed: %s", msgId, client.lastStat );
1231 Utl_cpyStr( errStr, client.lastStat ); 1242 Utl_cpyStr( errStr, client.lastStat );
1232 return stat; 1243 return STAT_OK;
1233 } 1244 }
1234 putTxtBuf( artTxt ); 1245 putTxtBuf( artTxt );
1235 putEndOfTxt(); 1246 putEndOfTxt();
1236 stat = getStat(); 1247 stat = getStat();
1237 if ( IS_FATAL( stat ) ) 1248 if ( IS_FATAL( stat ) )
1238 return stat; 1249 return stat;
1239 else if ( stat != STAT_POST_OK ) 1250 else if ( stat != STAT_POST_OK )
1240 { 1251 {
1241 Log_err( "Posting of %s failed: %s", msgId, client.lastStat ); 1252 Log_err( "Posting of %s failed: %s", msgId, client.lastStat );
1242 Utl_cpyStr( errStr, client.lastStat ); 1253 Utl_cpyStr( errStr, client.lastStat );
1243 return stat; 1254 return STAT_OK;
1244 } 1255 }
1245 Log_inf( "Posted %s (Status: %s)", msgId, client.lastStat ); 1256 Log_inf( "Posted %s (Status: %s)", msgId, client.lastStat );
1246 return STAT_OK; 1257 return STAT_OK;
1247 } 1258 }