Fixed filefind search in description

This commit is contained in:
Michiel Broek 2007-10-15 12:48:11 +00:00
parent 684e61fa66
commit 904619bbd5
4 changed files with 19 additions and 12 deletions

View File

@ -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.

View File

@ -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;
/*

View File

@ -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;

View File

@ -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, " ",