[patches] Re: unsubscribe_new_groups - change default?

Peter J Ross <[email protected]>
Newsgroups gmane.network.slrn.user
Message-ID <[email protected]>
On Monday 01 September 2008 13:33:50 Peter J Ross wrote:
> <http://slrn.org/docs/slrn-manual-6.html#unsubscribe_new_groups>
>
> Recent reports of slow startup seem to be a result of Highwinds-Media
> adding ~10,000 groups to their list. By default, slrn subscribes the user
> to all new groups unless the unsubscribe_new_groups configuration variable
> is set to 1.
>
> I suspect that the majority of users would prefer new groups to be
> unsubscribed by default, even when problems like this don't occur, so I'm
> asking for the default for this variable to be changed from 0 to 1.

Patch to do the above:

#v+
Index: src/group.c
===================================================================
--- src/group.c (revision 307)
+++ src/group.c (working copy)
@@ -88,7 +88,7 @@
 int Slrn_No_Backups = 0;
 int Slrn_No_Autosave = 0;

-int Slrn_Unsubscribe_New_Groups = 0;
+int Slrn_Unsubscribe_New_Groups = 1;
 int Slrn_Check_New_Groups = 1;
 int Slrn_Drop_Bogus_Groups = 1;
 int Slrn_Max_Queued_Groups = 20;
#v-

> Better still, perhaps the variable should be replaced
> by "subscribe_new_groups" with a default of 0.

Patch to do the above:

#v+
Index: src/slrn.c
===================================================================
--- src/slrn.c	(revision 307)
+++ src/slrn.c	(working copy)
@@ -1049,9 +1049,9 @@
    
 #if 0
    if (NULL != getenv ("AUTOSUBSCRIBE"))
-     Slrn_Unsubscribe_New_Groups = 0;
+     Slrn_Subscribe_New_Groups = 1;
    if (NULL != getenv ("AUTOUNSUBSCRIBE"))
-     Slrn_Unsubscribe_New_Groups = 1;
+     Slrn_Subscribe_New_Groups = 0;
 #endif
    
    for (i = 1; i < (unsigned int) argc; i++)
Index: src/startup.c
===================================================================
--- src/startup.c	(revision 307)
+++ src/startup.c	(working copy)
@@ -607,7 +607,8 @@
      {"no_backups", &Slrn_No_Backups, NULL},
      {"no_autosave", &Slrn_No_Autosave, NULL},
      {"beep", NULL, get_set_beep_callback},
-     {"unsubscribe_new_groups", &Slrn_Unsubscribe_New_Groups, NULL},
+     {"subscribe_new_groups", &Slrn_Subscribe_New_Groups, NULL},
+     {"unsubscribe_new_groups", NULL, NULL},
      {"check_new_groups", &Slrn_Check_New_Groups, NULL},
      {"show_thread_subject", &Slrn_Show_Thread_Subject, NULL},
      {"mouse", &Slrn_Use_Mouse, NULL},
Index: src/group.c
===================================================================
--- src/group.c	(revision 307)
+++ src/group.c	(working copy)
@@ -88,7 +88,7 @@
 int Slrn_No_Backups = 0;
 int Slrn_No_Autosave = 0;
 
-int Slrn_Unsubscribe_New_Groups = 0;
+int Slrn_Subscribe_New_Groups = 0;
 int Slrn_Check_New_Groups = 1;
 int Slrn_Drop_Bogus_Groups = 1;
 int Slrn_Max_Queued_Groups = 20;
@@ -675,7 +675,7 @@
 	unsigned int subscribe_flag;
 	Unsubscribed_Slrn_Group_Type *ug = Unsubscribed_Groups, *ugnext;
 	
-	if (Slrn_Unsubscribe_New_Groups)
+	if (Slrn_Subscribe_New_Groups == 0)
 	  subscribe_flag = GROUP_UNSUBSCRIBED | GROUP_NEW_GROUP_FLAG;
 	else subscribe_flag = GROUP_NEW_GROUP_FLAG;
 	
Index: src/group.h
===================================================================
--- src/group.h	(revision 307)
+++ src/group.h	(working copy)
@@ -89,7 +89,7 @@
 extern int *Slrn_Prefix_Arg_Ptr;
 extern int Slrn_No_Backups;
 extern int Slrn_No_Autosave;
-extern int Slrn_Unsubscribe_New_Groups;
+extern int Slrn_Subscribe_New_Groups;
 extern int Slrn_Check_New_Groups;
 extern int Slrn_List_Active_File;
 extern int Slrn_Query_Group_Cutoff;
#v-

If "unsubscribe_new_groups" is set in .slrnrc, the result of this patch is the 
following start-up message:

	In this version of slrn, setting variable unsubscribe_new_groups has no
	effect. Please refer to the manual for details.

I think this warning is preferable to writing code to check for conflicts 
between the two variables and/or process the old one if the new one is unset, 
but perhaps that's just because I'm too lazy to work out how to do it. If 
either of the changes is made, I'll update the documentation, of course.

Finally, if neither of these changes is acceptable, I suggest at least adding 
a mention of unsubscribe_new_groups to the specimen slrn.rc file. Patch:

#v+
Index: doc/slrn.rc
===================================================================
--- doc/slrn.rc (revision 307)
+++ doc/slrn.rc (working copy)
@@ -58,6 +58,10 @@
 % use this if your network connection is fast or the server has few groups.
 %set read_active 0

+% If non-zero, slrn does not subscribe automatically to newly available
+% newsgroups.
+%set unsubscribe_new_groups 0
+
 % The following variables are only meaningful when using spool mode:

 % Basic directory settings
#v-


-- 
PJR :-)

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.