From 904619bbd592147dddde8c7d6da58800358af9fd Mon Sep 17 00:00:00 2001 From: Michiel Broek Date: Mon, 15 Oct 2007 12:48:11 +0000 Subject: [PATCH] Fixed filefind search in description --- ChangeLog | 4 ++++ mbfido/fflist.c | 4 ++-- mbfido/fflist.h | 2 +- mbfido/filefind.c | 21 ++++++++++++--------- 4 files changed, 19 insertions(+), 12 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6ce31489..d171c702 100644 --- a/ChangeLog +++ b/ChangeLog @@ -16,6 +16,10 @@ v0.91.13 12-Oct-2007 Added GeoIP support. Removed a lot of debug logging. + mbaff: + Fixed filefind search filenames case insensitive. + Fixed filefind search in description. + mbsetup: Blocked selection of FTN and Usenet moderated message areas. Changed the F-PROT scanner name into fpscan. diff --git a/mbfido/fflist.c b/mbfido/fflist.c index fc611885..abf53313 100644 --- a/mbfido/fflist.c +++ b/mbfido/fflist.c @@ -4,7 +4,7 @@ * Purpose ...............: Announce new files and FileFind * ***************************************************************************** - * Copyright (C) 1997-2005 + * Copyright (C) 1997-2007 * * Michiel Broek FIDO: 2:2801/16 * Beekmansbos 10 Internet: mbroek@ux123.pttnwb.nl @@ -127,7 +127,7 @@ void fill_rflist(rf_list **fdp, char *fname, unsigned int larea) */ tmp = (rf_list *)malloc(sizeof(rf_list)); tmp->next = NULL; - snprintf(tmp->filename, 15, "%s", fname); + snprintf(tmp->filename, 80, "%s", fname); tmp->area = larea; /* diff --git a/mbfido/fflist.h b/mbfido/fflist.h index 91945434..b3a2107f 100644 --- a/mbfido/fflist.h +++ b/mbfido/fflist.h @@ -20,7 +20,7 @@ typedef struct _ff_list { /* Filefind array */ typedef struct _rf_list { /* Reply filenames array */ struct _rf_list *next; - char filename[15]; /* Filename found */ + char filename[81]; /* Filename found */ unsigned int area; /* BBS file area number */ } rf_list; diff --git a/mbfido/filefind.c b/mbfido/filefind.c index 09b32bad..10719c33 100644 --- a/mbfido/filefind.c +++ b/mbfido/filefind.c @@ -258,10 +258,9 @@ void ScanFiles(ff_list *tmp) kwd = calloc(81, sizeof(char)); temp = calloc(PATH_MAX, sizeof(char)); - BigDesc = calloc(1231, sizeof(char)); snprintf(temp, PATH_MAX, "%s (%d:%d/%d.%d)", tmp->from, tmp->zone, tmp->net, tmp->node, tmp->point); - Syslog('+', "ff: %s [%s]", temp, tmp->subject); + Syslog('+', "Search [%s] for %s", tmp->subject, temp); if (!do_quiet) { mbse_colour(CYAN, BLACK); @@ -291,8 +290,9 @@ void ScanFiles(ff_list *tmp) if (area.Available && area.FileFind) { if ((fdb_area = mbsedb_OpenFDB(areanr, 30))) { while (fread(&fdb, fdbhdr.recsize, 1, fdb_area->fp) == 1) { + BigDesc = xstrcpy((char *)""); for (i = 0; i < 25; i++) - snprintf(BigDesc, 1230, "%s%s", BigDesc, *(fdb.Desc + i)); + BigDesc = xstrcat(BigDesc, fdb.Desc[i]); snprintf(temp, PATH_MAX, "%s", tmp->subject); Found = FALSE; @@ -329,20 +329,21 @@ void ScanFiles(ff_list *tmp) if (strlen(kwd) > scanmgr.keywordlen) { if ((strcasestr(fdb.Name, kwd) != NULL) || (strcasestr(fdb.LName, kwd) != NULL)) { Found = TRUE; - Syslog('m', "Found '%s' in %s in filename", kwd, fdb.LName); + Syslog('m', " Found '%s' in %s in filename", kwd, fdb.LName); } if (keywrd && (strcasestr(BigDesc, kwd) != NULL)) { Found = TRUE; - Syslog('m', "Found '%s' in %s in description", kwd, fdb.LName); + Syslog('m', " Found '%s' in %s in description", kwd, fdb.LName); } } } /* while (strlen(temp) && (!Found)) */ if (Found) { found++; - Syslog('m', "Found %s area %d", fdb.LName, areanr); - fill_rflist(&rfl, fdb.Name, areanr); + Syslog('+', " Found %s in area %d", fdb.LName, areanr); + fill_rflist(&rfl, fdb.LName, areanr); } - strcpy(BigDesc, ""); + free(BigDesc); + BigDesc = NULL; } mbsedb_CloseFDB(fdb_area); } else @@ -398,9 +399,11 @@ void ScanFiles(ff_list *tmp) areanr = rft->area; } + Syslog('m', "rp: %d %s", rft->area, rft->filename); + if ((fdb_area = mbsedb_OpenFDB(rft->area, 30))) { while (fread(&fdb, fdbhdr.recsize, 1, fdb_area->fp) == 1) - if (!strcmp(rft->filename, fdb.Name)) + if (!strcmp(rft->filename, fdb.LName)) break; mbsedb_CloseFDB(fdb_area); MacroVars("slbkdt", "ssddss", fdb.Name, fdb.LName, fdb.Size, fdb.Size / 1024, " ",