[PATCH] tin 1.9.x entered wrong group on startup
Urs Janßen <[email protected]> Wed, 09 Dec 2009 21:08:52 +0100
| Newsgroups | gmane.network.tin.devel |
|---|---|
| Organization | tin.org |
| Message-ID | <[email protected]> |
if there are new groups on the server and a cmd.-line group was given
tin entered the first new group instead of the cmd.-line group on
startup. the following patch should fix this.
=== modified file 'include/proto.h'
--- include/proto.h 2009-12-01 15:16:55 +0000
+++ include/proto.h 2009-12-09 19:54:02 +0000
@@ -54,6 +54,7 @@
/* active.c */
extern char group_flag(char ch);
extern int find_newnews_index(const char *cur_newnews_host);
+extern int read_news_active_file(void);
extern t_bool match_group_list(const char *group, const char *group_list);
extern t_bool parse_active_line(char *line, long *max, long *min, char *moderated);
extern t_bool process_bogus(char *name);
@@ -61,7 +62,6 @@
extern t_bool resync_active_file(void);
extern void create_save_active_file(void);
extern void load_newnews_info(char *info);
-extern void read_news_active_file(void);
/* art.c */
extern int global_get_multipart_info(int aindex, MultiPartInfo *setme);
=== modified file 'src/active.c'
--- src/active.c 2009-12-01 15:16:55 +0000
+++ src/active.c 2009-12-09 19:58:36 +0000
@@ -65,9 +65,9 @@
*/
static FILE *open_newgroups_fp(int idx);
static FILE *open_news_active_fp(void);
+static int check_for_any_new_groups(void);
static void active_add(struct t_group *ptr, long count, long max, long min, const char *moderated);
static void append_group_line(char *active_file, char *group_path, long art_max, long art_min, char *base_dir);
-static void check_for_any_new_groups(void);
static void make_group_list(char *active_file, char *base_dir, char *fixed_base, char *group_path);
static void read_active_file(void);
static void read_newsrc_active_file(void);
@@ -709,11 +709,12 @@
* Load the active file into active[]
* Check and preload any new newgroups into my_group[]
*/
-void
+int
read_news_active_file(
void)
{
FILE *fp;
+ int newgrps = 0;
t_bool do_group_cmds = !nntp_caps.list_counts;
/*
@@ -867,12 +868,14 @@
* check_for_any_new_groups() also does $AUTOSUBSCRIBE
*/
if (check_for_new_newsgroups)
- check_for_any_new_groups();
+ newgrps = check_for_any_new_groups();
/*
* finally we have a list of all groups an can set the attributes
*/
assign_attributes_to_groups();
+
+ return newgrps;
}
@@ -920,7 +923,7 @@
* If reading news via NNTP issue a NEWGROUPS command.
* Format: (as active file) Groupname Maxart Minart moderated
*/
-static void
+static int
check_for_any_new_groups(
void)
{
@@ -929,6 +932,7 @@
char *ptr, *line, buf[NNTP_STRLEN];
char old_newnews_host[PATH_LEN];
int newnews_index;
+ int newgrps = 0;
time_t old_newnews_time;
time_t new_newnews_time;
@@ -973,11 +977,12 @@
*ptr = '\0';
}
subscribe_new_group(line, autosubscribe, autounsubscribe);
+ newgrps++;
}
TIN_FCLOSE(fp);
if (tin_errno)
- return; /* Don't update the time if we quit */
+ return 0; /* Don't update the time if we quit */
}
/*
@@ -994,6 +999,8 @@
if (!batch_mode)
my_fputc('\n', stdout);
+
+ return newgrps;
}
=== modified file 'src/main.c'
--- src/main.c 2009-12-01 15:16:55 +0000
+++ src/main.c 2009-12-09 19:58:11 +0000
@@ -266,7 +266,7 @@
no_write = tmp_no_write;
read_attributes_file(TRUE);
read_attributes_file(FALSE);
- read_news_active_file();
+ start_groupnum = read_news_active_file();
#ifdef DEBUG
debug_print_active();
#endif /* DEBUG */