keep article in dead.article(s) if server closed the connection and we can't reconnect

Urs Janßen <[email protected]> Sun, 26 Sep 2010 15:08:57 +0200
Newsgroups gmane.network.tin.devel
Message-ID <[email protected]>
=== modified file 'include/proto.h'
--- include/proto.h	2010-09-12 21:11:20 +0000
+++ include/proto.h	2010-09-26 11:59:32 +0000
@@ -473,6 +473,7 @@
 #endif /* !HAVE_VSNPRINTF */
 
 /* post.c */
+extern char *backup_article_name(const char *the_article);
 extern char *checknadd_headers(const char *infile, struct t_group *group);
 extern int count_postponed_articles(void);
 extern int mail_to_author(const char *group, int respnum, t_bool copy_text, t_bool with_headers, t_bool raw_data);

=== modified file 'src/nntplib.c'
--- src/nntplib.c	2010-09-12 21:11:20 +0000
+++ src/nntplib.c	2010-09-26 11:58:30 +0000
@@ -862,8 +862,15 @@
 		return 0;
 	}
 
-	if (--retry == 0)					/* No more tries? */
+	if (--retry == 0) {					/* No more tries? */
+		if (!strncmp("POST", buf, 4)) {
+			unlink(backup_article_name(article_name));
+			rename_file(article_name, dead_article);
+			if (tinrc.keep_dead_articles)
+				append_file(dead_articles, dead_article);
+		} 
 		tin_done(NNTP_ERROR_EXIT);
+	}
 
 	return retry;
 }

=== modified file 'src/post.c'
--- src/post.c	2010-09-11 16:08:21 +0000
+++ src/post.c	2010-09-26 11:58:59 +0000
@@ -129,7 +129,6 @@
 static FILE *create_mail_headers(char *filename, size_t filename_len, const char *suffix, const char *to, const char *subject, struct t_header *extra_hdrs);
 static char **build_nglist(char *ngs_list, int *ngcnt);
 static char **split_address_list(const char *addresses, unsigned int *cnt);
-static char *backup_article_name(const char *the_article);
 static int add_mail_quote(FILE *fp, int respnum);
 static int check_article_to_be_posted(const char *the_article, int art_type, struct t_group **group, t_bool art_unchanged);
 static int mail_loop(const char *filename, t_function func, char *subject, const char *groupname, const char *prompt, FILE *articlefp);
@@ -295,7 +294,7 @@
  * submit_news_file adds headers, does q-p conversion etc
  * TODO: why not use BACKUP_FILE_EXT like in misc.c?
  */
-static char *
+char *
 backup_article_name(
 	const char *the_article)
 {