changeset 182:a43a528cfbe7 noffle

[svn] * src/client.c: Only return failure getting NEWGROUPS if the connection failed. If the server doesn't implement NEWGROUPS correctly (step forward elderly versions of NNTPcache) it isn't fatal to the fetch process. You can still do a 'noffle --query groups' to update your newsgroup list.
author bears
date Thu, 10 May 2001 17:07:46 +0100
parents e196de757ecd
children c912e8288164
files ChangeLog src/client.c
diffstat 2 files changed, 20 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Thu May 10 17:00:12 2001 +0100
+++ b/ChangeLog	Thu May 10 17:07:46 2001 +0100
@@ -1,5 +1,10 @@
 Thu May 10 2001 Jim Hageu <jim.hague@acm.org>
 
+ * src/client.c: Only return failure getting NEWGROUPS if the connection
+   failed. If the server doesn't implement NEWGROUPS correctly (step
+   forward elderly versions of NNTPcache) it isn't fatal to the
+   fetch process. You can still do a 'noffle --query groups' to update
+   your newsgroup list.
  * src/server.c: Correct error code given when article requested by
    message ID is not found. Previously the code given (423) was the same
    as for when an article requested by its number in a group was not
--- a/src/client.c	Thu May 10 17:00:12 2001 +0100
+++ b/src/client.c	Thu May 10 17:07:46 2001 +0100
@@ -1,7 +1,7 @@
 /*
   client.c
 
-  $Id: client.c 279 2001-05-09 11:33:43Z bears $
+  $Id: client.c 286 2001-05-10 16:07:46Z bears $
 */
 
 #if HAVE_CONFIG_H
@@ -689,6 +689,7 @@
     Str s;
     const char *p;
     DynStr *response;
+    int stat;
 
     ASSERT( *lastTime > 0 );
     strftime( s, MAXCHAR, "%Y%m%d %H%M00", gmtime( lastTime ) );
@@ -700,10 +701,21 @@
     p = s + 2;
     if ( ! putCmd( "NEWGROUPS %s GMT", p ) )
         return FALSE;
-    if ( getStat() != STAT_NEW_GRP_FOLLOW )
+    stat = getStat();
+    if ( stat != STAT_NEW_GRP_FOLLOW )
     {
         Log_err( "NEWGROUPS command failed: %s", client.lastStat );
-        return FALSE;
+
+	/*
+	 * If NEWGROUPS fails, it isn't necessarily fatal. You can do
+	 * a periodic noffle --query groups to refresh your group list.
+	 * So only return failure here if the status indicates the link
+	 * itself failed.
+	 *
+	 * In particular, older versions of NNTPcache have a Y2K bug that
+	 * stops NEWGROUPS working.
+	 */
+        return ( stat != STAT_PROGRAM_FAULT );
     }
 
     response = collectTxt();