diff src/server.c @ 269:b3a2f710fe2c noffle

[svn] * src/server.c: Fix post 1.0 bug where the article cursor was lost if the server yielded the lock to another server.
author bears
date Fri, 25 Oct 2002 12:04:57 +0100
parents 94b7962a0fbe
children 3477050e8d10
line wrap: on
line diff
--- a/src/server.c	Tue Oct 08 14:52:52 2002 +0100
+++ b/src/server.c	Fri Oct 25 12:04:57 2002 +0100
@@ -1,7 +1,7 @@
 /*
   server.c
 
-  $Id: server.c 396 2002-08-05 22:05:02Z bears $
+  $Id: server.c 401 2002-10-25 11:04:57Z bears $
 */
 
 #if HAVE_CONFIG_H
@@ -314,13 +314,32 @@
 }
 
 static void
-changeToGrp( const char *grp )
+loadGrpInfo( const char *grp )
 {
     checkNewArts( grp );
     Utl_cpyStr( server.grp, grp );
     readCont( grp );
+
+    /*
+     * This routine is used to change back to a group after releasing
+     * the lock. We need to preserve the group cursor if at all possible.
+     * So, if the article pointer points to an article before or after
+     * the current range, adjust it to the first/last article. Otherwise
+     * leave it well alone.
+     */
+    if ( server.artPtr < Cont_first() )
+	server.artPtr = Cont_first();
+    else if ( server.artPtr > Cont_last() )
+	server.artPtr = Cont_last();
+    
+    server.groupReady = TRUE;
+}
+
+static void
+changeToGrp( const char *grp )
+{
+    loadGrpInfo( grp );
     server.artPtr = Cont_first();
-    server.groupReady = TRUE;
 }
 
 static Bool
@@ -370,7 +389,7 @@
     if ( ! server.groupReady )
     {
     	Utl_cpyStr( group, server.grp );
-    	changeToGrp( group );
+    	loadGrpInfo( group );
     }
     return TRUE;
 }