# HG changeset patch
# User bears
# Date 989510866 -3600
# Node ID a43a528cfbe774ddb099b8b7dd61c8bf777f36e9
# Parent  e196de757ecd4462006c6a0931f2ab7397825e92
[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.

diff -r e196de757ecd -r a43a528cfbe7 ChangeLog
--- 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
diff -r e196de757ecd -r a43a528cfbe7 src/client.c
--- 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();