Thread View: news.software.nn
1 messages
1 total messages
Started by Alan J Rosenthal
Tue, 08 Feb 2005 16:06
here's a patch to trim long References: lines automatically
Author: Alan J Rosenthal
Date: Tue, 08 Feb 2005 16:06
Date: Tue, 08 Feb 2005 16:06
88 lines
4125 bytes
4125 bytes
hi folks,
In newsgroups with long-running threads, some things seem to start messing
up when the References: line exceeds 512 bytes in length. This byte limit is
arguably implied by RFC 977. One solution is to break up the References line
into multiple lines (with leading white space on the continuation lines),
but really, you don't need all those message-ids after a while.
Son-of-1036 states a proper way to shorten References: lines: You keep the
first entry, because that is the base article which identifies the thread;
then you remove message-ids immediately after that, so that you keep as
many recent entries as possible too.
Here's a patch to do just that. It makes the references: line always be under
512 bytes. I've been using it for months. It is a patch against nn 6.6.5.
*** answer.c.orig Fri Jun 21 01:27:25 2002
--- answer.c Mon Jul 5 12:18:15 2004
***************
*** 134,140 ****
if (news.ng_ref == NULL && news.ng_ident == NULL) return;
fputs("References:", t);
! if (news.ng_ref) fprintf(t, " %s", news.ng_ref);
if (news.ng_ident) fprintf(t, " %s", news.ng_ident);
putc(NL, t);
ed_line++;
--- 134,192 ----
if (news.ng_ref == NULL && news.ng_ident == NULL) return;
fputs("References:", t);
!
! /*
! * code by flaps to trim too-long references: lines (some news servers
! * break lines at 512 bytes).
! * The first References: item must remain the base article id.
! * Then delete as many as necessary, then output the tail.
! */
! if (news.ng_ref) {
! int pos = 11; /* output position, currently strlen("References:") */
! char *p = news.ng_ref;
! /* maximum position is 512 minus the \0 and maybe minus news.ng_ident,
! * which if output is preceded by a space */
! int maxpos = (news.ng_ident ? 511 - (1 + strlen(news.ng_ident)) : 511);
! int rlen;
!
! /* First, output the base article's message id. */
! /* First output a space between "References:" and the message id. */
! putc(' ', t);
! pos++;
! /* Skip leading white space. */
! while (*p && isascii(*p) && isspace(*p))
! p++;
! /* Output through next white space. */
! while (*p && !(isascii(*p) && isspace(*p))) {
! putc(*p++, t);
! pos++;
! }
!
! /*
! * Now, the rest of the previous article's references, but maybe
! * leaving some of them out to avoid exceeding 512 bytes.
! */
! rlen = strlen(p); /* number of bytes remaining */
! if (pos + rlen <= maxpos) {
! fputs(p, t);
! } else {
! /* Find message id at which to start. Jump into the middle and
! * then find a valid starting place. */
! p += rlen - (maxpos - pos);
! /* find next '<' */
! while (*p && *p != '<')
! p++;
! if (*p)
! fputs(p - 1, t);
! /* go back to include one white space character. This
! * is guaranteed to stay within the array because
! * maxpos-pos is strictly less than rlen, therefore
! * rlen - (maxpos - pos) is positive, therefore p is
! * greater than it was before this enclosing 'else'.
! */
! }
! }
!
if (news.ng_ident) fprintf(t, " %s", news.ng_ident);
putc(NL, t);
ed_line++;
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads