Fixes for news

This commit is contained in:
Michiel Broek 2004-04-15 20:52:43 +00:00
parent 884cb156ad
commit 007b7b1d41
4 changed files with 22 additions and 14 deletions

View File

@ -25,6 +25,8 @@ v0.51.4 11-Apr-2004
You may need to edit or remove /opt/mbse/tmp/newsout to remove
postings for the remote newsserver with echomail messages.
Fixed a bug that no news was fetched at all.
Fixed a bug that tossed echomail was attempted to post to the
ISP newsserver (that didn't accept it).
mbnntp:
New program, news server to read echomail with a news client.

View File

@ -488,9 +488,9 @@ int postecho(faddr *p_from, faddr *f, faddr *t, char *orig, char *subj, time_t m
}
/*
* Gate to newsserver
* Gate to newsserver if this is a real newsgroup
*/
if (strlen(msgs.Newsgroup) && tonews) {
if (strlen(msgs.Newsgroup) && (msgs.Type == NEWS) && tonews) {
rewind(nfp);
qp = tmpfile();
while ((fgets(buf, MAX_LINE_LENGTH, nfp)) != NULL) {

View File

@ -408,7 +408,6 @@ int get_xover(char *grpname, long startnr, long endnr, List **art)
if ((strlen(resp) == 1) && (strcmp(resp, ".") == 0)) {
done = TRUE;
} else {
Syslogp('n', printable(resp, 0));
Marker();
Nopper();
pov = xoverview;

View File

@ -261,7 +261,10 @@ void command_group(char *cmd)
if ((fp = fopen(temp, "r"))) {
fread(&msgshdr, sizeof(msgshdr), 1, fp);
while (fread(&msgs, msgshdr.recsize, 1, fp) == 1) {
if (msgs.Active && ((msgs.Type == ECHOMAIL) || (msgs.Type == NEWS)) && strlen(msgs.Newsgroup) &&
/*
* Only echomail areas with a valid newsgroup name to which the user has access.
*/
if (msgs.Active && (msgs.Type == ECHOMAIL) && strlen(msgs.Newsgroup) &&
(strcasecmp(opt, msgs.Newsgroup) == 0) && Access(usrconfig.Security, msgs.RDSec)) {
if (Msg_Open(msgs.Base)) {
Msg_Number();
@ -313,8 +316,11 @@ void command_list(char *cmd)
if ((fp = fopen(temp, "r"))) {
fread(&msgshdr, sizeof(msgshdr), 1, fp);
while (fread(&msgs, msgshdr.recsize, 1, fp) == 1) {
if (msgs.Active && ((msgs.Type == ECHOMAIL) || (msgs.Type == NEWS)) && strlen(msgs.Newsgroup) &&
Access(usrconfig.Security, msgs.RDSec)) {
/*
* Only list echomail areas. If a user wants news, he should get that from
* a real newsserver to prevent problems.
*/
if (msgs.Active && (msgs.Type == ECHOMAIL) && strlen(msgs.Newsgroup) && Access(usrconfig.Security, msgs.RDSec)) {
if (Access(usrconfig.Security, msgs.WRSec))
rw = 'y';
else
@ -340,6 +346,9 @@ void command_list(char *cmd)
return;
}
/*
* Standard list, most clients don't need it, but it's adviced to have.
*/
if (opt && (strcasecmp(opt, "OVERVIEW.FMT") == 0)) {
send_nntp("215 Order of fields in overview database");
send_nntp("Subject:");
@ -349,7 +358,6 @@ void command_list(char *cmd)
send_nntp("References:");
send_nntp("Bytes:");
send_nntp("Lines:");
// send_nntp("Xref:full");
send_nntp(".");
return;
}
@ -372,7 +380,7 @@ void command_xover(char *cmd)
{
char *opt, *p, msgid[100], reply[100];
unsigned long i, start, end;
int refs, bytecount, linecount;
int bytecount, linecount;
IsDoing("Xover");
opt = strtok(cmd, " \0");
@ -416,15 +424,14 @@ void command_xover(char *cmd)
send_nntp("224 Overview information follows");
for (i = start; i <= end; i++) {
if (Msg_ReadHeader(i)) {
bytecount = linecount = refs = 0;
if (Msg.Original)
refs++;
if (Msg.Reply)
refs++;
bytecount = linecount = 0;
if (Msg_Read(i, 80)) {
if ((p = (char *)MsgText_First()) != NULL) {
do {
if (p[0] != '\001') {
if ((p[0] != '\001') && (strncmp(p, "SEEN-BY:", 8)) && (strncmp(p, "AREA:", 5))) {
/*
* Only count lines and bytes we should send
*/
linecount++;
bytecount += strlen(p);
}