From c07e6d4fe0a587b5668b8ac30d8ddd1fbe2b5976 Mon Sep 17 00:00:00 2001 From: Michiel Broek Date: Tue, 13 Apr 2004 19:09:17 +0000 Subject: [PATCH] fixes for mbfido news --- ChangeLog | 4 ++ mbfido/scan.c | 4 +- mbfido/scannews.c | 118 +++++++++++++++++++++++----------------------- 3 files changed, 65 insertions(+), 61 deletions(-) diff --git a/ChangeLog b/ChangeLog index 12709f6b..e34be1f1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -17,6 +17,10 @@ v0.51.4 11-Apr-2004 Added loging of virus scanner results. When a new echomail area is auto created, the creation date and the newsgroup name will be set. + Fixed news command, only real newsgroup areas are fetched from + the remote newsserver. + You may need to edit or remove /opt/mbse/tmp/newsout to remove + postings for the remote newsserver with echomail messages. mbnntp: New program, news server to read echomail with a news client. diff --git a/mbfido/scan.c b/mbfido/scan.c index e06bb666..38e5bac0 100644 --- a/mbfido/scan.c +++ b/mbfido/scan.c @@ -282,7 +282,7 @@ void ScanFull() if (Link.aka.zone) ExportEcho(Link, Number, &sbl); } - if (strlen(msgs.Newsgroup)) + if (strlen(msgs.Newsgroup) && (msgs.Type == NEWS)) ExportNews(Number, &sbl); tidy_falist(&sbl); @@ -439,7 +439,7 @@ void ScanOne(char *path, unsigned long MsgNum) ExportEcho(Link, MsgNum, &sbl); } } - if (strlen(msgs.Newsgroup)) + if (strlen(msgs.Newsgroup) && (msgs.Type == NEWS)) ExportNews(MsgNum, &sbl); tidy_falist(&sbl); diff --git a/mbfido/scannews.c b/mbfido/scannews.c index 3987169b..563a5431 100644 --- a/mbfido/scannews.c +++ b/mbfido/scannews.c @@ -174,71 +174,71 @@ void Marker(void) */ void ScanNews(void) { - List *art = NULL; - POverview tmp, old; - FILE *pAreas; - char *sAreas; - struct msgareashdr Msgshdr; - struct msgareas Msgs; + List *art = NULL; + POverview tmp, old; + FILE *pAreas; + char *sAreas; + struct msgareashdr Msgshdr; + struct msgareas Msgs; - IsDoing((char *)"Scan News"); - if (nntp_connect() == -1) { - WriteError("Can't connect to newsserver"); - return; - } - if (get_xoverview()) { - return; - } + IsDoing((char *)"Scan News"); + if (nntp_connect() == -1) { + WriteError("Can't connect to newsserver"); + return; + } + if (get_xoverview()) { + return; + } - if (!do_quiet) { - colour(10, 0); - printf("Scan for new news articles\n"); - } + if (!do_quiet) { + colour(10, 0); + printf("Scan for new news articles\n"); + } - sAreas = calloc(PATH_MAX, sizeof(char)); - sprintf(sAreas, "%s/etc/mareas.data", getenv("MBSE_ROOT")); - if(( pAreas = fopen (sAreas, "r")) == NULL) { - WriteError("$Can't open Messages Areas File."); - return; - } - fread(&Msgshdr, sizeof(Msgshdr), 1, pAreas); + sAreas = calloc(PATH_MAX, sizeof(char)); + sprintf(sAreas, "%s/etc/mareas.data", getenv("MBSE_ROOT")); + if(( pAreas = fopen (sAreas, "r")) == NULL) { + WriteError("$Can't open Messages Areas File."); + return; + } + fread(&Msgshdr, sizeof(Msgshdr), 1, pAreas); - while (fread(&Msgs, Msgshdr.recsize, 1, pAreas) == 1) { - fseek(pAreas, Msgshdr.syssize, SEEK_CUR); - if ((Msgs.Active) && strlen(Msgs.Newsgroup)) { - if (IsSema((char *)"upsalarm")) { - Syslog('+', "Detected upsalarm semafore, aborting newsscan"); - break; - } - Syslog('m', "Scan newsgroup: %s", Msgs.Newsgroup); - if (!do_quiet) { - colour(3, 0); - printf("\r%-40s", Msgs.Newsgroup); - fflush(stdout); - } - Nopper(); - if (do_one_group(&art, Msgs.Newsgroup, Msgs.Tag, Msgs.MaxArticles) == RETVAL_ERROR) - break; - /* - * To be safe, update the dupes database after each area. - */ - CloseDupes(); - } + while (fread(&Msgs, Msgshdr.recsize, 1, pAreas) == 1) { + fseek(pAreas, Msgshdr.syssize, SEEK_CUR); + if ((Msgs.Active) && strlen(Msgs.Newsgroup) && (msgs.Type == NEWS)) { + if (IsSema((char *)"upsalarm")) { + Syslog('+', "Detected upsalarm semafore, aborting newsscan"); + break; + } + Syslog('m', "Scan newsgroup: %s", Msgs.Newsgroup); + if (!do_quiet) { + colour(3, 0); + printf("\r%-40s", Msgs.Newsgroup); + fflush(stdout); + } + Nopper(); + if (do_one_group(&art, Msgs.Newsgroup, Msgs.Tag, Msgs.MaxArticles) == RETVAL_ERROR) + break; + /* + * To be safe, update the dupes database after each area. + */ + CloseDupes(); } - fclose(pAreas); - free(sAreas); + } + fclose(pAreas); + free(sAreas); - for (tmp = xoverview; tmp; tmp = old) { - old = tmp->next; - if (tmp->header) - free(tmp->header); - if (tmp->field) - free(tmp->field); - free(tmp); - } - do_flush = TRUE; - if (!do_quiet) - printf("\r \r"); + for (tmp = xoverview; tmp; tmp = old) { + old = tmp->next; + if (tmp->header) + free(tmp->header); + if (tmp->field) + free(tmp->field); + free(tmp); + } + do_flush = TRUE; + if (!do_quiet) + printf("\r \r"); }