From ff20968c8c0cbafa349495c791f700775d0e23af Mon Sep 17 00:00:00 2001 From: Fumitoshi UKAI Date: Mon, 6 Jan 2003 15:36:56 +0000 Subject: [w3m-dev 03610] Re: news: * 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 --- url.c | 44 +++++++++++++++++++++++++++----------------- 1 file changed, 27 insertions(+), 17 deletions(-) (limited to 'url.c') diff --git a/url.c b/url.c index 584b8b4..e0a6794 100644 --- a/url.c +++ b/url.c @@ -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 #include @@ -53,6 +53,7 @@ static int 0, /* local-CGI - not defined? */ 0, /* exec - not defined? */ 119, /* nntp */ + 119, /* nntp group */ 119, /* news */ 119, /* news group */ 0, /* mailto - not defined */ @@ -69,6 +70,7 @@ struct cmdtable schemetable[] = { {"file", SCM_LOCAL}, /* {"exec", SCM_EXEC}, */ {"nntp", SCM_NNTP}, + /* {"nntp", SCM_NNTP_GROUP}, */ {"news", SCM_NEWS}, /* {"news", SCM_NEWS_GROUP}, */ #ifndef USE_W3MMAILER @@ -972,10 +974,26 @@ parseURL2(char *url, ParsedURL *pu, ParsedURL *current) return; #endif 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; 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) pu->file = expandName(pu->file); @@ -995,9 +1013,6 @@ parseURL2(char *url, ParsedURL *pu, ParsedURL *current) #ifdef USE_GOPHER pu->scheme != SCM_GOPHER && #endif /* USE_GOPHER */ -#ifdef USE_NNTP - pu->scheme != SCM_NEWS && pu->scheme != SCM_NEWS_GROUP && -#endif /* USE_NNTP */ pu->file[0] != '/' #ifdef SUPPORT_DOS_DRIVE_PREFIX && !(pu->scheme == SCM_LOCAL && IS_ALPHA(pu->file[0]) @@ -1076,9 +1091,6 @@ parseURL2(char *url, ParsedURL *pu, ParsedURL *current) #ifdef USE_GOPHER pu->scheme != SCM_GOPHER && #endif /* USE_GOPHER */ -#ifdef USE_NNTP - pu->scheme != SCM_NEWS && pu->scheme != SCM_NEWS_GROUP && -#endif /* USE_NNTP */ pu->file[0] == '/') { /* * this happens on the following conditions: @@ -1108,8 +1120,8 @@ _parsedURL2Str(ParsedURL *pu, int pass) { Str tmp; static char *scheme_str[] = { - "http", "gopher", "ftp", "ftp", "file", "file", "exec", "nntp", "news", - "news", "mailto", + "http", "gopher", "ftp", "ftp", "file", "file", "exec", "nntp", "nntp", + "news", "news", "mailto", #ifdef USE_SSL "https", #endif /* USE_SSL */ @@ -1766,16 +1778,14 @@ openURL(char *url, ParsedURL *pu, ParsedURL *current, #endif /* USE_GOPHER */ #ifdef USE_NNTP case SCM_NNTP: - /* nntp://:// */ + case SCM_NNTP_GROUP: case SCM_NEWS: - /* news:@ */ case SCM_NEWS_GROUP: - /* news: */ - uf.stream = openNewsStream(pu); - if (uf.stream) - uf.scheme = SCM_NEWS; /* XXX */ + if (pu->scheme == SCM_NNTP || pu->scheme == SCM_NEWS) + uf.scheme = SCM_NEWS; else - uf.scheme = pu->scheme; + uf.scheme = SCM_NEWS_GROUP; + uf.stream = openNewsStream(pu); return uf; #endif /* USE_NNTP */ case SCM_UNKNOWN: -- cgit v1.2.3