home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Devil's Doorknob BBS Capture (1996-2003)
/
devilsdoorknobbbscapture1996-2003.iso
/
Dloads
/
SYSOP
/
MODS1.ZIP
/
FPOINTS2.MOD
< prev
next >
Wrap
Text File
|
1990-06-27
|
16KB
|
588 lines
/*****************************************************************************
File Points v2.0
by
The Wraith
FOR: 4.10, 4.11, probably 4.12, ???
I have been hording this one for quite a while now.. pretty much
because i didn't want to have to write up this DOC. But... since it is the
HUGEST thing I have ever done, i supposed i might as well. I have heard some
rumors of File Points for WWIV being made in the past.. (most of them bad!)
but i am pretty sure that this has no bugs in it. I have been running it for
about a half a year now.
What this does is instead of relying completely on the QUANTITY of
files, this will allow your dloading to be based on the QUALITY of the file.
As i said this is not COMPLETELY on the normal Ratio, but it is partially,
since it's a LOT easier NOT to remove the ratio info.. So if you would
rather not have a ratio involved at ALL, then just set it to 0.000. Mine is
set to .150 (just as a safeguard so that even if the files are GREAT, someone
wont be able to leech forever! heh.) This may not be for you. Since it
will mean that someone (probably you) will have to review every file, and
assign appropriate value to it.. but it has worked perfectly for me, and
two other boards in my area.....
The basic idea is that when you upload a file, you get a certain number
of points for it.. and you can 'spend' the points on files that have a
certain point value placed on them. Much like getting gold for posts, and
spending it on games.
Also.. This mod WILL snag THISUSER.GOLD. I took the SALT mod out a
long time ago.. just coming to the conclusion that, "If i have a user that
would leech that massively on the games, i dont need him on my board.".. so
I used the GOLD.
Now.. In version 1.0 (that was never released past my county.. heh)
back when 4.07 was the latest.. i used the uploads varable 'mask' to store,
the points for each file that was uploaded, this was forshadowing of
Wayne's extended descriptions.. so, unfortunately.. to do this mod. You
will have to delete ALL your files from the uploads (not the REAL file, but
remove it from the dload section and say "No, do NOT delete the file" when
prompted.... I realize this will be almost TOTALLY impossible for large
boards, like a WWIV Support board or something.. but it's not going to be
THAT much of a chore for a smaller board (my board had 400 files at the time
I switched to points, and it took 2 hours to put em all back up It'll give
you a chance to see what you have in your dirs that you forgot about..
Or you could write a small program that will convert the data, to a new
format (i.e. like Shai Hulud's CONVERT for the userlist.). Too bad Wayne
failed to place 'reserved' bytes in the uploadsrec.. would have made things
so much simpler..
There is one way to get around file points... and that is through the
use of the Extract, and Archive TEMP.ZIP. Now.. almost NO user out there is
smart enough to figure out how this sucker works to begin with.. and i have
not had a problem with it... but if i ever do.. that user/visting sysop will
be deleted (providing deceit was intentional..). and that is all that
I could tell you out there to do. You may also want to restrict access to
the temporary archiver to Co-Sysops or higher.
I just timed myself.. and without rushing.. it took only 15 minutes
to install this mod in an unmoddified board.
******************************************************************************/
The Real first thing to do..
Add this in your Vardec.h file..
/* DATA HELD FOR EVERY UPLOAD */
typedef struct {
char filename[13], /* filename */
description[59], /* file description */
date[9], /* date u/l'ed */
upby[46]; /* name of upload user */
unsigned char filetype; /* file type for apples */
unsigned short numdloads, /* number times d/l'ed */
ownersys,ownerusr, /* who uploaded it */
++ points, /* file points */
mask; /* file type mask */
unsigned long daten, /* date uploaded */
numbytes; /* number bytes long file is */
} uploadsrec;
WARNING! THE ABOVE MODIFICATION WILL MAKE YOUR CURRENT TRANSFER SECTION
DATA FILES USELESS.. YOU WILL HAVE TO RE-ENTER ALL FILES IN ORDER YOU USE
THEM.
FIRST
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ONLY MOD TO BBS.C
~~~~~
if ((strcmp(s,"UPLOAD")==0) && (dcs()))
uploadall(udir[curdir].subnum);
if ((strcmp(s,"REN")==0) && (dcs())) {
helpl=39;
rename_file();
}
++ if ((strcmp(s,"/P")==0) && (so()))
++ file_points(1);
++ if ((strcmp(s,"POINTS")==0) && (so()))
++ file_points(0);
if ((strcmp(s,"MOVE")==0) && (dcs()))
move_file();
if ((strcmp(s,"SORT")==0) && (dcs())) {
nl();
prt(2,"Sort all dirs? ");
SECOND
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ALL OTHER PORTIONS ARE FOUND IN XFER.C
~~~~~~
( ADD THIS VOID TO THE END OF XFER.C )
void file_points(int x)
{
char s[81],s1[81],s2[81];
int i,abort=0;
uploadsrec u;
userrec uu;
nl();
nl();
prt(2,"File to edit: ");
mpl(12);
input(s,12);
if (s[0]==0)
return;
if (strchr(s,'.')==NULL)
strcat(s,".*");
align(s);
dliscan();
nl();
i=recno(s);
while ((!hangup) && (i>0) && (!abort)) {
SETREC(i);
read(dlf,(void *)&u,sizeof(uploadsrec));
printfileinfo(&u,udir[curdir].subnum);
nl();
prt(2,"New Points(Q=Quit): ");
input(s1,3);
if (s1[0]) {
if (strcmp(s1,"Q")==0)
abort=1;
u.points=atoi(s1);
SETREC(i);
write(dlf,(void *)&u,sizeof(uploadsrec));
if (x) {
read_user(u.ownerusr,&uu);
uu.gold+=u.points;
write_user(u.ownerusr,&uu);
close_user();
}
}
if(!abort)
i=nrecno(s,i);
}
closedl();
}
THIRD
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
(REPLACE THIS *ENTIRE* VOID)
void printinfo(uploadsrec *u, int *abort)
{
char s[85],s1[40],s2[81],s3[80];
int i,next,fc;
fc=thisuser.sysstatus & sysstatus_funky_colors;
if (fc) {
ansic(1);
strncpy(s,u->filename,8);
s[8]=0;
osan(s,abort,&next);
strncpy(s,&((u->filename)[8]),4);
s[4]=0;
ansic(2);
osan(s,abort,&next);
ansic(0);
osan(": ",abort,&next);
if (u->points!=-1) {
ltoa((((u->numbytes)+1023)/1024),s1,10);
strcat(s1,"k");
#ifdef CHECK_FOR_EXISTANCE
strcpy(s2,directories[udir[curdir].subnum].path);
strcat(s2,u->filename);
if (!exist(s2))
strcpy(s1,"BEG ");
#endif
for (i=0; i<5-strlen(s1); i++)
s[i]=32;
s[i]=0;
strcat(s,s1);
ansic(3);
osan(s,abort,&next);
itoa((u->points),s1,10);
for (i=0; i<3-strlen(s1); i++)
s[i]=32;
s[i]=0;
strcat(s,s1);
strcat(s,"pts");
ansic(7);
osan(s,abort,&next);
} else {
strcpy(s,"UNVALIDATED");
ansic(6);
osan(s,abort,&next);
}
ansic(0);
osan(" :",abort,&next);
ansic(5);
pla(u->description,abort);
if ((!*abort) && (thisuser.num_extended) && (u->mask & mask_extended))
print_extended(u->filename,abort,thisuser.num_extended,1);
if (!(*abort))
++num_listed;
} else {
strcpy(s,u->filename);
strcat(s,": ");
if(u->mask!=1) {
ltoa((((u->numbytes)+1023)/1024),s1,10);
strcat(s1,"k");
strcpy(s2,directories[udir[curdir].subnum].path);
strcat(s2,u->filename);
if (!exist(s2))
strcpy(s1,"BEG ");
for (i=0; i<5-strlen(s1); i++)
strcat(s," ");
strcat(s,s1);
itoa((u->points),s1,10);
for (i=0; i<3-strlen(s1); i++)
strcat(s," ");
strcat(s,s1);
strcat(s,"pts");
} else
strcat(s,"UNVALIDATED");
strcat(s," :");
strcat(s,u->description);
pla(s,abort);
if ((!*abort) && (thisuser.num_extended) && (u->mask & mask_extended))
print_extended(u->filename,abort,thisuser.num_extended,1);
if (!(*abort))
++num_listed;
}
}
FOUTH
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
void upload(int dn)
{
directoryrec d;
uploadsrec u,u1;
.
.
.
u.ownerusr=usernum;
u.ownersys=0;
u.numdloads=0;
u.filetype=0;
u.mask=0;
++ u.points=-1;
strcpy(u.upby,nam1(&thisuser,usernum,syscfg.systemnumber));
strcpy(u.date,date());
nl();
ok=1;
xfer=1;
.
.
.
pl("Please enter a one line description.");
outstr(": ");
@@ inputl(u.description,49);
nl();
ss=NULL;
modify_extended_description(&ss);
.
.
.
if (ok) {
l=filelength(f);
u.numbytes=l;
close(f);
++thisuser.uploaded;
thisuser.uk += ((l+1023)/1024);
++ ++thisuser.gold;
time(&l);
u.daten=l;
for (i=numf; i>=1; i--) {
SETREC(i);
.
.
.
print("Your ratio is now: ",s,"");
nl();
++ prt(7,"Here's a File Point for you until this file is validated.");
nl();
nl();
.
.
.
}
closedl();
}
FIVE
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/****************************************************************************/
int try_to_download(char *s, int dn,int title)
{
int i,ok,sent,abort,sp;
uploadsrec u;
char s1[81];
.
.
.
.
if ((printfileinfo(&u,dn)) || (strncmp(u.filename,"WWIV4",5)==0)) {
++ if (u.points!=-1) {
++ if((u.points>thisuser.gold) && (thisuser.exempt!=1)) {
++ nl();
++ prt(5,"You don't have enough File Points for this file.");
++ return(-1);
++ }
++ } else{
++ prt(3,"This file has not yet been validated.");
++ return(-1);
++ }
.
.
.
send_file(s1,&sent,&abort,u.filetype,u.filename,dn, u.numbytes);
if (sent) {
++thisuser.downloaded;
thisuser.dk += (int) ((u.numbytes+1023)/1024);
++ thisuser.gold-=u.points;
++u.numdloads;
SETREC(i);
.
.
.
else
return(1);
}
/****************************************************************************/
void removefile()
{
int i,i1,ok,rm,abort,rdlp;
char ch,s[81],s1[81];
uploadsrec u;
userrec uu;
.
.
.
read_user(u.ownerusr,&uu);
--uu.uploaded;
uu.uk -= ((u.numbytes+1023)/1024);
++ uu.gold -= u.points;
write_user(u.ownerusr,&uu);
close_user();
.
.
.
closedl();
}
SIX
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
int upload_file(char *fn, int dn)
{
directoryrec d;
uploadsrec u,u1;
int i,i1,i2,ok,f;
char s[81],s1[81],ff[81];
long l;
double ti;
.
.
.
u.ownerusr=usernum;
u.ownersys=0;
u.numdloads=0;
u.filetype=0;
u.mask=0;
++ u.points=-1;
strcpy(ff,d.path);
strcat(ff,s);
f=open(ff,O_RDONLY | O_BINARY);
l=filelength(f);
u.numbytes=l;
close(f);
strcpy(u.upby,nam1(&thisuser,usernum,syscfg.systemnumber));
strcpy(u.date,date());
if (d.mask & mask_PD)
d.mask=mask_PD;
strcpy(s,u.filename);
strcat(s,": ");
ltoa((((u.numbytes)+1023)/1024),s1,10);
strcat(s1,"k");
for (i=0; i<5-strlen(s1); i++)
strcat(s," ");
strcat(s,s1);
strcat(s," :");
outstr(s);
@@ inputl(u.description,49);
if (u.description[0]==0)
return(0);
++ prt(5,"Enter Point Value: ");
++ inputl(s,3);
++ u.points=atoi(s);
++ thisuser.gold+=atoi(s);
.
.
.
return(1);
}
SEVEN
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
void yourinfodl()
{
char s[81],s1[81],s2[81],s3[81];
itoa(thisuser.uploaded,s,10);
itoa(thisuser.downloaded,s1,10);
ltoa(thisuser.uk,s2,10);
ltoa(thisuser.dk,s3,10);
.
.
.
print("Your DSL : ",s,"");
++ itoa((int)thisuser.gold,s,10);
++ ansic(1);
++ print("File Points: ",s,"");
++ nl();
}
EIGHT
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
(IF YOU ARE USING BILBO BAGGINS Batch Dl Mod, YOU WILL HAVE TO FISH
OUT WHAT YOU CAN FROM THIS VOID.)
void batchdl()
{
int i,abort,done,i1,i2,ok,had,rr;
char s[81],ch;
double percent;
uploadsrec u;
.
.
.
sprintf(s,"%d files left, Time left = %s\r\n",numbatch,ctim(batchtime));
outs(s);
SETREC(i);
read(dlf,(void *)&u,sizeof(uploadsrec));
strcpy(s,directories[batchdir[0]].path);
strcat(s,u.filename);
++ if(thisuser.gold<u.points) {
++ prt(5,"Your File Points are too low to continue.");
endbatch();
}
xymodem_send(s,&ok,&percent,u.filetype,1,1,1);
if (ok) {
++thisuser.downloaded;
thisuser.dk += (int) ((u.numbytes+1023)/1024);
++u.numdloads;
++ thisuser.gold-=u.points;
SETREC(i);
write(dlf,(void *)&u,sizeof(uploadsrec));
strcpy(s,"Downloaded '");
strcat(s,u.filename);
strcat(s,"'");
sysoplog2(5,s,0);
.
.
.
}
} while ((!done) && (!hangup));
}
/****************************************************************************/
How to award points to a user
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
There are two ways to validate a file.
//POINTS or /P in the Transfer section.
~~~~~~~~ ~~
//POINTS: This function will allow you to change the number of points
~~~~~~~~ placed on a given file.. this is used primarily to MODIFY
existing points on a file. As it DOES NOT award points to
the user that uploaded it.
/P: This function is what you should use on a file upon seeing it
~~ in your Newscan, or marked as 'UNVALIDATED' this will allow
you to assign points to a file, and at the same time, award
this number of points to that user's account.
Upon upload, a file is assigned the value of -1, which the BBS will recog-
nize, as UNVALIDATED, and no one will be able to download this file, until
you assign a point value to it.. (which can be -999 to 999 if you wish). The
user is given ONE file point upon upload. This will eventually work in his
favor, but you aren't a tyrant are you?
<DISCLAIMER>
I KNOW I'm not repsonsible for anything that happens to your computer,
or your wife, or your mother. So.. There's really no need for me to go
into a lengthy explaination...
<Credits>
Thanks goes to Peter Norton for writing this awesome Editor.
Thanks of COURSE to Wayne Bell.
Donations are appreciated.. Make checks payable to 1@13123Lnk heh
South of Heaven BBS
301-939-5195
-------------------------------------------------------------------------------
File Points v2.0
Additions..
/*****************************************************************************
Crap.. i cant belive i forgot this part.. add this case to
void uedit, in file SYSOPF.C
*****************************************************************************/
case 'F':
prt(2,"New File Points: ");
input(s,4);
i=atoi(s);
u.gold=i;
write_user(un,&u);
break;
<EOF>