[w3m-dev 03610] Re: news:<newsgroup>
* anchor.c (_put_anchor_news): check '<' (reAnchorNewsheader): added * file.c (loadSomething): Subject: as buffername (checkHeader): check buf->document_header (loadGeneralFile): reAnchorNewsheader * html.h (SCM_NNTP_GROUP): added * main.c (main): delete USE_NNTP in switch (newbuf->real_scheme) (chkNMIDBuffer): lowercase in url_like_pat * news.c (add_news_message): add scheme, group as arg (openNewsStream): check SCM_NNTP_GROUP check current_news.host (readNewsgroup): rewrite to support nntp:,news: extension * proto.h (reAnchorNewsheader): added * url.c (DefaultPort): add 119 for nntp group (parseURL2): rewrite to support nntp:,news: extension (_parsedURL2Str): add for SCM_NNTP_GROUP (openURL): rewrite to support nntp:,news: extension From: Hironori SAKAMOTO <hsaka@mth.biglobe.ne.jp>
This commit is contained in:
1 parent
ee18da17df
commit
ff20968c8c
8 files changed
+251
-98
No files matched your search
@@ -1,3 +1,24 @@
|
|||||||
|
2003-01-07 Hironori SAKAMOTO <hsaka@mth.biglobe.ne.jp>
|
||||||
|
|
||||||
|
* [w3m-dev 03610] Re: news:<newsgroup>
|
||||||
|
* anchor.c (_put_anchor_news): check '<'
|
||||||
|
(reAnchorNewsheader): added
|
||||||
|
* file.c (loadSomething): Subject: as buffername
|
||||||
|
(checkHeader): check buf->document_header
|
||||||
|
(loadGeneralFile): reAnchorNewsheader
|
||||||
|
* html.h (SCM_NNTP_GROUP): added
|
||||||
|
* main.c (main): delete USE_NNTP in switch (newbuf->real_scheme)
|
||||||
|
(chkNMIDBuffer): lowercase in url_like_pat
|
||||||
|
* news.c (add_news_message): add scheme, group as arg
|
||||||
|
(openNewsStream): check SCM_NNTP_GROUP
|
||||||
|
check current_news.host
|
||||||
|
(readNewsgroup): rewrite to support nntp:,news: extension
|
||||||
|
* proto.h (reAnchorNewsheader): added
|
||||||
|
* url.c (DefaultPort): add 119 for nntp group
|
||||||
|
(parseURL2): rewrite to support nntp:,news: extension
|
||||||
|
(_parsedURL2Str): add for SCM_NNTP_GROUP
|
||||||
|
(openURL): rewrite to support nntp:,news: extension
|
||||||
|
|
||||||
2002-12-28 Fumitoshi UKAI <ukai@debian.or.jp>
|
2002-12-28 Fumitoshi UKAI <ukai@debian.or.jp>
|
||||||
|
|
||||||
* fix build errors
|
* fix build errors
|
||||||
@@ -6157,4 +6178,4 @@ a * [w3m-dev 03276] compile error on EWS4800
|
|||||||
* release-0-2-1
|
* release-0-2-1
|
||||||
* import w3m-0.2.1
|
* import w3m-0.2.1
|
||||||
|
|
||||||
$Id: ChangeLog,v 1.655 2002/12/27 16:46:13 ukai Exp $
|
$Id: ChangeLog,v 1.656 2003/01/06 15:36:56 ukai Exp $
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
/* $Id: anchor.c,v 1.17 2002/12/24 17:24:33 ukai Exp $ */
|
/* $Id: anchor.c,v 1.18 2003/01/06 15:36:57 ukai Exp $ */
|
||||||
#include "fm.h"
|
#include "fm.h"
|
||||||
#include "myctype.h"
|
#include "myctype.h"
|
||||||
#include "regex.h"
|
#include "regex.h"
|
||||||
@@ -193,9 +193,11 @@ _put_anchor_news(Buffer *buf, char *p1, char *p2, int line, int pos)
|
|||||||
{
|
{
|
||||||
Str tmp;
|
Str tmp;
|
||||||
|
|
||||||
p1++;
|
if (*p1 == '<') {
|
||||||
if (*(p2 - 1) == '>')
|
p1++;
|
||||||
p2--;
|
if (*(p2 - 1) == '>')
|
||||||
|
p2--;
|
||||||
|
}
|
||||||
tmp = Strnew_charp_n(p1, p2 - p1);
|
tmp = Strnew_charp_n(p1, p2 - p1);
|
||||||
#ifdef JP_CHARSET
|
#ifdef JP_CHARSET
|
||||||
tmp = conv_str(tmp, InnerCode, buf->document_code);
|
tmp = conv_str(tmp, InnerCode, buf->document_code);
|
||||||
@@ -366,6 +368,61 @@ reAnchorNews(Buffer *buf, char *re)
|
|||||||
{
|
{
|
||||||
return reAnchorAny(buf, re, _put_anchor_news);
|
return reAnchorAny(buf, re, _put_anchor_news);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
char *
|
||||||
|
reAnchorNewsheader(Buffer *buf)
|
||||||
|
{
|
||||||
|
Line *l;
|
||||||
|
char *p, *p1, *p2;
|
||||||
|
static char *header_mid[] = {
|
||||||
|
"Message-Id:", "References:", "In-Reply-To:", NULL
|
||||||
|
};
|
||||||
|
static char *header_group[] = {
|
||||||
|
"Newsgroups:", NULL
|
||||||
|
};
|
||||||
|
char **header, **q;
|
||||||
|
int i, search = FALSE;
|
||||||
|
|
||||||
|
if (!buf || !buf->firstLine)
|
||||||
|
return NULL;
|
||||||
|
for (i = 0; i <= 1; i++) {
|
||||||
|
if (i == 0) {
|
||||||
|
regexCompile("<[!-;=?-~]+@[a-zA-Z0-9\\.\\-_]+>", 1);
|
||||||
|
header = header_mid;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
regexCompile("[a-zA-Z0-9\\.\\-_]+", 1);
|
||||||
|
header = header_group;
|
||||||
|
}
|
||||||
|
for (l = buf->firstLine; l != NULL && l->real_linenumber == 0;
|
||||||
|
l = l->next) {
|
||||||
|
p = l->lineBuf;
|
||||||
|
if (!IS_SPACE(*p)) {
|
||||||
|
search = FALSE;
|
||||||
|
for (q = header; *q; q++) {
|
||||||
|
if (!strncasecmp(p, *q, sizeof(*q) - 1)) {
|
||||||
|
search = TRUE;
|
||||||
|
p = strchr(p, ':') + 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!search)
|
||||||
|
continue;
|
||||||
|
for (;;) {
|
||||||
|
if (regexMatch(p, &l->lineBuf[l->len] - p, p == l->lineBuf)
|
||||||
|
== 1) {
|
||||||
|
matchedPosition(&p1, &p2);
|
||||||
|
p = reAnchorPos(buf, l, p1, p2, _put_anchor_news);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
reseq_anchor(buf);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
#endif /* USE_NNTP */
|
#endif /* USE_NNTP */
|
||||||
|
|
||||||
#define FIRST_MARKER_SIZE 30
|
#define FIRST_MARKER_SIZE 30
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
/* $Id: file.c,v 1.174 2002/12/27 16:30:54 ukai Exp $ */
|
/* $Id: file.c,v 1.175 2003/01/06 15:36:58 ukai Exp $ */
|
||||||
#include "fm.h"
|
#include "fm.h"
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include "myctype.h"
|
#include "myctype.h"
|
||||||
@@ -215,8 +215,11 @@ loadSomething(URLFile *f,
|
|||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
buf->filename = path;
|
buf->filename = path;
|
||||||
if (buf->buffername == NULL || buf->buffername[0] == '\0')
|
if (buf->buffername == NULL || buf->buffername[0] == '\0') {
|
||||||
buf->buffername = conv_from_system(lastFileName(path));
|
buf->buffername = checkHeader(buf, "Subject:");
|
||||||
|
if (buf->buffername == NULL)
|
||||||
|
buf->buffername = conv_from_system(lastFileName(path));
|
||||||
|
}
|
||||||
if (buf->currentURL.scheme == SCM_UNKNOWN)
|
if (buf->currentURL.scheme == SCM_UNKNOWN)
|
||||||
buf->currentURL.scheme = f->scheme;
|
buf->currentURL.scheme = f->scheme;
|
||||||
buf->real_scheme = f->scheme;
|
buf->real_scheme = f->scheme;
|
||||||
@@ -889,7 +892,7 @@ checkHeader(Buffer *buf, char *field)
|
|||||||
TextListItem *i;
|
TextListItem *i;
|
||||||
char *p;
|
char *p;
|
||||||
|
|
||||||
if (buf == NULL || field == NULL)
|
if (buf == NULL || field == NULL || buf->document_header == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
for (i = buf->document_header->first; i != NULL; i = i->next) {
|
for (i = buf->document_header->first; i != NULL; i = i->next) {
|
||||||
if (!strncasecmp(i->ptr, field, len)) {
|
if (!strncasecmp(i->ptr, field, len)) {
|
||||||
@@ -2089,6 +2092,10 @@ loadGeneralFile(char *path, ParsedURL *volatile current, char *referer,
|
|||||||
}
|
}
|
||||||
if (header_string)
|
if (header_string)
|
||||||
header_string = NULL;
|
header_string = NULL;
|
||||||
|
#ifdef USE_NNTP
|
||||||
|
if (f.scheme == SCM_NNTP || f.scheme == SCM_NEWS)
|
||||||
|
reAnchorNewsheader(b);
|
||||||
|
#endif
|
||||||
preFormUpdateBuffer(b);
|
preFormUpdateBuffer(b);
|
||||||
if (fmInitialized)
|
if (fmInitialized)
|
||||||
term_raw();
|
term_raw();
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
/* $Id: html.h,v 1.17 2002/12/27 16:07:44 ukai Exp $ */
|
/* $Id: html.h,v 1.18 2003/01/06 15:36:59 ukai Exp $ */
|
||||||
#ifndef _HTML_H
|
#ifndef _HTML_H
|
||||||
#define _HTML_H
|
#define _HTML_H
|
||||||
#ifdef USE_SSL
|
#ifdef USE_SSL
|
||||||
@@ -361,11 +361,12 @@ struct environment {
|
|||||||
#define SCM_LOCAL_CGI 5
|
#define SCM_LOCAL_CGI 5
|
||||||
#define SCM_EXEC 6
|
#define SCM_EXEC 6
|
||||||
#define SCM_NNTP 7
|
#define SCM_NNTP 7
|
||||||
#define SCM_NEWS 8
|
#define SCM_NNTP_GROUP 8
|
||||||
#define SCM_NEWS_GROUP 9
|
#define SCM_NEWS 9
|
||||||
#define SCM_MAILTO 10
|
#define SCM_NEWS_GROUP 10
|
||||||
|
#define SCM_MAILTO 11
|
||||||
#ifdef USE_SSL
|
#ifdef USE_SSL
|
||||||
#define SCM_HTTPS 11
|
#define SCM_HTTPS 12
|
||||||
#endif /* USE_SSL */
|
#endif /* USE_SSL */
|
||||||
|
|
||||||
#endif /* _HTML_H */
|
#endif /* _HTML_H */
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
/* $Id: main.c,v 1.183 2002/12/27 16:07:44 ukai Exp $ */
|
/* $Id: main.c,v 1.184 2003/01/06 15:36:59 ukai Exp $ */
|
||||||
#define MAINPROGRAM
|
#define MAINPROGRAM
|
||||||
#include "fm.h"
|
#include "fm.h"
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
@@ -874,11 +874,6 @@ main(int argc, char **argv, char **envp)
|
|||||||
else if (newbuf == NO_BUFFER)
|
else if (newbuf == NO_BUFFER)
|
||||||
continue;
|
continue;
|
||||||
switch (newbuf->real_scheme) {
|
switch (newbuf->real_scheme) {
|
||||||
#ifdef USE_NNTP
|
|
||||||
case SCM_NNTP:
|
|
||||||
case SCM_NEWS:
|
|
||||||
case SCM_NEWS_GROUP:
|
|
||||||
#endif /* USE_NNTP */
|
|
||||||
case SCM_MAILTO:
|
case SCM_MAILTO:
|
||||||
break;
|
break;
|
||||||
case SCM_LOCAL:
|
case SCM_LOCAL:
|
||||||
@@ -4636,7 +4631,7 @@ void
|
|||||||
chkNMIDBuffer(Buffer *buf)
|
chkNMIDBuffer(Buffer *buf)
|
||||||
{
|
{
|
||||||
static char *url_like_pat[] = {
|
static char *url_like_pat[] = {
|
||||||
"<[!-;=?-~]+@[A-z0-9\\.\\-_]+>",
|
"<[!-;=?-~]+@[a-zA-Z0-9\\.\\-_]+>",
|
||||||
NULL,
|
NULL,
|
||||||
};
|
};
|
||||||
int i;
|
int i;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
/* $Id: news.c,v 1.5 2002/12/27 16:46:13 ukai Exp $ */
|
/* $Id: news.c,v 1.6 2003/01/06 15:36:59 ukai Exp $ */
|
||||||
#include "fm.h"
|
#include "fm.h"
|
||||||
#include "myctype.h"
|
#include "myctype.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
@@ -181,7 +181,7 @@ html_quote_s(char *str)
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
add_news_message(Str str, int index, char *date, char *name, char *subject,
|
add_news_message(Str str, int index, char *date, char *name, char *subject,
|
||||||
char *mid)
|
char *mid, char *scheme, char *group)
|
||||||
{
|
{
|
||||||
time_t t;
|
time_t t;
|
||||||
struct tm *tm;
|
struct tm *tm;
|
||||||
@@ -190,12 +190,40 @@ add_news_message(Str str, int index, char *date, char *name, char *subject,
|
|||||||
t = mymktime(date);
|
t = mymktime(date);
|
||||||
tm = localtime(&t);
|
tm = localtime(&t);
|
||||||
Strcat(str,
|
Strcat(str,
|
||||||
Sprintf
|
Sprintf("<tr valign=top><td>%d<td nowrap>(%02d/%02d)<td nowrap>%s",
|
||||||
("<tr valign=top><td>%d<td nowrap>(%02d/%02d)<td nowrap>%s<td><a href=\"news:%s\">%s</a>\n",
|
index, tm->tm_mon + 1, tm->tm_mday, html_quote_s(name)));
|
||||||
index, tm->tm_mon + 1, tm->tm_mday, html_quote_s(name),
|
if (group)
|
||||||
html_quote(file_quote(mid)), html_quote(subject)));
|
Strcat(str, Sprintf("<td><a href=\"%s%s/%d\">%s</a>\n", scheme, group,
|
||||||
|
index, html_quote(subject)));
|
||||||
|
else
|
||||||
|
Strcat(str, Sprintf("<td><a href=\"%s%s\">%s</a>\n", scheme,
|
||||||
|
html_quote(file_quote(mid)), html_quote(subject)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* [News article]
|
||||||
|
* * RFC 1738
|
||||||
|
* nntp://<host>:<port>/<newsgroup-name>/<article-number>
|
||||||
|
* news:<message-id>
|
||||||
|
*
|
||||||
|
* * Extension
|
||||||
|
* nntp://<host>:<port>/<newsgroup-name>/<message-id>
|
||||||
|
* nntp://<host>:<port>/<message-id>
|
||||||
|
* news:<newsgroup-name>/<article-number>
|
||||||
|
* news:<newsgroup-name>/<message-id>
|
||||||
|
*
|
||||||
|
* [News group]
|
||||||
|
* * RFC 1738
|
||||||
|
* news:<newsgroup-name>
|
||||||
|
*
|
||||||
|
* * Extension
|
||||||
|
* nntp://<host>:<port>/<newsgroup-name>
|
||||||
|
* nntp://<host>:<port>/<newsgroup-name>/<start-number>-<end-number>
|
||||||
|
* news:<newsgroup-name>/<start-number>-<end-number>
|
||||||
|
*
|
||||||
|
* <message-id> = <unique>@<full_domain_name>
|
||||||
|
*/
|
||||||
|
|
||||||
InputStream
|
InputStream
|
||||||
openNewsStream(ParsedURL *pu)
|
openNewsStream(ParsedURL *pu)
|
||||||
{
|
{
|
||||||
@@ -205,13 +233,17 @@ openNewsStream(ParsedURL *pu)
|
|||||||
|
|
||||||
if (pu->file == NULL || *pu->file == '\0')
|
if (pu->file == NULL || *pu->file == '\0')
|
||||||
return NULL;
|
return NULL;
|
||||||
if (pu->scheme == SCM_NNTP)
|
if (pu->scheme == SCM_NNTP || pu->scheme == SCM_NNTP_GROUP)
|
||||||
host = pu->host;
|
host = pu->host;
|
||||||
else
|
else
|
||||||
host = NNTP_server;
|
host = NNTP_server;
|
||||||
if (!host || *host == '\0')
|
if (!host || *host == '\0') {
|
||||||
|
if (current_news.host)
|
||||||
|
news_quit(¤t_news);
|
||||||
return NULL;
|
return NULL;
|
||||||
if (pu->scheme != SCM_NNTP && (p = strchr(host, ':'))) {
|
}
|
||||||
|
if (pu->scheme != SCM_NNTP && pu->scheme != SCM_NNTP_GROUP &&
|
||||||
|
(p = strchr(host, ':'))) {
|
||||||
host = allocStr(host, p - host);
|
host = allocStr(host, p - host);
|
||||||
port = atoi(p + 1);
|
port = atoi(p + 1);
|
||||||
}
|
}
|
||||||
@@ -238,24 +270,33 @@ openNewsStream(ParsedURL *pu)
|
|||||||
if (!news_open(¤t_news))
|
if (!news_open(¤t_news))
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
if (pu->scheme == SCM_NNTP) {
|
if (pu->scheme == SCM_NNTP || pu->scheme == SCM_NEWS) {
|
||||||
/* first char of pu->file is '/' */
|
/* News article */
|
||||||
group = file_unquote(Strnew_charp(pu->file + 1)->ptr);
|
group = allocStr(pu->file, -1);
|
||||||
|
if (pu->scheme == SCM_NNTP && *group == '/') {
|
||||||
|
/* first char of pu->file is '/' */
|
||||||
|
group++;
|
||||||
|
}
|
||||||
|
group = file_unquote(group);
|
||||||
p = strchr(group, '/');
|
p = strchr(group, '/');
|
||||||
if (p == NULL)
|
if (p == NULL) { /* <message-id> */
|
||||||
return NULL;
|
if (!strchr(group, '@'))
|
||||||
*p++ = '\0';
|
return NULL;
|
||||||
news_command(¤t_news, Sprintf("GROUP %s", group)->ptr, &status);
|
p = group;
|
||||||
if (status != 211)
|
}
|
||||||
return NULL;
|
else { /* <newsgroup>/<message-id or article-number> */
|
||||||
news_command(¤t_news, Sprintf("ARTICLE %s", p)->ptr, &status);
|
*p++ = '\0';
|
||||||
if (status != 220)
|
news_command(¤t_news, Sprintf("GROUP %s", group)->ptr,
|
||||||
return NULL;
|
&status);
|
||||||
return current_news.rf;
|
if (status != 211)
|
||||||
}
|
return NULL;
|
||||||
else if (pu->scheme == SCM_NEWS) {
|
}
|
||||||
tmp = Sprintf("ARTICLE <%s>", url_unquote(pu->file));
|
if (strchr(p, '@')) /* <message-id> */
|
||||||
news_command(¤t_news, tmp->ptr, &status);
|
news_command(¤t_news, Sprintf("ARTICLE <%s>", p)->ptr,
|
||||||
|
&status);
|
||||||
|
else /* <article-number> */
|
||||||
|
news_command(¤t_news, Sprintf("ARTICLE %s", p)->ptr,
|
||||||
|
&status);
|
||||||
if (status != 220)
|
if (status != 220)
|
||||||
return NULL;
|
return NULL;
|
||||||
return current_news.rf;
|
return current_news.rf;
|
||||||
@@ -270,8 +311,7 @@ readNewsgroup(ParsedURL *pu)
|
|||||||
Str tmp;
|
Str tmp;
|
||||||
URLFile f;
|
URLFile f;
|
||||||
Buffer *buf;
|
Buffer *buf;
|
||||||
char *group, *p, *q, *s, *t, *n;
|
char *scheme, *group, *qgroup, *list, *p, *q, *s, *t, *n;
|
||||||
char *volatile qgroup;
|
|
||||||
int status, i, first, last;
|
int status, i, first, last;
|
||||||
volatile int flag = 0, start = 0, end = 0;
|
volatile int flag = 0, start = 0, end = 0;
|
||||||
char code = '\0';
|
char code = '\0';
|
||||||
@@ -279,14 +319,28 @@ readNewsgroup(ParsedURL *pu)
|
|||||||
|
|
||||||
if (current_news.host == NULL || !pu->file || *pu->file == '\0')
|
if (current_news.host == NULL || !pu->file || *pu->file == '\0')
|
||||||
return NULL;
|
return NULL;
|
||||||
group = file_unquote(pu->file);
|
group = allocStr(pu->file, -1);
|
||||||
qgroup = html_quote(group);
|
if (pu->scheme == SCM_NNTP_GROUP) {
|
||||||
page = Strnew();
|
if (*group == '/')
|
||||||
|
group++;
|
||||||
|
scheme = "nntp:/";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
scheme = "news:";
|
||||||
|
if ((list = strchr(group, '/'))) {
|
||||||
|
/* <newsgroup>/<start-number>-<end-number> */
|
||||||
|
*list++ = '\0';
|
||||||
|
}
|
||||||
if (fmInitialized) {
|
if (fmInitialized) {
|
||||||
message(Sprintf("Reading newsgroup %s...", group)->ptr, 0, 0);
|
message(Sprintf("Reading newsgroup %s...", group)->ptr, 0, 0);
|
||||||
refresh();
|
refresh();
|
||||||
}
|
}
|
||||||
|
qgroup = html_quote(group);
|
||||||
|
group = file_unquote(group);
|
||||||
|
page = Sprintf("<title>Newsgroup: %s</title>\n\
|
||||||
|
<h1>Newsgroup: %s</h1>\n<hr>\n",
|
||||||
|
qgroup, qgroup);
|
||||||
|
|
||||||
if (SETJMP(AbortLoading) != 0) {
|
if (SETJMP(AbortLoading) != 0) {
|
||||||
news_close(¤t_news);
|
news_close(¤t_news);
|
||||||
Strcat_charp(page, "</table><p>Transfer Interrupted!\n");
|
Strcat_charp(page, "</table><p>Transfer Interrupted!\n");
|
||||||
@@ -296,42 +350,44 @@ readNewsgroup(ParsedURL *pu)
|
|||||||
if (fmInitialized)
|
if (fmInitialized)
|
||||||
term_cbreak();
|
term_cbreak();
|
||||||
|
|
||||||
page =
|
|
||||||
Sprintf
|
|
||||||
("<title>Newsgroup: %s</title>\n<h1>Newsgroup: %s</h1>\n<hr>\n",
|
|
||||||
qgroup, qgroup);
|
|
||||||
|
|
||||||
qgroup = html_quote(file_quote(group)); /* URL */
|
|
||||||
tmp =
|
tmp =
|
||||||
news_command(¤t_news, Sprintf("GROUP %s", group)->ptr, &status);
|
news_command(¤t_news, Sprintf("GROUP %s", group)->ptr, &status);
|
||||||
if (status != 211)
|
if (status != 211)
|
||||||
goto news_list;
|
goto news_list;
|
||||||
if (sscanf(tmp->ptr, "%d %d %d %d", &status, &i, &first, &last) != 4)
|
if (sscanf(tmp->ptr, "%d %d %d %d", &status, &i, &first, &last) != 4)
|
||||||
goto news_list;
|
goto news_list;
|
||||||
if (pu->label) {
|
if (list && *list) {
|
||||||
start = atoi(pu->label);
|
if ((p = strchr(list, '-'))) {
|
||||||
|
*p++ = '\0';
|
||||||
|
end = atoi(p);
|
||||||
|
}
|
||||||
|
start = atoi(list);
|
||||||
if (start > 0) {
|
if (start > 0) {
|
||||||
if (start < first)
|
if (start < first)
|
||||||
start = first;
|
start = first;
|
||||||
end = start + MaxNewsMessage;
|
if (end <= 0)
|
||||||
|
end = start + MaxNewsMessage - 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (start <= 0) {
|
if (start <= 0) {
|
||||||
start = first;
|
start = first;
|
||||||
end = last + 1;
|
end = last;
|
||||||
if (end - start > MaxNewsMessage)
|
if (end - start > MaxNewsMessage - 1)
|
||||||
start = end - MaxNewsMessage;
|
start = end - MaxNewsMessage + 1;
|
||||||
}
|
}
|
||||||
|
page = Sprintf("<title>Newsgroup: %s %d-%d</title>\n\
|
||||||
|
<h1>Newsgroup: %s %d-%d</h1>\n<hr>\n",
|
||||||
|
qgroup, start, end, qgroup, start, end);
|
||||||
if (start > first) {
|
if (start > first) {
|
||||||
i = start - MaxNewsMessage;
|
i = start - MaxNewsMessage;
|
||||||
if (i < first)
|
if (i < first)
|
||||||
i = first;
|
i = first;
|
||||||
Strcat(page, Sprintf("<a href=\"news:%s#%d\">[%d-%d]</a>\n",
|
Strcat(page, Sprintf("<a href=\"%s%s/%d-%d\">[%d-%d]</a>\n", scheme,
|
||||||
qgroup, i, i, start - 1));
|
qgroup, i, start - 1, i, start - 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
Strcat_charp(page, "<table>\n");
|
Strcat_charp(page, "<table>\n");
|
||||||
news_command(¤t_news, Sprintf("XOVER %d-%d", start, end - 1)->ptr,
|
news_command(¤t_news, Sprintf("XOVER %d-%d", start, end)->ptr,
|
||||||
&status);
|
&status);
|
||||||
if (status == 224) {
|
if (status == 224) {
|
||||||
f.scheme = SCM_NEWS;
|
f.scheme = SCM_NEWS;
|
||||||
@@ -360,13 +416,14 @@ readNewsgroup(ParsedURL *pu)
|
|||||||
*q = '\0';
|
*q = '\0';
|
||||||
s = convertLine(&f, decodeMIME(s), &code, HEADER_MODE)->ptr;
|
s = convertLine(&f, decodeMIME(s), &code, HEADER_MODE)->ptr;
|
||||||
n = convertLine(&f, decodeMIME(n), &code, HEADER_MODE)->ptr;
|
n = convertLine(&f, decodeMIME(n), &code, HEADER_MODE)->ptr;
|
||||||
add_news_message(page, i, t, n, s, p);
|
add_news_message(page, i, t, n, s, p, scheme,
|
||||||
|
pu->scheme == SCM_NNTP_GROUP ? qgroup : NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
init_stream(&f, SCM_NEWS, current_news.rf);
|
init_stream(&f, SCM_NEWS, current_news.rf);
|
||||||
buf = newBuffer(INIT_BUFFER_WIDTH);
|
buf = newBuffer(INIT_BUFFER_WIDTH);
|
||||||
for (i = start; i < end && i <= last; i++) {
|
for (i = start; i <= end && i <= last; i++) {
|
||||||
news_command(¤t_news, Sprintf("HEAD %d", i)->ptr, &status);
|
news_command(¤t_news, Sprintf("HEAD %d", i)->ptr, &status);
|
||||||
if (status != 221)
|
if (status != 221)
|
||||||
continue;
|
continue;
|
||||||
@@ -383,23 +440,26 @@ readNewsgroup(ParsedURL *pu)
|
|||||||
continue;
|
continue;
|
||||||
if (!(t = checkHeader(buf, "Date:")))
|
if (!(t = checkHeader(buf, "Date:")))
|
||||||
continue;
|
continue;
|
||||||
add_news_message(page, i, t, n, s, p);
|
add_news_message(page, i, t, n, s, p, scheme,
|
||||||
|
pu->scheme == SCM_NNTP_GROUP ? qgroup : NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Strcat_charp(page, "</table>\n");
|
Strcat_charp(page, "</table>\n");
|
||||||
|
|
||||||
if (end <= last) {
|
if (end < last) {
|
||||||
i = end + MaxNewsMessage - 1;
|
i = end + MaxNewsMessage;
|
||||||
if (i > last)
|
if (i > last)
|
||||||
i = last;
|
i = last;
|
||||||
Strcat(page, Sprintf("<a href=\"news:%s#%d\">[%d-%d]</a>\n",
|
Strcat(page, Sprintf("<a href=\"%s%s/%d-%d\">[%d-%d]</a>\n", scheme,
|
||||||
qgroup, end, end, i));
|
qgroup, end + 1, i, end + 1, i));
|
||||||
}
|
}
|
||||||
flag = 1;
|
flag = 1;
|
||||||
|
|
||||||
news_list:
|
news_list:
|
||||||
news_command(¤t_news, Sprintf("LIST ACTIVE %s.*", group)->ptr,
|
tmp = Sprintf("LIST ACTIVE %s", group);
|
||||||
&status);
|
if (!strchr(group, '*'))
|
||||||
|
Strcat_charp(tmp, ".*");
|
||||||
|
news_command(¤t_news, tmp->ptr, &status);
|
||||||
if (status != 215)
|
if (status != 215)
|
||||||
goto news_end;
|
goto news_end;
|
||||||
while (1) {
|
while (1) {
|
||||||
@@ -415,13 +475,14 @@ readNewsgroup(ParsedURL *pu)
|
|||||||
p = tmp->ptr;
|
p = tmp->ptr;
|
||||||
for (q = p; *q && !IS_SPACE(*q); q++) ;
|
for (q = p; *q && !IS_SPACE(*q); q++) ;
|
||||||
*(q++) = '\0';
|
*(q++) = '\0';
|
||||||
i = 0;
|
|
||||||
if (sscanf(q, "%d %d", &last, &first) == 2 && last >= first)
|
if (sscanf(q, "%d %d", &last, &first) == 2 && last >= first)
|
||||||
i = last - first + 1;
|
i = last - first + 1;
|
||||||
|
else
|
||||||
|
i = 0;
|
||||||
Strcat(page,
|
Strcat(page,
|
||||||
Sprintf
|
Sprintf
|
||||||
("<tr><td align=right>%d<td><a href=\"news:%s\">%s</a>\n", i,
|
("<tr><td align=right>%d<td><a href=\"%s%s\">%s</a>\n", i,
|
||||||
html_quote(file_quote(p)), html_quote(p)));
|
scheme, html_quote(file_quote(p)), html_quote(p)));
|
||||||
}
|
}
|
||||||
if (flag == 2)
|
if (flag == 2)
|
||||||
Strcat_charp(page, "</table>\n");
|
Strcat_charp(page, "</table>\n");
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
/* $Id: proto.h,v 1.75 2002/12/27 16:07:44 ukai Exp $ */
|
/* $Id: proto.h,v 1.76 2003/01/06 15:37:00 ukai Exp $ */
|
||||||
/*
|
/*
|
||||||
* This file was automatically generated by version 1.7 of cextract.
|
* This file was automatically generated by version 1.7 of cextract.
|
||||||
* Manual editing not recommended.
|
* Manual editing not recommended.
|
||||||
@@ -537,6 +537,7 @@ extern void reAnchorWord(Buffer *buf, Line *l, int spos, int epos);
|
|||||||
extern char *reAnchor(Buffer *buf, char *re);
|
extern char *reAnchor(Buffer *buf, char *re);
|
||||||
#ifdef USE_NNTP
|
#ifdef USE_NNTP
|
||||||
extern char *reAnchorNews(Buffer *buf, char *re);
|
extern char *reAnchorNews(Buffer *buf, char *re);
|
||||||
|
extern char *reAnchorNewsheader(Buffer *buf);
|
||||||
#endif /* USE_NNTP */
|
#endif /* USE_NNTP */
|
||||||
extern void addMultirowsForm(Buffer *buf, AnchorList *al);
|
extern void addMultirowsForm(Buffer *buf, AnchorList *al);
|
||||||
extern Anchor *closest_next_anchor(AnchorList *a, Anchor *an, int x, int y);
|
extern Anchor *closest_next_anchor(AnchorList *a, Anchor *an, int x, int y);
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
/* $Id: url.c,v 1.62 2002/12/27 16:30:54 ukai Exp $ */
|
/* $Id: url.c,v 1.63 2003/01/06 15:37:00 ukai Exp $ */
|
||||||
#include "fm.h"
|
#include "fm.h"
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
@@ -53,6 +53,7 @@ static int
|
|||||||
0, /* local-CGI - not defined? */
|
0, /* local-CGI - not defined? */
|
||||||
0, /* exec - not defined? */
|
0, /* exec - not defined? */
|
||||||
119, /* nntp */
|
119, /* nntp */
|
||||||
|
119, /* nntp group */
|
||||||
119, /* news */
|
119, /* news */
|
||||||
119, /* news group */
|
119, /* news group */
|
||||||
0, /* mailto - not defined */
|
0, /* mailto - not defined */
|
||||||
@@ -69,6 +70,7 @@ struct cmdtable schemetable[] = {
|
|||||||
{"file", SCM_LOCAL},
|
{"file", SCM_LOCAL},
|
||||||
/* {"exec", SCM_EXEC}, */
|
/* {"exec", SCM_EXEC}, */
|
||||||
{"nntp", SCM_NNTP},
|
{"nntp", SCM_NNTP},
|
||||||
|
/* {"nntp", SCM_NNTP_GROUP}, */
|
||||||
{"news", SCM_NEWS},
|
{"news", SCM_NEWS},
|
||||||
/* {"news", SCM_NEWS_GROUP}, */
|
/* {"news", SCM_NEWS_GROUP}, */
|
||||||
#ifndef USE_W3MMAILER
|
#ifndef USE_W3MMAILER
|
||||||
@@ -972,10 +974,26 @@ parseURL2(char *url, ParsedURL *pu, ParsedURL *current)
|
|||||||
return;
|
return;
|
||||||
#endif
|
#endif
|
||||||
if (pu->scheme == SCM_NEWS) {
|
if (pu->scheme == SCM_NEWS) {
|
||||||
if (pu->file && !strchr(pu->file, '@'))
|
if (pu->file && !strchr(pu->file, '@') &&
|
||||||
|
(!(p = strchr(pu->file, '/')) || strchr(p + 1, '-') ||
|
||||||
|
*(p + 1) == '\0'))
|
||||||
pu->scheme = SCM_NEWS_GROUP;
|
pu->scheme = SCM_NEWS_GROUP;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (pu->scheme == SCM_NNTP) {
|
||||||
|
if (pu->file && !strchr(pu->file, '@') &&
|
||||||
|
(!(p = strchr(pu->file + 1, '/')) || strchr(p + 1, '-') ||
|
||||||
|
*(p + 1) == '\0'))
|
||||||
|
pu->scheme = SCM_NNTP_GROUP;
|
||||||
|
if (current && (current->scheme == SCM_NNTP ||
|
||||||
|
current->scheme == SCM_NNTP_GROUP)) {
|
||||||
|
if (pu->host == NULL)
|
||||||
|
pu->host = current->host;
|
||||||
|
if (pu->port == NULL)
|
||||||
|
pu->port = current->port;
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (pu->scheme == SCM_LOCAL)
|
if (pu->scheme == SCM_LOCAL)
|
||||||
pu->file = expandName(pu->file);
|
pu->file = expandName(pu->file);
|
||||||
|
|
||||||
@@ -995,9 +1013,6 @@ parseURL2(char *url, ParsedURL *pu, ParsedURL *current)
|
|||||||
#ifdef USE_GOPHER
|
#ifdef USE_GOPHER
|
||||||
pu->scheme != SCM_GOPHER &&
|
pu->scheme != SCM_GOPHER &&
|
||||||
#endif /* USE_GOPHER */
|
#endif /* USE_GOPHER */
|
||||||
#ifdef USE_NNTP
|
|
||||||
pu->scheme != SCM_NEWS && pu->scheme != SCM_NEWS_GROUP &&
|
|
||||||
#endif /* USE_NNTP */
|
|
||||||
pu->file[0] != '/'
|
pu->file[0] != '/'
|
||||||
#ifdef SUPPORT_DOS_DRIVE_PREFIX
|
#ifdef SUPPORT_DOS_DRIVE_PREFIX
|
||||||
&& !(pu->scheme == SCM_LOCAL && IS_ALPHA(pu->file[0])
|
&& !(pu->scheme == SCM_LOCAL && IS_ALPHA(pu->file[0])
|
||||||
@@ -1076,9 +1091,6 @@ parseURL2(char *url, ParsedURL *pu, ParsedURL *current)
|
|||||||
#ifdef USE_GOPHER
|
#ifdef USE_GOPHER
|
||||||
pu->scheme != SCM_GOPHER &&
|
pu->scheme != SCM_GOPHER &&
|
||||||
#endif /* USE_GOPHER */
|
#endif /* USE_GOPHER */
|
||||||
#ifdef USE_NNTP
|
|
||||||
pu->scheme != SCM_NEWS && pu->scheme != SCM_NEWS_GROUP &&
|
|
||||||
#endif /* USE_NNTP */
|
|
||||||
pu->file[0] == '/') {
|
pu->file[0] == '/') {
|
||||||
/*
|
/*
|
||||||
* this happens on the following conditions:
|
* this happens on the following conditions:
|
||||||
@@ -1108,8 +1120,8 @@ _parsedURL2Str(ParsedURL *pu, int pass)
|
|||||||
{
|
{
|
||||||
Str tmp;
|
Str tmp;
|
||||||
static char *scheme_str[] = {
|
static char *scheme_str[] = {
|
||||||
"http", "gopher", "ftp", "ftp", "file", "file", "exec", "nntp", "news",
|
"http", "gopher", "ftp", "ftp", "file", "file", "exec", "nntp", "nntp",
|
||||||
"news", "mailto",
|
"news", "news", "mailto",
|
||||||
#ifdef USE_SSL
|
#ifdef USE_SSL
|
||||||
"https",
|
"https",
|
||||||
#endif /* USE_SSL */
|
#endif /* USE_SSL */
|
||||||
@@ -1766,16 +1778,14 @@ openURL(char *url, ParsedURL *pu, ParsedURL *current,
|
|||||||
#endif /* USE_GOPHER */
|
#endif /* USE_GOPHER */
|
||||||
#ifdef USE_NNTP
|
#ifdef USE_NNTP
|
||||||
case SCM_NNTP:
|
case SCM_NNTP:
|
||||||
/* nntp://<host>:<port>/<newsgroup-name>/<article-number> */
|
case SCM_NNTP_GROUP:
|
||||||
case SCM_NEWS:
|
case SCM_NEWS:
|
||||||
/* news:<unique>@<full_domain_name> */
|
|
||||||
case SCM_NEWS_GROUP:
|
case SCM_NEWS_GROUP:
|
||||||
/* news:<newsgroup-name> */
|
if (pu->scheme == SCM_NNTP || pu->scheme == SCM_NEWS)
|
||||||
uf.stream = openNewsStream(pu);
|
uf.scheme = SCM_NEWS;
|
||||||
if (uf.stream)
|
|
||||||
uf.scheme = SCM_NEWS; /* XXX */
|
|
||||||
else
|
else
|
||||||
uf.scheme = pu->scheme;
|
uf.scheme = SCM_NEWS_GROUP;
|
||||||
|
uf.stream = openNewsStream(pu);
|
||||||
return uf;
|
return uf;
|
||||||
#endif /* USE_NNTP */
|
#endif /* USE_NNTP */
|
||||||
case SCM_UNKNOWN:
|
case SCM_UNKNOWN:
|
||||||
|
|||||||
Reference in new issue
Block a user