changeset 102:38b0a1532a37 noffle

[svn] Only track remote message no when subscribed
author bears
date Mon, 05 Jun 2000 09:57:05 +0100
parents ce8191c38f44
children f782184db8bc
files ChangeLog src/client.c src/fetch.c src/group.c src/group.h src/noffle.c
diffstat 6 files changed, 40 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Mon May 29 17:35:01 2000 +0100
+++ b/ChangeLog	Mon Jun 05 09:57:05 2000 +0100
@@ -2,6 +2,16 @@
 NOFFLE ChangeLog
 -------------------------------------------------------------------------------
 
+Mon Jun  5 09:46:30 BST 2000 Jim Hague <jim.hague@acm.org>
+
+ * src/client.c, src/fetch.c, src/group.c, src/group.h, src/noffle.c:
+  Don't track remote message number read unless subscribed to a group.
+  This stops 'Missing articles' pseudos being generated when you join
+  a group some time after doing the 'noffle --query groups' that first
+  found the group, or if you resubscribe a while after unsubscribing.
+  They will still be generated if articles are missed when a group is
+  subscribed, in which case the pseudo message is entirely applicable.
+	
 Mon May 29 18:28:25 CEST 2000 Uwe Hermann <uh1763@bingo-ev.de>
 
  * configure, configure.in: Changed the --enable-debug option of configure.
--- a/src/client.c	Mon May 29 17:35:01 2000 +0100
+++ b/src/client.c	Mon Jun 05 09:57:05 2000 +0100
@@ -1,7 +1,7 @@
 /*
   client.c
 
-  $Id: client.c 114 2000-05-19 15:16:50Z bears $
+  $Id: client.c 135 2000-06-05 08:57:05Z bears $
 */
 
 #if HAVE_CONFIG_H
@@ -454,7 +454,6 @@
                 Grp_setFirstLast( grp, first, first - 1 );
             else
                 Grp_setFirstLast( grp, 1, 0 );
-            Grp_setRmtNext( grp, first );
             Grp_setServ( grp, client.serv );
 	    Grp_setPostAllow( grp, postAllow );
         }
@@ -978,10 +977,20 @@
         err = ! Db_storeArt( msgId, txt );
 	if ( ! err )
 	{
-	    Str supersedeId;
+	    Str supersedeIds;
+
+	    if ( Prt_searchHeader( txt, "Supersedes", supersedeIds ) )
+	    {
+		ItemList *ids;
+		const char *msgId;
 
-	    if ( Prt_searchHeader( txt, "Supersedes", supersedeId ) )
-		 Ctrl_cancel( supersedeId );
+		ids = new_Itl( supersedeIds, " \n\t" );
+		for ( msgId = Itl_first( ids );
+		      msgId != NULL;
+		      msgId = Itl_next( ids ) )
+		    Ctrl_cancel( msgId );
+		del_Itl( ids );
+	    }
 	}
     }
     else
--- a/src/fetch.c	Mon May 29 17:35:01 2000 +0100
+++ b/src/fetch.c	Mon Jun 05 09:57:05 2000 +0100
@@ -1,7 +1,7 @@
 /*
   fetch.c
 
-  $Id: fetch.c 85 2000-05-14 07:12:23Z enz $
+  $Id: fetch.c 135 2000-06-05 08:57:05Z bears $
 */
 
 #if HAVE_CONFIG_H
@@ -77,7 +77,7 @@
 void
 Fetch_getNewArts( const char *name, FetchMode mode )
 {
-    int next, first, last, oldLast;
+    int next, first, last;
 
     if ( ! Client_changeToGrp( name ) )
     {
@@ -87,7 +87,8 @@
     Cont_read( name );
     Client_rmtFirstLast( &first, &last );
     next = Grp_rmtNext( name );
-    oldLast = Cont_last();
+    if ( next == GRP_RMT_NEXT_NOT_SUBSCRIBED )
+	next = first;
     if ( next == last + 1 )
     {
         Log_inf( "No new articles in %s", name );
--- a/src/group.c	Mon May 29 17:35:01 2000 +0100
+++ b/src/group.c	Mon Jun 05 09:57:05 2000 +0100
@@ -7,7 +7,7 @@
   loadGrp() and saveGrp(). This is done transparently. Access to the groups
   database is done by group name, by the functions defined in group.h.        
 
-  $Id: group.c 67 2000-05-12 17:19:38Z enz $
+  $Id: group.c 135 2000-06-05 08:57:05Z bears $
 */
 
 #if HAVE_CONFIG_H
@@ -177,7 +177,7 @@
     grp.dsc[ 0 ] = '\0';
     grp.entry.first = 1;
     grp.entry.last = 0;
-    grp.entry.rmtNext = 0;
+    grp.entry.rmtNext = GRP_RMT_NEXT_NOT_SUBSCRIBED;
     grp.entry.created = 0;
     grp.entry.lastAccess = 0;
     grp.postAllow = 'y';
--- a/src/group.h	Mon May 29 17:35:01 2000 +0100
+++ b/src/group.h	Mon Jun 05 09:57:05 2000 +0100
@@ -3,7 +3,7 @@
 
   Groups database
 
-  $Id: group.h 67 2000-05-12 17:19:38Z enz $
+  $Id: group.h 135 2000-06-05 08:57:05Z bears $
 */
 
 #ifndef GRP_H
@@ -26,7 +26,8 @@
 
 #include "common.h"
 
-#define GRP_LOCAL_SERVER_NAME "(local)"
+#define GRP_LOCAL_SERVER_NAME		"(local)"
+#define	GRP_RMT_NEXT_NOT_SUBSCRIBED	(-1)
 
 /* open group database */
 Bool
--- a/src/noffle.c	Mon May 29 17:35:01 2000 +0100
+++ b/src/noffle.c	Mon Jun 05 09:57:05 2000 +0100
@@ -10,7 +10,7 @@
   received for some seconds (to allow multiple clients connect at the same
   time).
 
-  $Id: noffle.c 119 2000-05-20 14:11:21Z enz $
+  $Id: noffle.c 135 2000-06-05 08:57:05Z bears $
 */
 
 #if HAVE_CONFIG_H
@@ -46,6 +46,8 @@
 #include "lock.h"
 #include "portable.h"
 
+static void
+doUnsubscribe( const char *name );
 
 struct Noffle
 {
@@ -266,9 +268,7 @@
                          "days without access",
                          grp, autoUnsubscribeDays );
                 Pseudo_autoUnsubscribed( grp, autoUnsubscribeDays );
-                Fetchlist_read();
-                Fetchlist_remove( grp );
-                Fetchlist_write();
+		doUnsubscribe( grp );
             }
             Cont_write();
             Grp_setFirstLast( grp, Cont_first(), Cont_last() );
@@ -502,7 +502,9 @@
         printf( "%s is not in fetch list.\n", name );
     else
         printf( "%s removed from fetch list.\n", name );
-    if ( ! Fetchlist_write() )
+    if ( Fetchlist_write() )
+	Grp_setRmtNext( name, GRP_RMT_NEXT_NOT_SUBSCRIBED );
+    else
         fprintf( stderr, "Could not save fetchlist.\n" );
 }