home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.wwiv.com
/
ftp.wwiv.com.zip
/
ftp.wwiv.com
/
pub
/
HATCH
/
PBFILE21.ZIP
/
SPV-053J.MOD
< prev
Wrap
Text File
|
1996-01-07
|
16KB
|
483 lines
┌────────────────────────────A CEREBRUM release!─────────────────────────────┐
│ Mod Name: SPV-053J.MOD Mod Authors: Pâpâ ßêâr (11579.wwivnet) │
│ Difficulty: ▓░░░░░░░░░ First ----- [11/18/94] │
│ WWIV Version: 4.24/a Last ------ [01/07/96] │
│ Files Affected: MMENU.C FCNS.H │
│ Description: Allows registered users of PBFILES to include into their │
│source a way for their users to download a CURRENT file listing for whatever│
│directory they're in. Lets them choose file mask, date limiting, MORE! │
│ Now you do lists by dir, conference, N-Scan, or entire xfer section! │
│ Now with menuing system -- more control, change your choices! │
╞═────────────────────────────────────═╤═───────────────────────────────────═╡
│ StarPort Valhalla [ ] - ASV 28.8kbps Home of the SPV mod series! │
└─────────────────────────────────────═╧═────────────────────────────────────┘
Word of Warning: You installed it, you're responsible! Make back-ups BEFORE
attempting to install this modification! Read all text before beginning.
─────────────────────────────────────────────────────────────────────────────
LEGEND:
== Original Code [use this to search on]
++ Add this Line [mods ALWAYS add stuff, don't they?]
─────────────────────────────────────────────────────────────────────────────
LONG DESCRIPTION: This is a great way for your users to get THE most current
listing of files from your BBS! The only thing you need to do is install
this mod (a simple block copy), and register PBFILES.
It will allow the users to toggle WWIV color codes, high ASCII character
inclusion, extended descriptions, and long file information. It will also
allow them to limit files both by file date and file mask.
>>> NOTE! NOTE! NOTE! NOTE! <<<
Because PBFILES in its unregistered mode asks you to press a random key upon
running the program, this modification should *NOT* be used with an
unregistered copy, or it'll lock up your board until you (on the local side)
can press the key!
Revision "H"
o Revised to work with WWIV version 4.24+
Revision "I":
o Fixed a small part that was reading the configuration file incorrectly.
Revision "J":
o Added support for the ! command (ignore listing CD-ROM dirs).
To upgrade, replace the function void DownloadList(void)
─────────────────────────────────────────────────────────────────────────────
STEP 0: Add these variable declarations in MMENU.C, void dlmainmenu(void)
== int i,i1,i2,abort,useconf,ac;
== int dlredraw = 1;
== static int ripdlg = 3;
++ char pbf[81],pbf1[81],pbf2[81],pbf3[81],pbf4[81]; // SPV-053
++ int i3; // SPV-053
==
== s2[0]=0;
== if (udir[curdir].subnum==-1) {
─────────────────────────────────────────────────────────────────────────────
STEP 1: Open up MMENU.C, and block copy in this code in the function:
void dlmainmenu(void);
== /* Anyone commands here */
== if (strcmp(s,"WHO")==0) {
== multi_instance();
== }
// START SPV-053 BLOCK COPY
if (strcmp(s,"DLIST")==0) {
sprintf(s1,"<*> %s ran DLIST! -- Check PBFILES.LOG!",thisuser.name);
ssm(1,0,s1);
sysoplog(s1);
nl();
if (!exist("PBFILES.EXE")) {
if (so())
pl("6You need to place PBFILES.EXE in your main BBS directory!0");
else {
pl("6The program needed to generate the listing is not online!0");
ssm(1,0,"6PBFILES.EXE is missing from main BBS directory!0");
}
nl();
} else
DownloadList();
}
// END SPV-053 BLOCK COPY
==
== /* download cosysop checks here */
== if (dcs()) {
─────────────────────────────────────────────────────────────────────────────
STEP 2: Add these four entire functions to the end of MMENU.C
// SPV-053 START
#define INCLUSION "PBFILES.INC" // NOTE 1
#define BBSEXT "SPV" // NOTE 2
#define DEFAULT "STARPORT" // NOTE 3
#define DEFAULTMODE 2 // NOTE 5
void DownloadList(void)
{
int Color,ASCII,More,Format,Extended,GIF,ok,i,i1[5],FileAge;
char ArchiveName[13],MaskName[13],InclusionName[13],s[81],ch,ch1,
pbf[81],OutFile[81],ConfLine[20][81],date[81],s1[81];
unsigned char Ignore=0;
FILE *ConfigFile;
time_t Time;
struct tm *TimePointer;
Format=DEFAULTMODE;
if ((ConfigFile=fsh_open("PBFILES.INI","rt"))==NULL) {
sprintf(s,"6Could not read PBFILES.INI!0");
nl();
if (so())
pl(s);
else {
ssm(1,0,s);
pl("6PBfiles is currently offline, SysOp has been notified!0");
}
nl();
return;
} else {
i=-1;
while (!feof(ConfigFile))
fgets(ConfLine[++i],80,ConfigFile);
fclose(ConfigFile);
if (atoi(ConfLine[0])!=1030) {
sprintf(s,"6You need a NEW PBFILES.INI file -- run PBFILES /C!0");
unlink("PBFILES.INI");
nl();
if (so())
pl(s);
else {
ssm(1,0,s);
pl("6PBfiles is currently offline, SysOp has been notified!0");
}
nl();
return;
}
i1[0]=ASCII=atoi(ConfLine[13]);
i1[1]=Color=atoi(ConfLine[14]);
i1[2]=Extended=atoi(ConfLine[15]);
i1[3]=More=atoi(ConfLine[16]);
i1[4]=GIF=atoi(ConfLine[19]);
}
FileAge=i=date[0]=0;
sprintf(ArchiveName,DEFAULT);
strcpy(MaskName,"*.*");
do {
ok=0;
outchr(12);
sprintf(s,"1%s's 5PBFILES control center0",syscfg.systemname);
npr("%s",CenterText(s));
nln(2);
strcpy(s,"3The current settings are2:0");
npr("%s",CenterText(s));
nln(2);
strcpy(InclusionName,"PBFILES.$$");
switch (Format) {
case 0:
strcpy(s,"9This directory only0");
sprintf(InclusionName,":%s",
directories[udir[curdir].subnum].filename);
break;
case 1:
strcpy(s,"9All directories 0- 1this conference0");
break;
case 2:
strcpy(s,"9All directories 0- 1entire BBS0");
strcpy(InclusionName,INCLUSION);
break;
case 3:
strcpy(s,"9All directories 0- 1N-Scan0");
break;
}
npr("4A0) 5Directories to process 0: %s\n\r0",s);
npr("4B0) 5File Mask being used 0: 9%s\n\r0",MaskName);
if (!FileAge)
strcpy(s,"6No age limitation0");
else
sprintf(s,"9Files 1%d9 days old and newer0",FileAge);
npr("4C0) 5Age limitation (days old) 0: 9%s %s\n\r0",
s,(date[0])?date:"");
npr("4D0) 5Strip high/low ASCII? 0: 9%s\n\r0",
(ASCII)?"YES":"NO");
npr("4E0) 5Include WWIV color? 0: 9%s\n\r0",
(Color)?"YES":"NO");
npr("4F0) 5Add long file information?0: 9%s\n\r0",
(More)?"YES":"NO");
npr("4G0) 5Include GIF resolutions? 0: 9%s\n\r0",
(GIF)?"YES":"NO");
npr("4H0) 5Download filename 0: 9%s.%s\n\r0",
ArchiveName,syscfg.arcs[0].extension);
npr("4I0) 5Include CD dirs in list? 0: 9%s\n\r0",
(Ignore)?"NO":"YES");
if (!Format)
npr("4J0) 5Add extended description? 0: 9%s\n\r0",
(Extended)?"YES":"NO");
nl();
pl("5P0) 1Create file list. (5ENTER1)0");
pl("6X0) 2Exit.0");
nl();
npr("3>0");
mpl(1);
if (!Format)
ch=onek("ABCDEFGHIJPX\r");
else
ch=onek("ABCDEFGHIPX\r");
nl();
switch (ch) {
case 'A':
if (thisuser.sysstatus & sysstatus_conference) {
npr("5Process by (1A5)ll dirs, (1C5)onference, 0");
npr("5(1N5)-Scan, or (1T5)his directory2: 0");
ch1=onek("ACTN");
} else {
npr("5Process by (1A5)ll dirs, (1N5)-Scan, 0");
npr("5or (1T5)his directory2: 0");
ch1=onek("ATN");
}
switch (ch1) {
case 'T':
Format=0;
break;
case 'C':
Format=1;
break;
case 'A':
Format=2;
break;
case 'N':
Format=3;
break;
}
break;
case 'B':
npr("5Enter file mask (1ENTER for *.*5)2: 0");
mpl(12);
input(s,12);
if (!s[0])
break;
strcpy(MaskName,s);
break;
case 'C':
npr("5Age limitation, in days (1N for last call date5)2: 0");
mpl(3);
input(s,3);
if (!s[0])
break;
if (s[0]=='N') {
time(&Time);
TimePointer=localtime(&Time);
strftime(s1,9,"%m/%d/%y",TimePointer);
FileAge=(int)((date_to_daten(s1)-
date_to_daten(thisuser.laston))/86400L);
if (FileAge<1)
FileAge=1;
strcpy(date,"(Last call date)");
} else {
FileAge=atoi(s);
date[0]=0;
}
break;
case 'D':
ASCII^=1;
break;
case 'E':
Color^=1;
break;
case 'F':
More^=1;
break;
case 'G':
GIF^=1;
break;
case 'H':
npr("5Download filename (1no extension5)2: 0");
mpl(8);
input(s,8);
if (!s[0])
break;
sprintf(ArchiveName,"%s",s);
break;
case 'I':
Ignore^=1;
break;
case 'J':
Extended^=1;
break;
case '\r':
case 'P':
create_chain_file();
if (Format==1) {
if (!CreateConfList())
return;
} else if (Format==3) {
if (!CreateNscanList())
return;
}
ok=1;
sprintf(OutFile,"%s\%s.%s",syscfgovr.tempdir,
directories[udir[curdir].subnum].filename,
BBSEXT);
sprintf(pbf,"PBFILES /.%d /2 /I%s /O%s /B /K%s ",
instance,InclusionName,OutFile,MaskName);
if (Ignore)
strcat(pbf,"/! ");
if (i1[0]!=ASCII)
strcat(pbf,"/H ");
if (i1[1]!=Color)
strcat(pbf,"/W ");
if (i1[3]!=More)
strcat(pbf,"/M ");
if (i1[2]!=Extended)
strcat(pbf,"/E ");
if (i1[4]!=GIF)
strcat(pbf,"/G ");
if (FileAge) {
sprintf(s,"/N%d ",FileAge);
strcat(pbf,s);
}
if (exist("DEBUG.XXX")) {
if ((ConfigFile=fopen("PBFILES.LOG","at"))!=NULL) {
fprintf(ConfigFile,"\n\nDEBUG: Command line from %s\n",
syscfg.systemname);
fprintf(ConfigFile,"%s\n",pbf);
fclose(ConfigFile);
}
}
extern_prog(pbf,EFLAG_SHRINK|EFLAG_ABORT|EFLAG_TOPSCREEN);
if (!(thisuser.exempt & exempt_ratio)) {
thisuser.exempt+=exempt_ratio;
i=1;
}
nln(2);
pl("6<2***6> 3Please be patient, building file! 6<2***6>0");
pl("6DO NOT drop carrier. This can take a few minutes!0");
nln(2);
add_arc(ArchiveName,OutFile,0);
download_temp_arc(ArchiveName,0);
remove_from_temp("*.*", syscfgovr.tempdir, 0);
if (i)
thisuser.exempt-=exempt_ratio;
unlink("PBFILES.$$");
break;
case 'X':
ok=1;
break;
}
} while ((!ok) && (!hangup));
}
int CreateConfList(void)
{
int ok,i;
unsigned int num,ns;
char s[120];
confrec *ConferencePointer,Conference;
directoryrec DirInfo;
FILE *pbfile;
if ((pbfile=fsh_open("PBFILES.$$","wt"))==NULL) {
nl();
pl("6Can't create TEMP file, try the T, A, or N option instead.0");
nl();
return(0);
}
if (get_conf_info(2,&num,&ConferencePointer,NULL,&ns, NULL))
return(0);
Conference=ConferencePointer[curconfdir];
for (i=0;(i<ns) && (!hangup);i++) {
checkhangup();
DirInfo=directories[i];
if ((in_conference(i,&Conference))>-1) {
ok=1;
if (!DirInfo.name[0])
break;
if (thisuser.dsl<DirInfo.dsl)
ok=0;
if (thisuser.age<DirInfo.age)
ok=0;
if (DirInfo.dar>0) {
if ((thisuser.dar & DirInfo.dar)==0)
ok=0;
}
if (ok)
fprintf(pbfile,"%s\n",DirInfo.filename);
}
}
fsh_close(pbfile);
return(1);
}
int CreateNscanList(void)
{
FILE *pbfile;
int i,ac,ok;
directoryrec DirInfo;
if ((pbfile=fsh_open("PBFILES.$$","wt"))==NULL) {
nl();
pl("6Can't create TEMP file, try the T, A, or C option instead.0");
nl();
return(0);
}
if ((uconfdir[1].confnum!=-1) && (okconf(&thisuser))) {
ac=1;
tmp_disable_conf(1);
}
for (i=0;(i<num_dirs) && (!hangup); i++) {
checkhangup();
DirInfo=directories[i];
ok=1;
if (!(qsc_n[i/32]&(1L<<(i%32))))
ok=0;
if (thisuser.dsl<DirInfo.dsl)
ok=0;
if (thisuser.age<DirInfo.age)
ok=0;
if (DirInfo.dar>0) {
if ((thisuser.dar & DirInfo.dar)==0)
ok=0;
}
if (ok)
fprintf(pbfile,"%s\n",DirInfo.filename);
}
fsh_close(pbfile);
if (ac)
tmp_disable_conf(0);
return(1);
}
char *CenterText(char *String)
{
int i,j;
char s[41],s1[81];
j=40-((strlen(stripcolors(String))/2));
strcpy(s,"");
for (i=0;i<j;i++)
strcat(s," ");
sprintf(s1,"%s%s",s,String);
return(s1);
}
// SPV-053 END
NOTE 1: This is the filename of your *normally* used inclusion file for all
files.
NOTE 2: This is the extension you want to use for the file listing (inside
the ZIP file).
NOTE 3: This is the default ZIP file name.
NOTE 5: This is the default scanning mode:
0 = Current directory
1 = All directories in current conference
2 = All directories in BBS (as defined by normally used .INC file)
3 = All directories in N-Scan (set in transfer defaults)
─────────────────────────────────────────────────────────────────────────────
STEP 3: Prototype the function in FCNS.H
== /* File: mmenu.c */
==
== void mainmenu(void);
== void dlmainmenu(void);
++ int CreateConfList(void); // SPV-053
++ void DownloadList(void); // SPV-053
++ char *CenterText(char *String); // SPV-053
++ int CreateNscanList(void); // SPV-053
==
==
== /* File: modem.c */
─────────────────────────────────────────────────────────────────────────────
STEP 4: Recompile: Redo the whole damn BBS!
─────────────────────────────────────────────────────────────────────────────
Thats it! Just make sure that PBFILES.EXE is in your main BBS directory,
(along with an appropriate inclusion file, if any) and you're off!
This mod is copyright 1994-1996 by Tracy Baker, aka Papa Bear, and is
distributed as freeware. Permission is granted to distribute and post this
mod on BBS systems and online services, provided no alterations are made
(removal of message headers/taglines allowed). This mod may contain some
parts of WWIV source code, which is copyright 1988-1994 by Wayne Bell and
licensed only to registered users of WWIV. Use of WWIV source without
registration constitutes a license violation and could lead to legal
prosecution and certain doom.
Shareware distributors and CD-ROM publishers may not distribute this mod
without express written permission of the Author or WWIV Software Services.