JAFO14.MOD - The Multiple UL/DL Ratios Mod JAFO #1 @18868 Sat Feb 27 1993 19:44:28 ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ ³ Mod Name : JAFO14.MOD Mod Author: JAFO 1@1 TerraNET ³ ³ Difficulty : ÛÛÛÛÛÛ±±±± 1@8857 IceNET ³ ³ WWIV Version : 4.22 1@8861 WWIVnet ³ ³ Mod Date : 02/27/93 1@18868 WWIVLink ³ ³ Files Affected: BATCH.C, BBS.C, DIREDIT.C, SR.C, XFER.C, XFERTMP.C, ³ ³ XINIT.C, FCNS.H, VARS.H ³ ³ Description : The Multiple UL/DL Ratios Mod ³ ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ ÍÍ[ Description ]ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ This modification will enable you to set up different upload/download ratios for each directory on your system. You can even give directories a ratio of 0.000, which would mean they are free. So if you are using JAFO10, my Free Download Directories mod, then you should remove it. ÍÍ[ Legend ]ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ = Existing line - Do not change + Add this line - Remove this line ÍÍ[ Step 1 ]ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ Please back up your source code. Even the best programmers make mistakes. ÍÍ[ Step 2 ]ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ In BATCH.C, make the following changes in "void ymbatchdl". = rr=0; = do { = tleft(1); - if ((syscfg.req_ratio>0.0001) && (ratio()0.0001) && + (ratio()0.0001) && (ratio1(addk+thisk)0.0001) && + (ratio1(addk+thisk)=n; i--) { = directories[i+1]=directories[i]; = dir_dates[i+1]=dir_dates[i]; + dir_ratios[i+1]=dir_ratios[i]; = } = strcpy(r.name,get_string(159)); = strcpy(r.filename,get_string(82)); = strcpy(r.path,syscfg.dloadsdir); = r.dsl=10; = r.age=0; = r.maxfiles=50; = r.dar=0; = r.type=0; = r.mask=0; = directories[n]=r; = ++num_dirs; = + dir_ratios[n]=syscfg.req_ratio; + save_dir_ratios(); + = nu=number_userrecs(); = close_user(); ÍÍ[ Step 10 ]ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ In "void delete_dir", add the lines shown. = void delete_dir(int n) = { = int i,i1,i2,nu; = unsigned long *qsc, *qsc_n, m2, m3; = = for (i=n; i=MAX_BATCH) { = nl(); = pl(get_string(900)); ÍÍ[ Step 12 ]ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ In XFER.C, change the following lines in "int ratio_ok". - int ratio_ok(void) + int ratio_ok(int dn) = { = int ok=1; = char s[101]; = = if (!(thisuser.exempt & exempt_ratio)) - if ((syscfg.req_ratio>0.0001) && (ratio()0.0001) && (ratio()0) { for (i=0; i0) { for (i=0; i0) { for (i=0; i0) && (ok) && (!hangup)) { - if (!ratio_ok()) { + if (!ratio_ok(dn)) { = closedl(); = return(-1); = } = tleft(1); ÍÍ[ Step 15 ]ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ Still in "int try_to_download", add the following lines. = send_file(s1,&sent,&abort,u.filetype,u.filename,dn, u.numbytes); = if (sent) { - ++thisuser.downloaded; - thisuser.dk += (int) ((u.numbytes+1023)/1024); + if (!dir_ratios[dn]) { + ++thisuser.downloaded; + thisuser.dk += (int) ((u.numbytes+1023)/1024); + } = ++u.numdloads; = SETREC(i); ÍÍ[ Step 16 ]ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ In XFERTMP.C, change the following line in "void download_temp_arc". = void download_temp_arc(char *fn, int xfer) = { = char s[81],s1[81]; = long numbytes; = double d; = int i,f,sent,abort; = = outstr(get_string(847)); = npr("%s.%s:\r\n\r\n", fn, syscfg.arcs[ARC_NUMBER].extension); - if (xfer && !ratio_ok()) { + if (xfer && !ratio_ok(max_dirs)) { = pl(get_string(848)); = return; = } ÍÍ[ Step 17 ]ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ In XINIT.C, add the following lines "void init". = num_dirs=(read(i,directories, (max_dirs*sizeof(directoryrec))))/ = sizeof(directoryrec); = close(i); = + dir_ratios=(float *) mallocx((max_dirs+1)*sizeof(float),"dir_ratios"); + load_dir_ratios(); + = chains=(chainfilerec *) mallocx(50 * sizeof(chainfilerec), "chains"); = numextrn=0; ÍÍ[ Step 18 ]ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ In FCNS.H, change the following lines. = void get_arc_cmd(char *out, char *arcfn, int cmd, char *ofn); = int list_arc_out(char *fn, char *dir); - int ratio_ok(void); + int ratio_ok(int dn); = int dcs(void); + void load_dir_ratios(void); + void save_dir_ratios(void); = void dliscan1(int dn); = void dliscan_hash(int dn); ÍÍ[ Step 19 ]ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ In VARS.H, change the following line. = __EXTRN__ unsigned long *qsc, *qsc_n, *qsc_q, *qsc_p; = = - __EXTRN__ float batchtime; + __EXTRN__ float batchtime, *dir_ratios; = = __EXTRN__ double extratimecall, last_time, timeon, time_event, xtime; ÍÍ[ Step 20 ]ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ Compile your source. We have changed VARS.H so this means the board will need a full re-compile. ÍÍ[ Step 21 ]ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ Load the board and do //DIREDIT. If you want to create a new free directory, call it something like "Free Downloads" and give that directory a ratio of 0.000. By default, all directories have the ratio assigned in INIT. If you wish to change them, do so by selecting 'L' while editing a particular dir and assign it whatever ratio you like. Also, don't forget to edit your menus to reflect the new 'I' command in transfers. This will let users see what the ratio is on a particular dir. ÍÍ[ Disclaimer ]ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ Don't complain to me if your board gets fried, your hard disk goes nuts, or something terrible happens. The code in this mod should be harmless, but I can't guarantee it will work for you. It works on my board. JAFO 1@1 TerraNET 1@8857 IceNET 1@8861 WWIVnet 1@18868 WWIVLink