Article View: news.software.nntp
Article #46295Re: INN 2.3.0 public beta
From: Process Pasteurized Fluffy Produ...
Date: Thu, 04 May 2000 00:00
Date: Thu, 04 May 2000 00:00
219 lines
6707 bytes
6707 bytes
Jeremy <bofh@netscum.dk> wrote:
> This is why I'd like to see something like the HEADERS command implemented.
> I almost always *don't* want Xrefs in my overviews when I'm reading over
> the Internet, but others do, and I might sometimes, so it would be very
> nice to have a choice at the client side.
Here's something to play with on recent 2.3 k0dez. It could stand
some more work that I'm unikely to have time to do (among other
things, the cmd syntax and output format are wild-ass guesses based on
various discussions here and I didn't get around to the part about
multiple copies of a header), so if anyone wants to adopt and nurture
(or discard and torture) this crap, it's all yours. So there.
*** article.c.dist Thu May 4 00:26:28 2000
--- article.c Thu May 4 02:58:59 2000
***************
*** 1108,1111 ****
--- 1102,1271 ----
PushIOb();
OVclosesearch(handle);
DISPOSE(pattern);
+ }
+
+
+ /*
+ ** HEADERS, an experimental extension.
+ **
+ ** Output resembles XOVER, except that the end user specifies the list
+ ** of headers to use.
+ */
+ FUNCTYPE CMDheaders(int ac, char *av[])
+ {
+ int ovflags[ac];
+ char *headers[ac];
+ char buff[SPOOLNAMEBUFF];
+ BOOL needart = FALSE;
+ ARTNUM artnum;
+ ARTRANGE range;
+ BOOL DidReply;
+ int i, j;
+ char *p, *text;
+
+ if (!PERMcanread) {
+ Printf("%s\r\n", NOACCESS);
+ return;
+ }
+
+ /* Message-ID specified? */
+ if (av[1][0] == '<') {
+ p = av[1];
+ if (!ARTopenbyid(p, &artnum)) {
+ Printf("%d No such article.\r\n", NNTP_DONTHAVEIT_VAL);
+ return;
+ }
+
+ Printf("%d headers follow.\r\n", NNTP_HEAD_FOLLOWS_VAL);
+
+ SendIOb(av[1], strlen(av[1]));
+ SendIOb(" ", 1);
+ for (i = 2; i <= ac; i++) {
+ if (i == ac) {
+ SendIOb("\r\n", 2);
+ break;
+ }
+ if (i > 2)
+ SendIOb("\t", 1);
+ text = GetHeader(av[i], FALSE);
+ if (text == NULL)
+ headers[i] = NULL;
+ else {
+ headers[i] = COPY(text);
+ SendIOb(headers[i], strlen(headers[i]));
+ }
+ }
+ SendIOb(".\r\n", 3);
+ PushIOb();
+ for (i = 2; i < ac; i++) {
+ if (headers[i] != NULL)
+ DISPOSE(headers[i]);
+ }
+ ARTclose();
+ return;
+ }
+
+ /* Range specified. */
+ if (!CMDgetrange(ac - 1, av, &range, &DidReply)) {
+ if (!DidReply) {
+ Reply("%d no headers follow.\r\n", NNTP_HEAD_FOLLOWS_VAL);
+ Printf(".\r\n");
+ return;
+ }
+ }
+
+ /* See if we need to call on the real articles */
+ for (i = 2; i < ac; i++) {
+ for (ovflags[i] = -1, j = 0; j < ARTfieldsize; j++) {
+ if (caseEQ(ARTfields[j].Header, av[i])) {
+ ovflags[i] = j;
+ break;
+ }
+ }
+ if (ovflags[i] < 0) {
+ needart = TRUE;
+ break;
+ }
+ }
+
+ if (needart) { /* need to read headers from spool, yuck. */
+ Printf("%d headers follow.\r\n", NNTP_HEAD_FOLLOWS_VAL);
+ for (i = range.Low; i <= range.High && range.High > 0; i++) {
+ if (!ARTopen(i))
+ continue;
+
+ j = sprintf(buff, "%lu\t", i);
+ SendIOb(buff, j);
+
+ for (j = 2; j <= ac; j++) {
+ if (j == ac) {
+ SendIOb("\r\n", 2);
+ break;
+ }
+ if (j > 2)
+ SendIOb("\t", 1);
+ text = GetHeader(av[j], FALSE);
+ if (text == NULL)
+ headers[j] = NULL;
+ else {
+ headers[j] = COPY(text);
+ SendIOb(headers[j], strlen(headers[j]));
+ }
+ }
+
+ for (j = 2; j < ac; j++) {
+ if (headers[j] != NULL)
+ DISPOSE(headers[j]);
+ }
+ ARTclose();
+ }
+ PushIOb();
+ Printf(".\r\n");
+ }
+ else { /* use overview */
+ void *handle;
+ char *data;
+ int len;
+ TOKEN token;
+
+ handle = (void *) OVopensearch(GRPcur, range.Low, range.High);
+ if (handle == NULL) {
+ Reply("%d no NOV headers follow\r\n.\r\n", NNTP_HEAD_FOLLOWS_VAL);
+ return;
+ }
+
+ Printf("%d NOV headers follow.\r\n", NNTP_HEAD_FOLLOWS_VAL);
+ while (OVsearch(handle, &artnum, &data, &len, &token, NULL)) {
+ if (len == 0 || PERMaccessconf->nnrpdcheckart
+ && !ARTinstorebytoken(token))
+ continue;
+
+ j = sprintf(buff, "%lu\t", artnum);
+ SendIOb(buff, j);
+
+ for (j = 2; j <= ac; j++) {
+ if (j == ac) {
+ SendIOb("\r\n", 2);
+ break;
+ }
+ if (j > 2)
+ SendIOb("\t", 1);
+ text = OVERGetHeader(data, ovflags[j]);
+ if (text == NULL)
+ headers[j] = NULL;
+ else {
+ headers[j] = COPY(text);
+ SendIOb(headers[j], strlen(headers[j]));
+ }
+ }
+ for (j = 2; j < ac; j++) {
+ if (headers[j] != NULL)
+ DISPOSE(headers[j]);
+ }
+ ARTclose();
+ }
+ PushIOb();
+ Printf(".\r\n");
+ OVclosesearch(handle);
+ }
}
*** nnrpd.c.dist Thu May 4 00:26:42 2000
--- nnrpd.c Thu May 4 00:49:39 2000
***************
*** 100,105 ****
--- 100,106 ----
extern FUNCTYPE CMDxover();
extern FUNCTYPE CMDxpat();
extern FUNCTYPE CMDxpath();
+ extern FUNCTYPE CMDheaders();
extern FUNCTYPE CMD_unimp();
#ifdef HAVE_SSL
extern FUNCTYPE CMDstarttls();
***************
*** 161,166 ****
--- 162,169 ----
"header range|MessageID pat [morepat...]" },
{ "xpath", CMDxpath, TRUE, 2, 2,
"MessageID" },
+ { "headers", CMDheaders, TRUE, 3, CMDany,
+ "range|MessageID header [header...]" },
{ NULL }
};
--
eludom
Technical Details
Message-ID:
<87d7n2vkx9.fsf@meowhost.meow.invalid>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.mbox.zip!not-for-mailReferences:
<yl7ldiu3j8.fsf@windlord.stanford.edu> <bill-3004002219240001@fireproof.scconsult.com> <957160457.365327@news.netscum.dk> <bill-0105001931200001@fireproof.scconsult.com> <957242886.971518@news.netscum.dk>Show Full Headers
Complete Article Headers
Message-ID: <87d7n2vkx9.fsf@meowhost.meow.invalid> Subject: Re: INN 2.3.0 public beta Date: Thu, 04 May 2000 00:00:00 +0000 From: Process Pasteurized Fluffy Product <supersede@india.com> References: <yl7ldiu3j8.fsf@windlord.stanford.edu> <bill-3004002219240001@fireproof.scconsult.com> <957160457.365327@news.netscum.dk> <bill-0105001931200001@fireproof.scconsult.com> <957242886.971518@news.netscum.dk> Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.mbox.zip!not-for-mail X-Deja-AN: 619040197 Mail-Copies-To: never Content-Type: text/plain; charset=us-ascii X-Complaints-To: newsabuse@supernews.com X-Face: #!n`o'kqzEiF(\CL4IR$H.F-||!S*5wv~g8~prn}Z<+F/-^?oJ:#_V#QP?G}!!yayV0]i\' GTb6:]Tic*!vjH}wm>ILhZBn8U0XEjh'l~yrjB?4Iiph5N9:kwqd/}86UTr9i|LCu]Bd)~G1R9U(qJ KOyEQK8*? Organization: If one may meow, all may meow. User-Agent: Gnus/5.0802 (Gnus v5.8.2) XEmacs/21.1 (Bryce Canyon) MIME-Version: 1.0 Newsgroups: news.software.nntp X-Meow: Wouf