|
|
@ -246,13 +246,12 @@ PRIVATE BOOL match ARGS2 (WWW_CONST char *,unknown, WWW_CONST char *,template)
|
|
|
|
Returns: pointer to em
|
|
|
|
Returns: pointer to em
|
|
|
|
|
|
|
|
|
|
|
|
Notes:
|
|
|
|
Notes:
|
|
|
|
Parse str for an email address and author name in the email@host (name)
|
|
|
|
Parse str for an email address and author name in the email@host (name)
|
|
|
|
or name <email@host> forms. This destroys the source string. If
|
|
|
|
or name <email@host> forms. This destroys the source string. If
|
|
|
|
either name of em is NULL, the value will not be returned.
|
|
|
|
either name of em is NULL, the value will not be returned.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
char *parseemail (char *str, char *name, char *em)
|
|
|
|
char *parseemail (char *str, char *name, char *em)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
char *c, d;
|
|
|
|
|
|
|
|
char *email, *end;
|
|
|
|
char *email, *end;
|
|
|
|
|
|
|
|
|
|
|
|
/* Pull out email address */
|
|
|
|
/* Pull out email address */
|
|
|
@ -400,14 +399,13 @@ static char b64_tab[256] = {
|
|
|
|
|
|
|
|
|
|
|
|
int base64line(FILE *fp, char *buf)
|
|
|
|
int base64line(FILE *fp, char *buf)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
int last_data = 0;
|
|
|
|
|
|
|
|
unsigned char *p = (unsigned char *) buf;
|
|
|
|
unsigned char *p = (unsigned char *) buf;
|
|
|
|
|
|
|
|
|
|
|
|
if(!buf || !*buf || isspace(*buf)){
|
|
|
|
if(!buf || !*buf || isspace(*buf)){
|
|
|
|
fclose(fp);
|
|
|
|
fclose(fp);
|
|
|
|
return 1;
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* The following implementation of the base64 decoding might look
|
|
|
|
/* The following implementation of the base64 decoding might look
|
|
|
|
a bit clumsy but I only try to follow the POSIX standard:
|
|
|
|
a bit clumsy but I only try to follow the POSIX standard:
|
|
|
|
``All line breaks or other characters not found in the table
|
|
|
|
``All line breaks or other characters not found in the table
|
|
|
@ -416,35 +414,34 @@ int base64line(FILE *fp, char *buf)
|
|
|
|
while (*p){
|
|
|
|
while (*p){
|
|
|
|
char c1, c2, c3;
|
|
|
|
char c1, c2, c3;
|
|
|
|
|
|
|
|
|
|
|
|
while ((b64_tab[*p] & '\100') != 0)
|
|
|
|
while ((b64_tab[*p] & '\100') != 0)
|
|
|
|
if (!*p || *p++ == '=') break;
|
|
|
|
if (!*p || *p++ == '=') break;
|
|
|
|
|
|
|
|
|
|
|
|
if (!*p) continue; /* This leaves the loop. */
|
|
|
|
if (!*p) continue; /* This leaves the loop. */
|
|
|
|
|
|
|
|
|
|
|
|
c1 = b64_tab[*p++];
|
|
|
|
c1 = b64_tab[*p++];
|
|
|
|
|
|
|
|
|
|
|
|
while ((b64_tab[*p] & '\100') != 0) {
|
|
|
|
while ((b64_tab[*p] & '\100') != 0) {
|
|
|
|
if (!*p || *p++ == '=') {
|
|
|
|
if (!*p || *p++ == '=') {
|
|
|
|
HTProgress("illegal base64 line");
|
|
|
|
HTProgress("illegal base64 line");
|
|
|
|
return 1;
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
c2 = b64_tab[*p++];
|
|
|
|
c2 = b64_tab[*p++];
|
|
|
|
|
|
|
|
|
|
|
|
while (b64_tab[*p] == '\177') {
|
|
|
|
while (b64_tab[*p] == '\177') {
|
|
|
|
if (!*p++) {
|
|
|
|
if (!*p++) {
|
|
|
|
HTProgress("illegal base64 line");
|
|
|
|
HTProgress("illegal base64 line");
|
|
|
|
return 1;
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (*p == '=') {
|
|
|
|
if (*p == '=') {
|
|
|
|
fputc(c1 << 2 | c2 >> 4,fp);
|
|
|
|
fputc(c1 << 2 | c2 >> 4,fp);
|
|
|
|
last_data = 1;
|
|
|
|
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
c3 = b64_tab[*p++];
|
|
|
|
c3 = b64_tab[*p++];
|
|
|
|
|
|
|
|
|
|
|
|
while (b64_tab[*p] == '\177') {
|
|
|
|
while (b64_tab[*p] == '\177') {
|
|
|
@ -453,7 +450,7 @@ int base64line(FILE *fp, char *buf)
|
|
|
|
return 1;
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
fputc(c1 << 2 | c2 >> 4,fp);
|
|
|
|
fputc(c1 << 2 | c2 >> 4,fp);
|
|
|
|
fputc(c2 << 4 | c3 >> 2,fp);
|
|
|
|
fputc(c2 << 4 | c3 >> 2,fp);
|
|
|
|
if (*p == '=') {
|
|
|
|
if (*p == '=') {
|
|
|
@ -464,7 +461,7 @@ int base64line(FILE *fp, char *buf)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*******************************************************/
|
|
|
|
/*******************************************************/
|
|
|
@ -491,7 +488,7 @@ void freeart(NewsArt *art)
|
|
|
|
PRIVATE void ClearArtList NOARGS
|
|
|
|
PRIVATE void ClearArtList NOARGS
|
|
|
|
{
|
|
|
|
{
|
|
|
|
NewsArt *temp,*tnext,*temp2,*tnext2;
|
|
|
|
NewsArt *temp,*tnext,*temp2,*tnext2;
|
|
|
|
|
|
|
|
|
|
|
|
temp = FirstArt;
|
|
|
|
temp = FirstArt;
|
|
|
|
while(temp) {
|
|
|
|
while(temp) {
|
|
|
|
tnext = temp->nextt;
|
|
|
|
tnext = temp->nextt;
|
|
|
@ -539,7 +536,7 @@ PRIVATE NewsArt *NewArt NOARGS
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* AddArtTop ()
|
|
|
|
/* AddArtTop ()
|
|
|
|
Add an Article to the thread chain
|
|
|
|
Add an Article to the thread chain
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
PRIVATE void AddArtTop ARGS1(WWW_CONST NewsArt *, add)
|
|
|
|
PRIVATE void AddArtTop ARGS1(WWW_CONST NewsArt *, add)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -574,7 +571,7 @@ PRIVATE void AddArtTop ARGS1(WWW_CONST NewsArt *, add)
|
|
|
|
add->prevt = add->nextt = NULL;
|
|
|
|
add->prevt = add->nextt = NULL;
|
|
|
|
add->next = NULL;
|
|
|
|
add->next = NULL;
|
|
|
|
add->prev = temp;
|
|
|
|
add->prev = temp;
|
|
|
|
|
|
|
|
|
|
|
|
temp->next = add;
|
|
|
|
temp->next = add;
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
/* Otherwise, tack it onto the back of the list */
|
|
|
|
/* Otherwise, tack it onto the back of the list */
|
|
|
@ -846,12 +843,12 @@ PRIVATE int OpenNNTP NOARGS
|
|
|
|
if ((response(NULL) / 100) !=2) {
|
|
|
|
if ((response(NULL) / 100) !=2) {
|
|
|
|
NETCLOSE(s);
|
|
|
|
NETCLOSE(s);
|
|
|
|
s = -1;
|
|
|
|
s = -1;
|
|
|
|
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Interface with news-gui.c and various others... */
|
|
|
|
/* Interface with news-gui.c and various others... */
|
|
|
@ -865,7 +862,7 @@ static char qline[LINE_LENGTH+1];
|
|
|
|
char *NNTPgetquoteline(char *art)
|
|
|
|
char *NNTPgetquoteline(char *art)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
char *p;
|
|
|
|
char *p;
|
|
|
|
int i,f,status ;
|
|
|
|
int i,status;
|
|
|
|
|
|
|
|
|
|
|
|
if (!initialized)
|
|
|
|
if (!initialized)
|
|
|
|
initialized = initialize();
|
|
|
|
initialized = initialize();
|
|
|
@ -876,7 +873,7 @@ char *NNTPgetquoteline(char *art)
|
|
|
|
HTProgress ("Could not set up news connection.");
|
|
|
|
HTProgress ("Could not set up news connection.");
|
|
|
|
return NULL;
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if(s < 0) {
|
|
|
|
if(s < 0) {
|
|
|
|
HTProgress("Attempting to connect to news server");
|
|
|
|
HTProgress("Attempting to connect to news server");
|
|
|
|
if(OpenNNTP()){
|
|
|
|
if(OpenNNTP()){
|
|
|
@ -893,7 +890,7 @@ char *NNTPgetquoteline(char *art)
|
|
|
|
HTInitInput(s);
|
|
|
|
HTInitInput(s);
|
|
|
|
sprintf(qline, "BODY <%s>%c%c", art, CR, LF);
|
|
|
|
sprintf(qline, "BODY <%s>%c%c", art, CR, LF);
|
|
|
|
status = response(qline);
|
|
|
|
status = response(qline);
|
|
|
|
|
|
|
|
|
|
|
|
if (status != 222) return NULL;
|
|
|
|
if (status != 222) return NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -957,9 +954,9 @@ int NNTPgetarthdrs(char *art,char **ref, char **grp, char **subj, char **from)
|
|
|
|
HTInitInput(s);
|
|
|
|
HTInitInput(s);
|
|
|
|
sprintf(buffer, "HEAD <%s>%c%c", art, CR, LF);
|
|
|
|
sprintf(buffer, "HEAD <%s>%c%c", art, CR, LF);
|
|
|
|
status = response(buffer);
|
|
|
|
status = response(buffer);
|
|
|
|
|
|
|
|
|
|
|
|
if (status == 221) { /* Head follows - parse it:*/
|
|
|
|
if (status == 221) { /* Head follows - parse it:*/
|
|
|
|
|
|
|
|
|
|
|
|
p = line; /* Write pointer */
|
|
|
|
p = line; /* Write pointer */
|
|
|
|
done = NO;
|
|
|
|
done = NO;
|
|
|
|
while(!done){
|
|
|
|
while(!done){
|
|
|
@ -968,27 +965,27 @@ int NNTPgetarthdrs(char *art,char **ref, char **grp, char **subj, char **from)
|
|
|
|
abort_socket(); /* End of file, close socket */
|
|
|
|
abort_socket(); /* End of file, close socket */
|
|
|
|
return -1; /* End of file on response */
|
|
|
|
return -1; /* End of file on response */
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if ((ch == LF)
|
|
|
|
if ((ch == LF)
|
|
|
|
|| (p == &line[LINE_LENGTH]) ) {
|
|
|
|
|| (p == &line[LINE_LENGTH]) ) {
|
|
|
|
|
|
|
|
|
|
|
|
*--p=0; /* Terminate & chop LF*/
|
|
|
|
*--p=0; /* Terminate & chop LF*/
|
|
|
|
p = line; /* Restart at beginning */
|
|
|
|
p = line; /* Restart at beginning */
|
|
|
|
#ifndef DISABLE_TRACE
|
|
|
|
#ifndef DISABLE_TRACE
|
|
|
|
if (www2Trace) fprintf(stderr, "G %s\n", line);
|
|
|
|
if (www2Trace) fprintf(stderr, "G %s\n", line);
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
switch(line[0]) {
|
|
|
|
switch(line[0]) {
|
|
|
|
|
|
|
|
|
|
|
|
case '.':
|
|
|
|
case '.':
|
|
|
|
done = (line[1]<' '); /* End of article? */
|
|
|
|
done = (line[1]<' '); /* End of article? */
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
case 'S':
|
|
|
|
case 'S':
|
|
|
|
case 's':
|
|
|
|
case 's':
|
|
|
|
if (match(line, "SUBJECT:"))
|
|
|
|
if (match(line, "SUBJECT:"))
|
|
|
|
StrAllocCopy(*subj, line+9);/* Save subject */
|
|
|
|
StrAllocCopy(*subj, line+9);/* Save subject */
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
case 'R':
|
|
|
|
case 'R':
|
|
|
|
case 'r':
|
|
|
|
case 'r':
|
|
|
|
if (match(line, "REFERENCES:")) {
|
|
|
|
if (match(line, "REFERENCES:")) {
|
|
|
@ -996,7 +993,7 @@ int NNTPgetarthdrs(char *art,char **ref, char **grp, char **subj, char **from)
|
|
|
|
StrAllocCopy(*ref,p+1);
|
|
|
|
StrAllocCopy(*ref,p+1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
case 'N':
|
|
|
|
case 'N':
|
|
|
|
case 'n':
|
|
|
|
case 'n':
|
|
|
|
if (match(line, "NEWSGROUPS:")) {
|
|
|
|
if (match(line, "NEWSGROUPS:")) {
|
|
|
@ -1004,7 +1001,7 @@ int NNTPgetarthdrs(char *art,char **ref, char **grp, char **subj, char **from)
|
|
|
|
StrAllocCopy(*grp,p+1);
|
|
|
|
StrAllocCopy(*grp,p+1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
case 'f':
|
|
|
|
case 'f':
|
|
|
|
case 'F':
|
|
|
|
case 'F':
|
|
|
|
if (match(line, "FROM:")) {
|
|
|
|
if (match(line, "FROM:")) {
|
|
|
@ -1020,9 +1017,9 @@ int NNTPgetarthdrs(char *art,char **ref, char **grp, char **subj, char **from)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
} /* end switch on first character */
|
|
|
|
} /* end switch on first character */
|
|
|
|
|
|
|
|
|
|
|
|
p = line; /* Restart at beginning */
|
|
|
|
p = line; /* Restart at beginning */
|
|
|
|
} /* if end of line */
|
|
|
|
} /* if end of line */
|
|
|
|
} /* Loop over characters */
|
|
|
|
} /* Loop over characters */
|
|
|
@ -1034,7 +1031,7 @@ int NNTPgetarthdrs(char *art,char **ref, char **grp, char **subj, char **from)
|
|
|
|
int NNTPpost(char *from, char *subj, char *ref, char *groups, char *msg)
|
|
|
|
int NNTPpost(char *from, char *subj, char *ref, char *groups, char *msg)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
char buf[1024];
|
|
|
|
char buf[1024];
|
|
|
|
|
|
|
|
|
|
|
|
if (!initialized)
|
|
|
|
if (!initialized)
|
|
|
|
initialized = initialize();
|
|
|
|
initialized = initialize();
|
|
|
|
if (!initialized){
|
|
|
|
if (!initialized){
|
|
|
@ -1044,7 +1041,7 @@ int NNTPpost(char *from, char *subj, char *ref, char *groups, char *msg)
|
|
|
|
HTProgress ("Could not set up news connection.");
|
|
|
|
HTProgress ("Could not set up news connection.");
|
|
|
|
return HT_NOT_LOADED; /* FAIL */
|
|
|
|
return HT_NOT_LOADED; /* FAIL */
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if(s < 0) {
|
|
|
|
if(s < 0) {
|
|
|
|
HTProgress("Attempting to connect to news server");
|
|
|
|
HTProgress("Attempting to connect to news server");
|
|
|
|
if(OpenNNTP()){
|
|
|
|
if(OpenNNTP()){
|
|
|
@ -1055,7 +1052,7 @@ int NNTPpost(char *from, char *subj, char *ref, char *groups, char *msg)
|
|
|
|
return HT_NOT_LOADED; /* FAIL */
|
|
|
|
return HT_NOT_LOADED; /* FAIL */
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if(response("POST\r\n") != 340) {
|
|
|
|
if(response("POST\r\n") != 340) {
|
|
|
|
HTProgress("Server does not allow posting.");
|
|
|
|
HTProgress("Server does not allow posting.");
|
|
|
|
return 0;
|
|
|
|
return 0;
|
|
|
@ -1113,10 +1110,10 @@ NewsArt *is_news_url(char *s)
|
|
|
|
/* These are called by their gui_news_* counterparts in gui-news.c */
|
|
|
|
/* These are called by their gui_news_* counterparts in gui-news.c */
|
|
|
|
|
|
|
|
|
|
|
|
/* Beginning in 2.7b4, these now return the next/prev unread article/thread ,
|
|
|
|
/* Beginning in 2.7b4, these now return the next/prev unread article/thread ,
|
|
|
|
unless newsShowAllArticles is True. The previous unread article/thread
|
|
|
|
unless newsShowAllArticles is True. The previous unread article/thread
|
|
|
|
is set in the news_next functions.
|
|
|
|
is set in the news_next functions.
|
|
|
|
|
|
|
|
|
|
|
|
news_next will now continue onto the next thread unless newsNoThreadJumping
|
|
|
|
news_next will now continue onto the next thread unless newsNoThreadJumping
|
|
|
|
is True.
|
|
|
|
is True.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
@ -1124,7 +1121,7 @@ NewsArt *nextUnreadThread (NewsArt *art);
|
|
|
|
NewsArt *prevUnreadThread (NewsArt *art);
|
|
|
|
NewsArt *prevUnreadThread (NewsArt *art);
|
|
|
|
|
|
|
|
|
|
|
|
/* Return first unread article in list (thread) */
|
|
|
|
/* Return first unread article in list (thread) */
|
|
|
|
NewsArt *firstUnread (NewsArt *art)
|
|
|
|
NewsArt *firstUnread (NewsArt *art)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
NewsArt *a;
|
|
|
|
NewsArt *a;
|
|
|
|
newsgroup_t *tempNewsGroupS = NULL;
|
|
|
|
newsgroup_t *tempNewsGroupS = NULL;
|
|
|
@ -1148,7 +1145,7 @@ NewsArt *firstUnread (NewsArt *art)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* return next unread article after art */
|
|
|
|
/* return next unread article after art */
|
|
|
|
NewsArt *nextUnread (NewsArt *art, int probe)
|
|
|
|
NewsArt *nextUnread (NewsArt *art, int probe)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
NewsArt *a;
|
|
|
|
NewsArt *a;
|
|
|
|
newsgroup_t *tempNewsGroupS = NULL;
|
|
|
|
newsgroup_t *tempNewsGroupS = NULL;
|
|
|
@ -1175,11 +1172,11 @@ NewsArt *nextUnread (NewsArt *art, int probe)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Return first unread thread in list */
|
|
|
|
/* Return first unread thread in list */
|
|
|
|
NewsArt *firstUnreadThread (NewsArt *art)
|
|
|
|
NewsArt *firstUnreadThread (NewsArt *art)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
NewsArt *t, *a;
|
|
|
|
NewsArt *t, *a;
|
|
|
|
|
|
|
|
|
|
|
|
if (!art)
|
|
|
|
if (!art)
|
|
|
|
return NULL;
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
|
|
|
|
if (!newsUseNewsRC || newsShowAllArticles || !newsNextIsUnread)
|
|
|
|
if (!newsUseNewsRC || newsShowAllArticles || !newsNextIsUnread)
|
|
|
@ -1196,7 +1193,7 @@ NewsArt *firstUnreadThread (NewsArt *art)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Return next unread thread in list */
|
|
|
|
/* Return next unread thread in list */
|
|
|
|
NewsArt *nextUnreadThread (NewsArt *art)
|
|
|
|
NewsArt *nextUnreadThread (NewsArt *art)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
NewsArt *t;
|
|
|
|
NewsArt *t;
|
|
|
|
|
|
|
|
|
|
|
@ -1265,15 +1262,15 @@ NewsArt *prevUnreadThread (NewsArt *art)
|
|
|
|
|
|
|
|
|
|
|
|
/* Goto the previous (unread) thread */
|
|
|
|
/* Goto the previous (unread) thread */
|
|
|
|
void news_prevt(char *url)
|
|
|
|
void news_prevt(char *url)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
NewsArt *art, *p;
|
|
|
|
NewsArt *art, *p;
|
|
|
|
|
|
|
|
|
|
|
|
if (art = is_news_url (url)) {
|
|
|
|
if (art = is_news_url (url)) {
|
|
|
|
if ((p = prevUnreadThread (art)) != NULL) {
|
|
|
|
if ((p = prevUnreadThread (art)) != NULL) {
|
|
|
|
sprintf (url, "news:%s", p->ID);
|
|
|
|
sprintf (url, "news:%s", p->ID);
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
url[0] = 0;
|
|
|
|
url[0] = 0;
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -1282,7 +1279,7 @@ void news_prevt(char *url)
|
|
|
|
void news_nextt(char *url)
|
|
|
|
void news_nextt(char *url)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
NewsArt *art, *p;
|
|
|
|
NewsArt *art, *p;
|
|
|
|
|
|
|
|
|
|
|
|
if ((art = is_news_url(url)) != NULL) {
|
|
|
|
if ((art = is_news_url(url)) != NULL) {
|
|
|
|
if ((p=nextUnreadThread (art))) {
|
|
|
|
if ((p=nextUnreadThread (art))) {
|
|
|
|
sprintf (url, "news:%s", p->ID);
|
|
|
|
sprintf (url, "news:%s", p->ID);
|
|
|
@ -1299,7 +1296,7 @@ void news_prev(char *url)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
NewsArt *art, *p;
|
|
|
|
NewsArt *art, *p;
|
|
|
|
|
|
|
|
|
|
|
|
if ((art = is_news_url(url)) == NULL) {
|
|
|
|
if ((art = is_news_url(url)) == NULL) {
|
|
|
|
url[0] = 0;
|
|
|
|
url[0] = 0;
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -1347,24 +1344,24 @@ void news_index(char *url)
|
|
|
|
/* Returns the status of the news buttons */
|
|
|
|
/* Returns the status of the news buttons */
|
|
|
|
void news_status(char *url, int *prevt, int *nextt, int *prev, int *next, int *follow)
|
|
|
|
void news_status(char *url, int *prevt, int *nextt, int *prev, int *next, int *follow)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
NewsArt *art,*tmp;
|
|
|
|
NewsArt *art;
|
|
|
|
|
|
|
|
|
|
|
|
if( art = is_news_url(url) ) {
|
|
|
|
if( art = is_news_url(url) ) {
|
|
|
|
if(prevUnread(art,!newsNoThreadJumping))
|
|
|
|
if(prevUnread(art,!newsNoThreadJumping))
|
|
|
|
*prev = 1;
|
|
|
|
*prev = 1;
|
|
|
|
else
|
|
|
|
else
|
|
|
|
*prev = 0;
|
|
|
|
*prev = 0;
|
|
|
|
|
|
|
|
|
|
|
|
if(prevUnreadThread(art))
|
|
|
|
if(prevUnreadThread(art))
|
|
|
|
*prevt = 1;
|
|
|
|
*prevt = 1;
|
|
|
|
else
|
|
|
|
else
|
|
|
|
*prevt = 0;
|
|
|
|
*prevt = 0;
|
|
|
|
|
|
|
|
|
|
|
|
if (nextUnread (art,!newsNoThreadJumping))
|
|
|
|
if (nextUnread (art,!newsNoThreadJumping))
|
|
|
|
*next = 1;
|
|
|
|
*next = 1;
|
|
|
|
else
|
|
|
|
else
|
|
|
|
*next = 0;
|
|
|
|
*next = 0;
|
|
|
|
|
|
|
|
|
|
|
|
if (nextUnreadThread (art))
|
|
|
|
if (nextUnreadThread (art))
|
|
|
|
*nextt = 1;
|
|
|
|
*nextt = 1;
|
|
|
|
else
|
|
|
|
else
|
|
|
@ -1389,7 +1386,7 @@ void news_status(char *url, int *prevt, int *nextt, int *prev, int *next, int *f
|
|
|
|
|
|
|
|
|
|
|
|
Returns: pointer to a static spaces string, each call to make spaces will
|
|
|
|
Returns: pointer to a static spaces string, each call to make spaces will
|
|
|
|
overwrite this buffer.
|
|
|
|
overwrite this buffer.
|
|
|
|
|
|
|
|
|
|
|
|
Notes: this takes the string in str and makes a string of spaces that will
|
|
|
|
Notes: this takes the string in str and makes a string of spaces that will
|
|
|
|
(when concatenated with str) form a string len spaces long.
|
|
|
|
(when concatenated with str) form a string len spaces long.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
@ -1435,21 +1432,21 @@ PRIVATE void read_article ARGS1 (char *, artID)
|
|
|
|
char *references=NULL; /* Hrefs for other articles */
|
|
|
|
char *references=NULL; /* Hrefs for other articles */
|
|
|
|
char *newsgroups=NULL; /* Newsgroups list */
|
|
|
|
char *newsgroups=NULL; /* Newsgroups list */
|
|
|
|
char *from=NULL,*subj=NULL,*org=NULL,*date=NULL;
|
|
|
|
char *from=NULL,*subj=NULL,*org=NULL,*date=NULL;
|
|
|
|
char *filename;
|
|
|
|
char *filename=NULL;
|
|
|
|
char *l = line;
|
|
|
|
char *l = line;
|
|
|
|
int f; /* ':' flag */
|
|
|
|
int f; /* ':' flag */
|
|
|
|
int decode=0; /*uudecoding...*/
|
|
|
|
int decode=0; /*uudecoding...*/
|
|
|
|
FILE *fp;
|
|
|
|
FILE *fp = NULL;
|
|
|
|
|
|
|
|
|
|
|
|
char *p = line,*pp,*m;
|
|
|
|
char *p = line,*pp,*m;
|
|
|
|
BOOL done = NO;
|
|
|
|
BOOL done = NO;
|
|
|
|
|
|
|
|
|
|
|
|
NewsArt *art,*art2,*art_t, *next;
|
|
|
|
NewsArt *art,*art2,*next;
|
|
|
|
int ll;
|
|
|
|
int ll;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
HTMeter(0,NULL);
|
|
|
|
HTMeter(0,NULL);
|
|
|
|
|
|
|
|
|
|
|
|
ll= strlen(artID)-3; /* ">\n\r" should be stripped outside !!! */
|
|
|
|
ll= strlen(artID)-3; /* ">\n\r" should be stripped outside !!! */
|
|
|
|
for(art = FirstArt; art; art = art -> nextt){
|
|
|
|
for(art = FirstArt; art; art = art -> nextt){
|
|
|
|
if(!strncmp(art->ID,artID,ll)) break;
|
|
|
|
if(!strncmp(art->ID,artID,ll)) break;
|
|
|
@ -1462,16 +1459,16 @@ PRIVATE void read_article ARGS1 (char *, artID)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if(art) {
|
|
|
|
if(art) {
|
|
|
|
CurrentArt = art;
|
|
|
|
CurrentArt = art;
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
CurrentArt = NULL;
|
|
|
|
CurrentArt = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Read in the HEADer of the article:
|
|
|
|
/* Read in the HEADer of the article:
|
|
|
|
**
|
|
|
|
**
|
|
|
|
** The header fields are either ignored, or formatted
|
|
|
|
** The header fields are either ignored, or formatted
|
|
|
|
** and put into the text.
|
|
|
|
** and put into the text.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
while(!done){
|
|
|
|
while(!done){
|
|
|
@ -1480,7 +1477,7 @@ PRIVATE void read_article ARGS1 (char *, artID)
|
|
|
|
abort_socket(); /* End of file, close socket */
|
|
|
|
abort_socket(); /* End of file, close socket */
|
|
|
|
return; /* End of file on response */
|
|
|
|
return; /* End of file on response */
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if ((ch == LF) || (p == &line[LINE_LENGTH])) {
|
|
|
|
if ((ch == LF) || (p == &line[LINE_LENGTH])) {
|
|
|
|
*--p=0; /* Terminate the string */
|
|
|
|
*--p=0; /* Terminate the string */
|
|
|
|
#ifndef DISABLE_TRACE
|
|
|
|
#ifndef DISABLE_TRACE
|
|
|
|
if (www2Trace) fprintf(stderr, "H %s\n", line);
|
|
|
|
if (www2Trace) fprintf(stderr, "H %s\n", line);
|
|
|
@ -1529,16 +1526,16 @@ PRIVATE void read_article ARGS1 (char *, artID)
|
|
|
|
references = strdup(&line[11]);
|
|
|
|
references = strdup(&line[11]);
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
default:
|
|
|
|
|
|
|
|
|
|
|
|
/* unknown headers ignored */
|
|
|
|
/* unknown headers ignored */
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
p = line; /* Restart at beginning */
|
|
|
|
p = line; /* Restart at beginning */
|
|
|
|
} /* if end of line */
|
|
|
|
} /* if end of line */
|
|
|
|
} /* Loop over characters */
|
|
|
|
} /* Loop over characters */
|
|
|
|
|
|
|
|
|
|
|
|
if(subj) {
|
|
|
|
if(subj) {
|
|
|
|
PUTS("<H2>");
|
|
|
|
PUTS("<H2>");
|
|
|
|
PUTS(subj);
|
|
|
|
PUTS(subj);
|
|
|
@ -1557,15 +1554,15 @@ PRIVATE void read_article ARGS1 (char *, artID)
|
|
|
|
PUTS(", ");
|
|
|
|
PUTS(", ");
|
|
|
|
PUTS(org);
|
|
|
|
PUTS(org);
|
|
|
|
free(org);
|
|
|
|
free(org);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
PUTS("</I><BR>\n");
|
|
|
|
PUTS("</I><BR>\n");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(from) {
|
|
|
|
if(from) {
|
|
|
|
PUTS("<B>From:</B> <I>");
|
|
|
|
PUTS("<B>From:</B> <I>");
|
|
|
|
if (parseemail (from,duff,buf)) {
|
|
|
|
if (parseemail (from,duff,buf)) {
|
|
|
|
sprintf (line, "<A HREF=\"mailto:%s\"> %s </A> ", buf, duff);
|
|
|
|
sprintf (line, "<A HREF=\"mailto:%s\"> %s </A> ", buf, duff);
|
|
|
|
PUTS (line);
|
|
|
|
PUTS (line);
|
|
|
|
} else
|
|
|
|
} else
|
|
|
|
PUTS (from);
|
|
|
|
PUTS (from);
|
|
|
|
PUTS("</I><BR>");
|
|
|
|
PUTS("</I><BR>");
|
|
|
|
free(from);
|
|
|
|
free(from);
|
|
|
@ -1592,7 +1589,7 @@ PRIVATE void read_article ARGS1 (char *, artID)
|
|
|
|
PUTS(line);
|
|
|
|
PUTS(line);
|
|
|
|
i++;
|
|
|
|
i++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(!*p) break;
|
|
|
|
if(!*p) break;
|
|
|
@ -1601,18 +1598,18 @@ PRIVATE void read_article ARGS1 (char *, artID)
|
|
|
|
free(references);
|
|
|
|
free(references);
|
|
|
|
PUTS("</I><BR>\n");
|
|
|
|
PUTS("</I><BR>\n");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if(linecount) {
|
|
|
|
if(linecount) {
|
|
|
|
lineinc = linecount/100;
|
|
|
|
lineinc = linecount/100;
|
|
|
|
if(lineinc < 1) lineinc = 1;
|
|
|
|
if(lineinc < 1) lineinc = 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
PUTS("<HR>\n");
|
|
|
|
PUTS("<HR>\n");
|
|
|
|
|
|
|
|
|
|
|
|
/* Read in the BODY of the Article:
|
|
|
|
/* Read in the BODY of the Article:
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
(*targetClass.start_element)(target, HTML_PRE , 0, 0);
|
|
|
|
(*targetClass.start_element)(target, HTML_PRE , 0, 0);
|
|
|
|
|
|
|
|
|
|
|
|
p = line;
|
|
|
|
p = line;
|
|
|
|
done = 0;
|
|
|
|
done = 0;
|
|
|
|
while(!done){
|
|
|
|
while(!done){
|
|
|
@ -1808,15 +1805,15 @@ PRIVATE void read_article ARGS1 (char *, artID)
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
p = line; /* Restart at beginning */
|
|
|
|
p = line; /* Restart at beginning */
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
} /* Loop over characters */
|
|
|
|
} /* Loop over characters */
|
|
|
|
|
|
|
|
|
|
|
|
(*targetClass.end_element)(target, HTML_PRE);
|
|
|
|
(*targetClass.end_element)(target, HTML_PRE);
|
|
|
|
|
|
|
|
|
|
|
|
/* Mark this article read in all the groups we care about
|
|
|
|
/* Mark this article read in all the groups we care about
|
|
|
|
Also figure out the next article to read
|
|
|
|
Also figure out the next article to read
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
if ((next = nextUnread (CurrentArt,0)) == NULL) {
|
|
|
|
if ((next = nextUnread (CurrentArt,0)) == NULL) {
|
|
|
|
if ((next = nextUnreadThread (CurrentArt)) == NULL) {
|
|
|
|
if ((next = nextUnreadThread (CurrentArt)) == NULL) {
|
|
|
|
next = CurrentArt;
|
|
|
|
next = CurrentArt;
|
|
|
@ -1828,7 +1825,7 @@ PRIVATE void read_article ARGS1 (char *, artID)
|
|
|
|
|
|
|
|
|
|
|
|
NextArt = next;
|
|
|
|
NextArt = next;
|
|
|
|
if (CurrentArt) {
|
|
|
|
if (CurrentArt) {
|
|
|
|
char *tok, d, *last;
|
|
|
|
char *tok;
|
|
|
|
newsgroup_t *ng;
|
|
|
|
newsgroup_t *ng;
|
|
|
|
|
|
|
|
|
|
|
|
if (newsgroups) {
|
|
|
|
if (newsgroups) {
|
|
|
@ -1840,12 +1837,12 @@ PRIVATE void read_article ARGS1 (char *, artID)
|
|
|
|
tok = strtok (NULL, ", ;:\t\n");
|
|
|
|
tok = strtok (NULL, ", ;:\t\n");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else if (NewsGroup) {
|
|
|
|
} else if (NewsGroup) {
|
|
|
|
if (ng = findgroup (NewsGroup)) {
|
|
|
|
if (ng = findgroup (NewsGroup)) {
|
|
|
|
markread (ng, CurrentArt->num);
|
|
|
|
markread (ng, CurrentArt->num);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
HTMeter(100,NULL);
|
|
|
|
HTMeter(100,NULL);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -1861,19 +1858,18 @@ PRIVATE void read_article ARGS1 (char *, artID)
|
|
|
|
do not handle it here.
|
|
|
|
do not handle it here.
|
|
|
|
2.7b4: Added support for newsrc and subscribed news.
|
|
|
|
2.7b4: Added support for newsrc and subscribed news.
|
|
|
|
2.7b5: Made it faster.
|
|
|
|
2.7b5: Made it faster.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
PRIVATE void read_list NOARGS
|
|
|
|
PRIVATE void read_list NOARGS
|
|
|
|
{
|
|
|
|
{
|
|
|
|
char line[LINE_LENGTH+1], group[LINE_LENGTH], elgroup[LINE_LENGTH],
|
|
|
|
char line[LINE_LENGTH+1], group[LINE_LENGTH], elgroup[LINE_LENGTH],
|
|
|
|
postable, *p;
|
|
|
|
postable, *p;
|
|
|
|
int first, last, junk, m=0, next_m=20, done=0, intr, g=0, next_g = 50, l=0, lastg=0,mark=0;
|
|
|
|
int first, last, junk, m=0, next_m=20, done=0, intr, g=0, next_g = 50, l=0, lastg=0,mark=0;
|
|
|
|
newsgroup_t *n=NULL, *nn=NULL;
|
|
|
|
newsgroup_t *n=NULL, *nn=NULL;
|
|
|
|
extern int twirl_increment;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
START (HTML_TITLE);
|
|
|
|
START (HTML_TITLE);
|
|
|
|
PUTS ("Newsgroup Listing");
|
|
|
|
PUTS ("Newsgroup Listing");
|
|
|
|
END (HTML_TITLE);
|
|
|
|
END (HTML_TITLE);
|
|
|
|
|
|
|
|
|
|
|
|
HTMeter (0,NULL);
|
|
|
|
HTMeter (0,NULL);
|
|
|
|
HTProgress ("Getting newsgroup information from NNTP server");
|
|
|
|
HTProgress ("Getting newsgroup information from NNTP server");
|
|
|
|
|
|
|
|
|
|
|
@ -2111,20 +2107,18 @@ PRIVATE void XBuildArtList ARGS3(
|
|
|
|
)
|
|
|
|
)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
NewsArt *art;
|
|
|
|
NewsArt *art;
|
|
|
|
char *p,*aname=NULL, *author=NULL, *aref, abuf[1024+1];
|
|
|
|
char *p,*aname=NULL, *aref, abuf[1024+1];
|
|
|
|
BOOL done;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
char *num,*title,*date,*msgid,*ref,*bytes,*lines,*from=NULL;
|
|
|
|
char *num,*title,*date,*msgid,*ref,*bytes,*lines,*from=NULL;
|
|
|
|
|
|
|
|
|
|
|
|
char buf[2048];
|
|
|
|
char buf[2048];
|
|
|
|
|
|
|
|
|
|
|
|
char *reference=0; /* Href for article */
|
|
|
|
|
|
|
|
int status, count, first, last; /* Response fields */
|
|
|
|
int status, count, first, last; /* Response fields */
|
|
|
|
/* count is only an upper limit */
|
|
|
|
/* count is only an upper limit */
|
|
|
|
int c,i,lineinc;
|
|
|
|
int lineinc;
|
|
|
|
|
|
|
|
|
|
|
|
HTMeter(0,NULL);
|
|
|
|
HTMeter(0,NULL);
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef DISABLE_TRACE
|
|
|
|
#ifndef DISABLE_TRACE
|
|
|
|
if(www2Trace) fprintf(stderr,"[%s]\n",response_text);
|
|
|
|
if(www2Trace) fprintf(stderr,"[%s]\n",response_text);
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
@ -2250,12 +2244,11 @@ PRIVATE void BuildArtList ARGS3(
|
|
|
|
)
|
|
|
|
)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
NewsArt *art;
|
|
|
|
NewsArt *art;
|
|
|
|
char *p,*aname, *author, *aref, abuf[1024+1];
|
|
|
|
|
|
|
|
BOOL done;
|
|
|
|
BOOL done;
|
|
|
|
|
|
|
|
char *p,*aname, *aref, abuf[1024+1];
|
|
|
|
|
|
|
|
|
|
|
|
char buffer[LINE_LENGTH];
|
|
|
|
char buffer[LINE_LENGTH];
|
|
|
|
char line[LINE_LENGTH];
|
|
|
|
char line[LINE_LENGTH];
|
|
|
|
char *reference=0; /* Href for article */
|
|
|
|
|
|
|
|
int artno; /* Article number WITHIN GROUP */
|
|
|
|
int artno; /* Article number WITHIN GROUP */
|
|
|
|
int status, count, first, last; /* Response fields */
|
|
|
|
int status, count, first, last; /* Response fields */
|
|
|
|
/* count is only an upper limit */
|
|
|
|
/* count is only an upper limit */
|
|
|
@ -2266,6 +2259,7 @@ PRIVATE void BuildArtList ARGS3(
|
|
|
|
if(www2Trace) fprintf(stderr,"[%s]",response_text);
|
|
|
|
if(www2Trace) fprintf(stderr,"[%s]",response_text);
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
sscanf(response_text, "%d %d %d %d", &status, &count, &first, &last);
|
|
|
|
sscanf(response_text, "%d %d %d %d", &status, &count, &first, &last);
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef DISABLE_TRACE
|
|
|
|
#ifndef DISABLE_TRACE
|
|
|
|
if(www2Trace) fprintf(stderr,"Newsgroup status=%d, count=%d, (%d-%d)",
|
|
|
|
if(www2Trace) fprintf(stderr,"Newsgroup status=%d, count=%d, (%d-%d)",
|
|
|
|
status, count, first, last);
|
|
|
|
status, count, first, last);
|
|
|
@ -2475,18 +2469,11 @@ PRIVATE void read_group ARGS3(
|
|
|
|
)
|
|
|
|
)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
NewsArt *art,*art2, *f;
|
|
|
|
NewsArt *art,*art2, *f;
|
|
|
|
char *p;
|
|
|
|
|
|
|
|
BOOL done;
|
|
|
|
|
|
|
|
char buffer[LINE_LENGTH], subj[LINE_LENGTH];
|
|
|
|
char buffer[LINE_LENGTH], subj[LINE_LENGTH];
|
|
|
|
char line[LINE_LENGTH], from[LINE_LENGTH];
|
|
|
|
char from[LINE_LENGTH];
|
|
|
|
char efrom[LINE_LENGTH], esubj[LINE_LENGTH];
|
|
|
|
char efrom[LINE_LENGTH], esubj[LINE_LENGTH];
|
|
|
|
char *reference=0;
|
|
|
|
int i,mark=0;
|
|
|
|
int i,artno, mark=0;
|
|
|
|
|
|
|
|
int tc=0;
|
|
|
|
|
|
|
|
int status, count; /* Response fields */
|
|
|
|
|
|
|
|
/* count is only an upper limit */
|
|
|
|
|
|
|
|
char em[255+1];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ((NewsGroupS = findgroup (groupName)) == NULL) {
|
|
|
|
if ((NewsGroupS = findgroup (groupName)) == NULL) {
|
|
|
|
/* Add group unsub'd to hash table */
|
|
|
|
/* Add group unsub'd to hash table */
|
|
|
|
if((NewsGroupS = addgroup (groupName, first, last, 1))==NULL) {
|
|
|
|
if((NewsGroupS = addgroup (groupName, first, last, 1))==NULL) {
|
|
|
@ -2605,7 +2592,7 @@ PUBLIC int HTLoadNews ARGS4(
|
|
|
|
{
|
|
|
|
{
|
|
|
|
char command[257]; /* The whole command */
|
|
|
|
char command[257]; /* The whole command */
|
|
|
|
char groupName[GROUP_NAME_LENGTH]; /* Just the group name */
|
|
|
|
char groupName[GROUP_NAME_LENGTH]; /* Just the group name */
|
|
|
|
char buf[LINE_LENGTH+1], *pt, *p1;
|
|
|
|
char buf[LINE_LENGTH+1], *p1;
|
|
|
|
int status; /* tcp return */
|
|
|
|
int status; /* tcp return */
|
|
|
|
int retries; /* A count of how hard we have tried */
|
|
|
|
int retries; /* A count of how hard we have tried */
|
|
|
|
BOOL group_wanted; /* Flag: group was asked for, not article */
|
|
|
|
BOOL group_wanted; /* Flag: group was asked for, not article */
|
|
|
@ -2652,16 +2639,18 @@ PUBLIC int HTLoadNews ARGS4(
|
|
|
|
** xxx@yyy Article
|
|
|
|
** xxx@yyy Article
|
|
|
|
** <xxx@yyy> Same article
|
|
|
|
** <xxx@yyy> Same article
|
|
|
|
** xxxxx News group (no "@")
|
|
|
|
** xxxxx News group (no "@")
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
group_wanted = (strchr(arg, '@')==0) && (strchr(arg, '*')==0);
|
|
|
|
group_wanted = (strchr(arg, '@')==0) && (strchr(arg, '*')==0);
|
|
|
|
list_wanted = (strchr(arg, '@')==0) && (strchr(arg, '*')!=0);
|
|
|
|
list_wanted = (strchr(arg, '@')==0) && (strchr(arg, '*')!=0);
|
|
|
|
|
|
|
|
|
|
|
|
/* Don't use HTParse because news: access doesn't follow traditional
|
|
|
|
/* Don't use HTParse because news: access doesn't follow traditional
|
|
|
|
rules. For instance, if the article reference contains a '#',
|
|
|
|
rules. For instance, if the article reference contains a '#',
|
|
|
|
the rest of it is lost -- JFG 10/7/92, from a bug report
|
|
|
|
the rest of it is lost -- JFG 10/7/92, from a bug report
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
if (!my_strncasecmp (arg, "news:", 5))
|
|
|
|
if (!my_strncasecmp (arg, "news:", 5))
|
|
|
|
p1 = arg + 5; /* Skip "news:" prefix */
|
|
|
|
p1 = arg + 5; /* Skip "news:" prefix */
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
p1 = arg;
|
|
|
|
if (group_wanted) {
|
|
|
|
if (group_wanted) {
|
|
|
|
strcpy (command, "GROUP ");
|
|
|
|
strcpy (command, "GROUP ");
|
|
|
|
first = 0;
|
|
|
|
first = 0;
|
|
|
@ -2670,37 +2659,37 @@ PUBLIC int HTLoadNews ARGS4(
|
|
|
|
strcat (command, groupName);
|
|
|
|
strcat (command, groupName);
|
|
|
|
} else if (!list_wanted) {
|
|
|
|
} else if (!list_wanted) {
|
|
|
|
strcpy (command, "ARTICLE ");
|
|
|
|
strcpy (command, "ARTICLE ");
|
|
|
|
if (strchr(p1, '<')==0)
|
|
|
|
if (strchr(p1, '<')==0)
|
|
|
|
strcat(command,"<");
|
|
|
|
strcat(command,"<");
|
|
|
|
strcat(command, p1);
|
|
|
|
strcat(command, p1);
|
|
|
|
if (strchr(p1, '>')==0)
|
|
|
|
if (strchr(p1, '>')==0)
|
|
|
|
strcat(command,">");
|
|
|
|
strcat(command,">");
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
command[0] = 0;
|
|
|
|
command[0] = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
char * p = command + strlen(command);
|
|
|
|
char * p = command + strlen(command);
|
|
|
|
*p++ = CR; /* Macros to be correct on Mac */
|
|
|
|
*p++ = CR; /* Macros to be correct on Mac */
|
|
|
|
*p++ = LF;
|
|
|
|
*p++ = LF;
|
|
|
|
*p++ = 0;
|
|
|
|
*p++ = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (!*arg) {
|
|
|
|
if (!*arg) {
|
|
|
|
HTProgress ("Could not load data.");
|
|
|
|
HTProgress ("Could not load data.");
|
|
|
|
return HT_NOT_LOADED; /* Ignore if no name */
|
|
|
|
return HT_NOT_LOADED; /* Ignore if no name */
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Make a hypertext object with an anchor list. */
|
|
|
|
/* Make a hypertext object with an anchor list. */
|
|
|
|
node_anchor = anAnchor;
|
|
|
|
node_anchor = anAnchor;
|
|
|
|
target = HTML_new(anAnchor, format_out, stream);
|
|
|
|
target = HTML_new(anAnchor, format_out, stream);
|
|
|
|
targetClass = *target->isa;
|
|
|
|
targetClass = *target->isa;
|
|
|
|
|
|
|
|
|
|
|
|
/* Now, let's get a stream setup up from the NewsHost: */
|
|
|
|
/* Now, let's get a stream setup up from the NewsHost: */
|
|
|
|
for (retries=0; retries<2; retries++) {
|
|
|
|
for (retries=0; retries<2; retries++) {
|
|
|
|
target = HTML_new(anAnchor, format_out, stream);
|
|
|
|
target = HTML_new(anAnchor, format_out, stream);
|
|
|
|
targetClass = *target->isa; /* Copy routine entry points */
|
|
|
|
targetClass = *target->isa; /* Copy routine entry points */
|
|
|
|
if (s < 0)
|
|
|
|
if (s < 0)
|
|
|
|
if(status = OpenNNTP()){
|
|
|
|
if(status = OpenNNTP()){
|
|
|
|
char message[256];
|
|
|
|
char message[256];
|
|
|
|
switch(status){
|
|
|
|
switch(status){
|
|
|
@ -2724,21 +2713,21 @@ PUBLIC int HTLoadNews ARGS4(
|
|
|
|
HTProgress ("Could not access news host.");
|
|
|
|
HTProgress ("Could not access news host.");
|
|
|
|
sprintf(message,"\nCould not access news host %s. "
|
|
|
|
sprintf(message,"\nCould not access news host %s. "
|
|
|
|
"Try setting environment variable <code>NNTPSERVER</code> "
|
|
|
|
"Try setting environment variable <code>NNTPSERVER</code> "
|
|
|
|
"to the name of your news host, and restart Mosaic.",
|
|
|
|
"to the name of your news host, and restart Mosaic.",
|
|
|
|
HTNewsHost);
|
|
|
|
HTNewsHost);
|
|
|
|
|
|
|
|
|
|
|
|
PUTS(message);
|
|
|
|
PUTS(message);
|
|
|
|
(*targetClass.end_document)(target);
|
|
|
|
(*targetClass.end_document)(target);
|
|
|
|
(*targetClass.free)(target);
|
|
|
|
(*targetClass.free)(target);
|
|
|
|
return HT_LOADED;
|
|
|
|
return HT_LOADED;
|
|
|
|
case 3:
|
|
|
|
case 3:
|
|
|
|
HTProgress ("Connection interrupted.");
|
|
|
|
HTProgress ("Connection interrupted.");
|
|
|
|
(*targetClass.handle_interrupt)(target);
|
|
|
|
(*targetClass.handle_interrupt)(target);
|
|
|
|
|
|
|
|
|
|
|
|
return HT_INTERRUPTED;
|
|
|
|
return HT_INTERRUPTED;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
status = response("XOVER\r\n");
|
|
|
|
status = response("XOVER\r\n");
|
|
|
|
if(status != 500)
|
|
|
|
if(status != 500)
|
|
|
|
has_xover = 1;
|
|
|
|
has_xover = 1;
|
|
|
|