Thread View: news.software.readers
5 messages
5 total messages
Started by Felix von Leitner
Wed, 12 Jun 1996 00:00
slrn0.8.8.2 patch for killing cross posts
Author: Felix von Leitner
Date: Wed, 12 Jun 1996 00:00
Date: Wed, 12 Jun 1996 00:00
239 lines
6595 bytes
6595 bytes
-----BEGIN PGP SIGNED MESSAGE-----
Slrn *does* kill cross posts already. But your news servers needs to
have the Xref command in the xover output. The two news servers I use
don't. So I hacked together this little diff. It's a kludge. I'm sure
John could do it better. But it works for me.
What it does:
* keep a hash table with linked lists for each message ID together
with the first newsgroup it appeared in.
* when an article is scored (i.e. when you enter a newsgroup),
this code looks whether the message id is already in the hash table.
If it is, then the article is scored -9999. Otherwise it is entered
with the current newsgroup.
I carry the newsgroup around so that you can leave and re-enter a
newsgroup without getting all the articles killed.
I tried to minimize the memory requirements of my code by storing the
name of the first newsgroup where an article was sighted only once. To
achieve this, another hash table is created which holds just pointers
to newsgroup names.
Please note that the message ids are not stored persistently. If you
leave slrn without having entered a newsgroup where a cross posted
article occurred, it is not killed.
Please verify the digital signature with PGP. Then
apply this patch by piping verified article through "patch -s".
You can also get this patch from
http://www.math.fu-berlin.de/~leitner/slrn.crosspost.diff
Enjoy!
Felix
- --- slrn/src/modules.lis.orig Wed Jun 12 03:10:06 1996
+++ slrn/src/modules.lis Wed Jun 12 01:36:18 1996
@@ -12,3 +12,4 @@
uudecode
mime
menu
+killdupe
- --- slrn/src/slrn.c.orig Wed Jun 12 03:10:18 1996
+++ slrn/src/slrn.c Wed Jun 12 01:40:22 1996
@@ -49,6 +49,7 @@
#include "startup.h"
#include "art.h"
#include "score.h"
+#include "killdupe.h"
#ifdef __os2__
# define INCL_VIO
@@ -724,6 +725,7 @@
else usage (NULL);
}
+ inithashtab();
fprintf (stdout, "slrn %s\n", Slrn_Version);
if (dsc_flag && create_flag)
- --- slrn/src/killdupe.h.orig Wed Jun 12 03:10:43 1996
+++ slrn/src/killdupe.h Wed Jun 12 02:22:02 1996
@@ -0,0 +1,5 @@
+
+void inithashtab(); /* Initialize the msgid dupe killer */
+char *there(const char *c); /* return newsgroup where c was first sighted or NULL */
+void add(const char *c,const char *n); /* add c in newsgroup n. */
+char *alloc_newsgroup(const char *c); /* if given a newsgroup, return a pointer to a string where it will be stored, so that newsgroups don't need to be allocated 1000 times */
- --- slrn/src/killdupe.c.orig Wed Jun 12 03:10:46 1996
+++ slrn/src/killdupe.c Wed Jun 12 02:46:50 1996
@@ -0,0 +1,125 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+unsigned short hash(const char *c) {
+ unsigned i=0;
+ while (*c) {
+ i=(i*7+(int) *c) % 4096;
+ c++;
+ }
+ return i;
+}
+
+struct node {
+ char *key,*key2;
+ struct node *next;
+};
+
+static struct node *hashtab[4096];
+static struct node *newsgroups[4096];
+static int dontgrow=0;
+
+void dump_hash(struct node *ht[]) {
+ int i;
+ struct node *h;
+ for (i=0;i<4096;i++) {
+ h=ht[i];
+ while (h) {
+ printf("%s %s\n",h->key,h->key2);
+ h=h->next;
+ }
+ }
+}
+
+struct node *hash_there(struct node *ht[], const char *c) {
+ int h=hash(c);
+ struct node *n=ht[h];
+ while (n) {
+ if (strcmp(n->key,c) == 0) {
+ return n;
+ }
+ n=n->next;
+ }
+ return 0;
+}
+
+int hash_add(struct node *ht[], const char *c, const char *second) {
+ int h=hash(c);
+ struct node *n=ht[h];
+ while (n) {
+ if (strcmp(n->key,c) == 0) {
+ return 1;
+ }
+ n=n->next;
+ }
+ if (dontgrow) return 0;
+ n=malloc(sizeof(struct node));
+ if (n == NULL) {
+ dontgrow=1;
+ return 0;
+ }
+ n->next = ht[h];
+ n->key = malloc(strlen(c)+1);
+ if (n->key==NULL) {
+ dontgrow=1;
+ return 0;
+ }
+ strcpy(n->key,c);
+ if (second) {
+ n->key2 = malloc(strlen(second)+1);
+ if (n->key2==NULL) {
+ dontgrow=1;
+ return 0;
+ }
+ strcpy(n->key2,second);
+ }
+ ht[h]=n;
+ return 0;
+}
+
+void inithashtab() {
+ int i;
+ for (i=0;i<4096;i++) {
+ hashtab[i]=0;
+ newsgroups[i]=0;
+ }
+}
+
+char *there(const char *c) {
+ struct node *n=hash_there(hashtab,c);
+ if (n)
+ return n->key2;
+ else
+ return NULL;
+}
+
+void add(const char *c,const char *n) {
+ hash_add(hashtab,c,n);
+}
+
+char *alloc_newsgroup(const char *c) {
+ struct node *n=hash_there(newsgroups,c);
+ if (n) return n->key;
+ hash_add(newsgroups,c,NULL);
+ n=hash_there(newsgroups,c);
+ return n->key;
+}
+
+/*
+int main()
+{
+ char s[1024];
+ int i;
+ inithashtab();
+ while (gets(s)) {
+ i = there(s);
+ if (i) {
+ printf("Huh: %d %s\n",i,s);
+ } else {
+ i=add(s);
+ }
+ }
+ return 0;
+}
+*/
- --- slrn/src/score.c.orig Wed Jun 12 03:10:54 1996
+++ slrn/src/score.c Wed Jun 12 02:52:01 1996
@@ -14,6 +14,7 @@
#include "score.h"
#include "misc.h"
#include "nntp.h"
+#include "killdupe.h"
/* This file will implement article scoring for slrn. Basically the idea is
* that the user will provide a set of regular expressions that will act on
@@ -124,6 +125,12 @@
char *s = NULL;
int ival = 0;
+ if ((s=there(h->msgid))) { /* This article is a dupe. */
+ if (strcmp(s,newsgroup)) return (-9999);
+ /* Kill it if this wasn't the newsgroup were we saw it */
+ }
+ add(h->msgid,alloc_newsgroup(newsgroup));
+ s=NULL;
st = Score_Root;
while (st != NULL)
-----BEGIN PGP SIGNATURE-----
Version: 2.6.3i
Charset: latin1
iQCVAwUBMb4kiB/Da1Yoy+f1AQFZmgQAjMtskJBHyVz93fx8zzGJiLbSU34xdvvH
L578v9gXg99tCy6FJd5q/tPn1C9/2Ssyy7cHYPBZ20tSBtUwzUvmAFkbwVrT0ibc
1MDp3bkD06WCOi5Zj8C88fpJl6PSSrDXIL3ut44JsKGWKmoWriCHUOrNzDBrGJaM
I4NZHAkmaIY=
=3ZlW
-----END PGP SIGNATURE-----
Re: slrn0.8.8.2 patch for killing cross posts
Author: Martin Schmachtel
Date: Wed, 12 Jun 1996 00:00
Date: Wed, 12 Jun 1996 00:00
21 lines
1257 bytes
1257 bytes
In article <slrn4rs94a.4n6.leitner@xorn.prz.tu-berlin.de>, Felix von Leitner wrote: >-----BEGIN PGP SIGNED MESSAGE----- > >Slrn *does* kill cross posts already. But your news servers needs to >have the Xref command in the xover output. The two news servers I use >don't. I don't know about news.prz.tu-berlin.de but news.fu-berlin.de (I think this is the other one you mention) *does* have Xref in its xover output. If something doesn't work for you, chances are that it doesn't work for other people, too. You should first describe your problem, maybe there's a hidden bug somewhere? ciaole schmadde
Re: slrn0.8.8.2 patch for killing cross posts
Author: Felix von Leitner
Date: Thu, 13 Jun 1996 00:00
Date: Thu, 13 Jun 1996 00:00
32 lines
1995 bytes
1995 bytes
On 12 Jun 1996 10:48:47 GMT, Martin Schmachtel <schmacht@inf.fu-berlin.de> wrote: > I don't know about news.prz.tu-berlin.de but news.fu-berlin.de (I think > this is the other one you mention) *does* have Xref in its xover output. news.fu-berlin.de: $ telnet news.fu-berlin.de 119 200 fu-berlin.de NNRP server INN 1.4unoff3 17-Oct-95 ready (posting ok). mode reader 200 fu-berlin.de NNRP server at Freie Universitaet Berlin ready (posting ok). group comp.os.linux.announce 211 174 5559 5732 comp.os.linux.announce xover 5732 5732 COMMERCIAL: COSMIC Programs for Linux Workstations Steven Kirby <kirby@cosmic.uga.edu> Wed, 12 Jun 1996 12:36:33 GMT <cola-liw-834582993-8336-0@liw.clinet.fi> 2429 47 . This is *no* Xref within xover. Xref within xover looks like this: $ telnet news.cs.tu-berlin.de 119 200 cs.tu-berlin.de InterNetNews NNRP server INN 1.4 20-Mar-93 ready (posting ok). group comp.os.linux.announce 211 174 5589 5762 comp.os.linux.announce xover 5589 224 data follows 5589 suck-2.6.3 - simple NNTP feed "Robert A. Yetman" <boby@pixi.com> Sat, 12 May 1996 16:56:19 GMT <cola-liw-831920179-28510-0@liw.clinet.fi> 8916 192 Xref: cs.tu-berlin.de comp.os.linux.announce:5589 . Felix
Re: slrn0.8.8.2 patch for killing cross posts
Author: Olly Betts
Date: Fri, 14 Jun 1996 00:00
Date: Fri, 14 Jun 1996 00:00
77 lines
3659 bytes
3659 bytes
In article <slrn4s0c1n.1qi.leitner@xorn.prz.tu-berlin.de>, Felix von Leitner wrote:
>On 12 Jun 1996 10:48:47 GMT, Martin Schmachtel <schmacht@inf.fu-berlin.de> wrote
> :
>> I don't know about news.prz.tu-berlin.de but news.fu-berlin.de (I think
>> this is the other one you mention) *does* have Xref in its xover output.
>
>news.fu-berlin.de:
>
> $ telnet news.fu-berlin.de 119
>[...]
> 5732 COMMERCIAL: COSMIC Programs for Linux Workstations Steven Kirby <
> kirby@cosmic.uga.edu> Wed, 12 Jun 1996 12:36:33 GMT <cola-liw-834582993-833
> 6-0@liw.clinet.fi> 2429 47
> .
>
>This is *no* Xref within xover. Xref within xover looks like this:
>
> $ telnet news.cs.tu-berlin.de 119
>[...]
> 5589 suck-2.6.3 - simple NNTP feed "Robert A. Yetman" <boby@pixi.com>
> Sat, 12 May 1996 16:56:19 GMT <cola-liw-831920179-28510-0@liw.clinet.fi>
> 8916 192 Xref: cs.tu-berlin.de comp.os.linux.announce:5589
> .
You don't necessarily get an Xref: header on an article only posted to one
group (since it doesn't perform any useful function unless the article is
cross-posted). Take a look at this transcript ('news' *does* has Xref:
configured into XOVER, but it only appears on cross-posted articles):
[...]
Connected to news.
Escape character is '^]'.
200 mantis InterNetNews server INN 1.4 20-Mar-93 ready
mode reader
200 mantis InterNetNews NNRP server INN 1.4 20-Mar-93 ready (posting ok).
group news.software.readers
211 192 23223 26770 news.software.readers
xover 26728
224 data follows
26728 Re: slrn0.8.8.2 patch for killing cross posts leitner@xorn.prz.tu-berl
in.de (Felix von Leitner) 13 Jun 1996 15:14:15 GMT <slrn4s0c1n.1qi.
leitner@xorn.prz.tu-berlin.de> <slrn4rs94a.4n6.leitner@xorn.prz.tu-berlin.de> <
4pm7af$395@fu-berlin.de> 1970 29
..
xover 26734
224 data follows
26734 Re: ANNOUNCE "Gravity" Win95/NT Newsreader rdevoe@ix.netcom.com (Ra
ymond DeVoe) Fri, 14 Jun 96 00:10:47 GMT <4pqame$85h@dfw-ixnews8.ix.netco
m.com> <MPLANET.31bde3b4tony989687@news.nando.net> <31c05d97.5460143@netnews.wo
rldnet.att.net> 2291 24 Xref: mantis alt.usenet.offline-reader:3364 alt.
usenet.offline-reader.forte-agent:808 alt.winsock:21141 comp.os.ms-windows.apps.
comm:3212 comp.os.ms-windows.apps.winsock.news:1685 comp.os.ms-windows.networkin
g.win95:2366 comp.os.ms-windows.win95.misc:70227 news.software.readers:26734
..
list overview.fmt
215 Order of fields in overview database.
Subject:
From:
Date:
Message-ID:
References:
Bytes:
Lines:
Xref:full
..
Assuming your server supports it (which it really ought to if it supports
XOVER), "LIST OVERVIEW.FMT" is the best way to tell if you've got Xref: (and
indeed any other headers) configured in.
Olly
--
cool wet grass cool wet grass cool wet grass cool wet grass cool wet grass
Re: slrn0.8.8.2 patch for killing cross posts
Author: Felix von Leitner
Date: Sun, 16 Jun 1996 00:00
Date: Sun, 16 Jun 1996 00:00
14 lines
1239 bytes
1239 bytes
On 14 Jun 1996 10:47:30 GMT, Olly Betts <olly@mantis.co.uk> wrote:
> You don't necessarily get an Xref: header on an article only posted to one
> group (since it doesn't perform any useful function unless the article is
> cross-posted). Take a look at this transcript ('news' *does* has Xref:
> configured into XOVER, but it only appears on cross-posted articles):
OK, I learned that. I withdraw my claim that news.fu-berlin.de does not
generate Xref: headers.
Felix
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