Synchronet now requires the libarchive development package (e.g. libarchive-dev on Debian-based Linux distros, libarchive.org for more info) to build successfully.

Commits (1)
  • Rob Swindell's avatar
    When searching for text in file descriptions, always search ext desc · f0d253ef
    Rob Swindell authored
    Since users can (and usually do) display extended descriptions in their normal file listings anyway, it makes sense to go ahead and search them for the text (e.g. with the 'F' command from the default command shell File menu/prompt). So the "search/display extended info" prompt has been changed to just "Display extended file info" since it no longer controls whether or not the extended description is searched for the text (it always is). The FL_EXFIND was renamed to FL_EXT and only controls whether the extended info is display (the FL_FIND mode flag, always renamed, must also be specified for a find with extended info).
    
    This closes feature request #285 by Phil (@plt).
    f0d253ef
......@@ -446,10 +446,10 @@ int sbbs_t::exec_file(csi_t *csi)
}
return(0);
case CS_FILE_FIND_TEXT: /* Find text in descriptions */
scandirs(FL_FINDDESC);
scandirs(FL_FIND);
return(0);
case CS_FILE_FIND_TEXT_ALL: /* Find text in descriptions */
scanalldirs(FL_FINDDESC);
scanalldirs(FL_FIND);
return(0);
case CS_FILE_FIND_NAME: /* Find text in descriptions */
scandirs(FL_NO_HDR);
......
......@@ -35,7 +35,7 @@ int extdesclines(char *str);
/*****************************************************************************/
int sbbs_t::listfiles(uint dirnum, const char *filespec, FILE* tofile, long mode)
{
char hdr[256],letter='A',*p;
char hdr[256],letter='A';
uchar flagprompt=0;
int c, d;
uint i,j;
......@@ -58,8 +58,8 @@ int sbbs_t::listfiles(uint dirnum, const char *filespec, FILE* tofile, long mode
size_t file_count = 0;
file_t* file_list = loadfiles(&smb
, (mode&(FL_FINDDESC|FL_EXFIND)) ? NULL : filespec
, (mode&FL_ULTIME) ? ns_time : 0
, (mode & FL_FIND) ? NULL : filespec
, (mode & FL_ULTIME) ? ns_time : 0
, tofile == NULL ? file_detail_extdesc : file_detail_normal
, (enum file_sort)cfg.dir[dirnum]->sort
, &file_count);
......@@ -93,7 +93,7 @@ int sbbs_t::listfiles(uint dirnum, const char *filespec, FILE* tofile, long mode
found=0;
if(m>=file_count || flagprompt) { /* End of list */
if(useron.misc&BATCHFLAG && !tofile && found && found!=lastbat
&& !(mode&(FL_EXFIND|FL_VIEW))) {
&& !(mode&(FL_EXT|FL_VIEW))) {
flagprompt=0;
lncntr=0;
if((i=batchflagprompt(&smb, bf, file_row, letter-'A', file_count))==2) {
......@@ -136,47 +136,25 @@ int sbbs_t::listfiles(uint dirnum, const char *filespec, FILE* tofile, long mode
found = -1;
break;
}
#if 0 /* unnecessary? */
if(!(mode&(FL_FINDDESC|FL_EXFIND)) && filespec[0]
&& !filematch(str,filespec)) {
m+=11;
continue;
}
#endif
if(mode&(FL_FINDDESC|FL_EXFIND)) {
p = (f->desc == NULL) ? NULL : strcasestr(f->desc, filespec);
if(mode & FL_FIND) {
char* p = (f->desc == NULL) ? NULL : strcasestr(f->desc, filespec);
if(p == NULL)
p = strcasestr(f->name, filespec);
if(!(mode&FL_EXFIND) && p==NULL) {
m++;
continue;
}
if(mode&FL_EXFIND && f->extdesc != NULL) { /* search extended description */
if(!strcasestr((char*)f->extdesc, filespec) && p == NULL) { /* not in description or */
m++; /* extended description */
if(p == NULL) {
if(f->extdesc != NULL)
p = strcasestr((char*)f->extdesc, filespec);
if(p == NULL) {
m++;
continue;
}
}
else if(p == NULL) { /* no extended description and not in desc */
m++;
continue;
}
}
/** necessary?
if(mode&FL_ULTIME) {
if(ns_time>(ixbbuf[m+3]|((long)ixbbuf[m+4]<<8)|((long)ixbbuf[m+5]<<16)
|((long)ixbbuf[m+6]<<24))) {
m+=11;
continue;
}
}
**/
if(useron.misc&BATCHFLAG && letter=='A' && found && !tofile
&& !(mode&(FL_EXFIND|FL_VIEW))
&& !(mode&(FL_EXT | FL_VIEW))
&& (!mode || !(useron.misc&EXPERT)))
bputs(text[FileListBatchCommands]);
m++;
if(!found && !(mode&(FL_EXFIND|FL_VIEW))) {
if(!found && !(mode&(FL_EXT | FL_VIEW))) {
for(i=0;i<usrlibs;i++)
if(usrlib[i]==cfg.dir[dirnum]->lib)
break;
......@@ -259,10 +237,10 @@ int sbbs_t::listfiles(uint dirnum, const char *filespec, FILE* tofile, long mode
long currow = row;
next=m;
disp=1;
if(mode&(FL_EXFIND|FL_VIEW)) {
if(mode&(FL_EXT | FL_VIEW)) {
if(!found)
bputs("\r\1>");
if(!viewfile(f, INT_TO_BOOL(mode&FL_EXFIND))) {
if(!viewfile(f, INT_TO_BOOL(mode & FL_EXT))) {
found = -1;
break;
}
......@@ -270,7 +248,7 @@ int sbbs_t::listfiles(uint dirnum, const char *filespec, FILE* tofile, long mode
}
else if(tofile)
listfiletofile(f, tofile);
else if(mode&FL_FINDDESC)
else if(mode & FL_FIND)
disp=listfile(f, dirnum, filespec, letter, longest);
else
disp=listfile(f, dirnum, nulstr, letter, longest);
......@@ -286,7 +264,7 @@ int sbbs_t::listfiles(uint dirnum, const char *filespec, FILE* tofile, long mode
found = -1;
break;
}
if(mode&(FL_EXFIND|FL_VIEW))
if(mode&(FL_EXT | FL_VIEW))
continue;
if(useron.misc&BATCHFLAG && !tofile) {
if(disp) {
......@@ -296,7 +274,7 @@ int sbbs_t::listfiles(uint dirnum, const char *filespec, FILE* tofile, long mode
m++;
if(flagprompt || letter=='Z' || !disp ||
(filespec[0] && !strchr(filespec,'*') && !strchr(filespec,'?')
&& !(mode&FL_FINDDESC))
&& !(mode & FL_FIND))
|| (useron.misc&BATCHFLAG && !tofile && lncntr>=rows-2)
) {
flagprompt=0;
......@@ -334,7 +312,7 @@ int sbbs_t::listfiles(uint dirnum, const char *filespec, FILE* tofile, long mode
flagprompt=1;
}
m=next;
if(mode&FL_FINDDESC) continue;
if(mode & FL_FIND) continue;
if(filespec[0] && !strchr(filespec,'*') && !strchr(filespec,'?') && m)
break;
}
......@@ -433,7 +411,8 @@ bool sbbs_t::listfile(file_t* f, uint dirnum, const char *search, const char let
bprintf("%.*s",i,fdesc+j);
attr(cfg.color[clr_filedesc]);
bprintf("%.*s",(int)strlen(fdesc)-(j+i),fdesc+j+i);
}
} else
bputs(P_TRUNCATE, fdesc);
}
else {
bputs(P_TRUNCATE, fdesc);
......
......@@ -749,10 +749,10 @@ typedef enum { /* Values for xtrn_t.event */
/* Bits in 'mode' for listfiles */
#define FL_ULTIME (1<<0) /* List files by upload time */
#define FL_DLTIME (1<<1) /* List files by download time */
#define FL_DLTIME (1<<1) /* List files by download time - UNUSED */
#define FL_NO_HDR (1<<2) /* Don't list directory header */
#define FL_FINDDESC (1<<3) /* Find text in description */
#define FL_EXFIND (1<<4) /* Find text in description - extended info */
#define FL_FIND (1<<3) /* Find text in description or filename */
#define FL_EXT (1<<4) /* Displayed extended file information */
#define FL_VIEW (1<<5) /* View ZIP/ARC/GIF etc. info */
/* Bits in the mode of writemsg and email() */
......
......@@ -45,9 +45,9 @@ void sbbs_t::scandirs(long mode)
if(!getfilespec(str))
return;
}
else if(mode==FL_FINDDESC) { /* Find text in description */
if(text[SearchExtendedQ][0] && !noyes(text[SearchExtendedQ]))
mode=FL_EXFIND;
else if(mode==FL_FIND) { /* Find text in description */
if(text[DisplayExtendedFileInfoQ][0] && !noyes(text[DisplayExtendedFileInfoQ]))
mode |= FL_EXT;
if(sys_status&SS_ABORT) {
lncntr=0;
return;
......@@ -111,9 +111,9 @@ void sbbs_t::scanalldirs(long mode)
if(!getfilespec(str))
return;
}
else if(mode==FL_FINDDESC) { /* Find text in description */
if(text[SearchExtendedQ][0] && !noyes(text[SearchExtendedQ]))
mode=FL_EXFIND;
else if(mode==FL_FIND) { /* Find text in description */
if(text[DisplayExtendedFileInfoQ][0] && !noyes(text[DisplayExtendedFileInfoQ]))
mode |= FL_EXT;
if(sys_status&SS_ABORT) {
lncntr=0;
return;
......
......@@ -634,7 +634,7 @@ enum {
,SubGroupOrAll
,DirLibOrAll
,EnterPath
,SearchExtendedQ
,DisplayExtendedFileInfoQ
,DisplaySubjectsOnlyQ
,EchoIsNow
,WelcomeToPrivateChat
......
......@@ -1047,8 +1047,8 @@ const char * const text_defaults[TOTAL_TEXT]={
,"\x0d\x0a\x7e\x44\x69\x72\x65\x63\x74\x6f\x72\x79\x3a\x20\x40\x44\x49\x52\x40\x2c\x20\x7e\x4c\x69\x62\x72\x61\x72\x79\x3a\x20\x40"
"\x4c\x49\x42\x40\x2c\x20\x6f\x72\x20\x7e\x41\x6c\x6c\x3a\x20" // 622 DirLibOrAll
,"\x0d\x0a\x01\x5f\x01\x79\x01\x68\x45\x6e\x74\x65\x72\x20\x70\x61\x74\x68\x3a\x20" // 623 EnterPath
,"\x0d\x0a\x53\x65\x61\x72\x63\x68\x20\x61\x6e\x64\x20\x64\x69\x73\x70\x6c\x61\x79\x20\x65\x78\x74\x65\x6e\x64\x65\x64\x20\x69\x6e"
"\x66\x6f\x72\x6d\x61\x74\x69\x6f\x6e" // 624 SearchExtendedQ
,"\x01\x3f\x44\x69\x73\x70\x6c\x61\x79\x20\x65\x78\x74\x65\x6e\x64\x65\x64\x20\x66\x69\x6c\x65\x20\x69\x6e\x66\x6f\x72\x6d\x61\x74"
"\x69\x6f\x6e" // 624 DisplayExtendedFileInfoQ
,"\x0d\x0a\x44\x69\x73\x70\x6c\x61\x79\x20\x53\x75\x62\x6a\x65\x63\x74\x73\x20\x4f\x6e\x6c\x79" // 625 DisplaySubjectsOnlyQ
,"\x0d\x0a\x45\x63\x68\x6f\x20\x69\x73\x20\x6e\x6f\x77\x20\x25\x73\x20\x0d\x0a" // 626 EchoIsNow
,"\x0d\x0a\x01\x6e\x01\x79\x01\x68\x50\x72\x69\x76\x61\x74\x65\x20\x43\x68\x61\x74\x20\x2d\x20\x01\x62\x43\x74\x72\x6c\x2d\x43\x20"
......