home *** CD-ROM | disk | FTP | other *** search
- /*--------------------------------------------------------------------------*/
- /* */
- /* XBBS SOURCE CODE copyright (c) 1990 by M. Kimes */
- /* All Rights Reserved */
- /* */
- /* For complete details of the licensing restrictions, please refer */
- /* to the License agreement, which is published in its entirety in */
- /* the in the file LICENSE.XBS. */
- /* */
- /* USE OF THIS FILE IS SUBJECT TO THE RESTRICTIONS CONTAINED IN THE */
- /* XBBS LICENSING AGREEMENT. IF YOU DO NOT FIND THE TEXT OF */
- /* THIS AGREEMENT IN ANY OF THE AFOREMENTIONED FILES, OR IF YOU DO */
- /* NOT HAVE THESE FILES, YOU SHOULD IMMEDIATELY CONTACT M. KIMES */
- /* AT THE ADDRESS LISTED BELOW. IN NO EVENT SHOULD YOU PROCEED TO USE */
- /* THIS FILE WITHOUT HAVING ACCEPTED THE TERMS OF THE XBBS LICENSING */
- /* AGREEMENT, OR SUCH OTHER AGREEMENT AS YOU ARE ABLE TO REACH WITH */
- /* M. KIMES */
- /* */
- /* */
- /* You can contact M. Kimes at the following address: */
- /* */
- /* M. Kimes 1:380/16.0@FidoNet */
- /* 542 Merrick (318)222-3455 data */
- /* Shreveport, LA 71104 */
- /* */
- /* */
- /* Please feel free to contact me at any time to share your comments about */
- /* my software and/or licensing policies. */
- /* */
- /*--------------------------------------------------------------------------*/
- /*======================================================================*/
- /* XBBS Bulletin Board System.....User routines */
- /*======================================================================*/
-
- #include "msg.h"
- #include "xext.h"
-
-
-
- void pascal userlist (word type) {
-
- int handlec;
- int handleu;
- char line[82];
- struct _user check;
- struct ffblk f;
- char p[37];
- char pp[39];
- char t;
- char *ptr=NULL;
- word temp;
- register word y;
- register word x;
-
- if (findfirst(searchpath("users.bbs"),&f,0)) return;
- t=conf.numcomps;
- if (t) if (findfirst(searchpath("comtypes.lst"),&filestat,0)) t=0;
- if (!(type & 4) && !(type & 8)) {
- gprintf(0,"\nThere are %lu users. ",f.ff_fsize/(ulong)sizeof(struct _user));
- printm("Search string? ([Enter] for full list)\n -> ");
- helpnum=534;
- strcpy(p,genin(36,0,0,0,ALPHA));
- helpnum=0;
- }
- else {
- if (!(msg.attr & MSGLOCAL)) {
- say_prompt(395);
- return;
- }
- if (msg.m_attr & MSGANON) {
- say_prompt(396);
- return;
- }
- if (type & 4) strcpy(p,msg.from);
- else strcpy(p,msg.to);
- if (mboard.attr & REAL) type = type | 1;
- else type = type & (~1);
- }
- if (!stricmp(p,"*ANONYMOUS*")) {
- say_prompt(397);
- return;
- }
- if (!strcmp(p,"ALL") || !strcmp(p,"SYSOP")) {
- say_prompt(398);
- return;
- }
- if ((handleu=oopen(searchpath("users.bbs"),O_RDONLY | O_BINARY | O_DENYNONE))==-1) {
- gprintf(LOCALONLY,"\n\04Userfile error--%d\n",errno);
- }
- else {
- say_prompt(385);
- if (t) say_prompt(386);
- printm("\n");
- say_prompt(389);
- say_prompt(387);
- if (t) say_prompt(388);
- printm("\n");
-
- ptr=(char *)mmalloc((word)5377);
- if (!ptr) {
- t=0;
- }
- else {
- memset(ptr,0,5376);
- if ((handlec=oopen(searchpath("comtypes.lst"),O_RDONLY | O_TEXT | O_DENYNONE))==-1) {
- t=0;
- }
- else {
- strcpy(ptr,"Unknown");
- for (x=1;x<256;x++) {
- if (eof(handlec) || !fgetsx(line,81,handlec)) break;
- stripcr(line);
- line[20]=0;
- strcpy(&ptr[x*21],line);
- }
- cclose(handlec);
- }
- }
- }
- pauser=1;
- lines=3;
- while (!eof(handleu) && _read(handleu,&check,sizeof(check))>0) {
- if (type & 1) strcpy(check.handle,check.name);
- strcpy(pp,check.handle);
- if (((stristr(check.handle,p)) || (!*p)) && (!check.deleted) && (check.stat[0]>0)) {
- if ((type & 4) || (type & 8)) {
- if (stricmp(check.handle,p)) continue;
- }
- temp=strlen(pp);
- for(y=0;y<(37-temp);y++) strcat(pp,".");
- sprintf(line,"%s%s %s ",pp,saydate(&check.lastdate),saytime(&check.lasttime));
- if (t) strcat(line,&ptr[check.comptype * 21]);
- strcat(line,"\n");
- if ((printm(line)) || (toupper(inkey())=='S')) break;
- sprintf(line," %s %s",check.city,check.state);
- sprintf(pp,"%u calls",check.times);
- temp=(strlen(check.city)+strlen(check.state)+3);
- for (y=0;y<(43-temp);y++) strcat(line," ");
- strcat(line,pp);
- strcat(line,"\n");
- if ((printm(line)) || (toupper(inkey())=='S')) break;
- if ((type & 4) || (type & 8)) break;
- }
- }
- pauser=0;
- cclose(handleu);
- if (ptr) ffree (ptr);
- }
-
-
- void pascal load_lastread (void) {
-
- int fp;
-
- sprintf(buffer,"%sLASTREAD.BBS",messpath);
- if ((fp=oopen(buffer,O_RDONLY | O_BINARY | O_DENYNONE))==-1) return;
- lseek(fp,(long)(userno-1)*(long)(conf.nolmrs)*(long)sizeof(word),SEEK_SET);
- _read(fp,(void far *)lastread,conf.nolmrs*sizeof(word));
- cclose(fp);
- }
-
-
-
- void pascal save_lastread (void) {
-
- int fp;
-
- sprintf(buffer,"%sLASTREAD.BBS",messpath);
- if ((fp=oopen(buffer,O_RDWR | O_BINARY | O_DENYNONE))==-1)
- if ((fp=ccreat(buffer,S_IWRITE))==-1) return;
- lseek(fp,(long)(userno-1)*(long)(conf.nolmrs)*(long)sizeof(word),SEEK_SET);
- _write(fp,(word far *)lastread,conf.nolmrs*sizeof(word));
- cclose(fp);
- }
-
-
-
-
- void pascal trashcan (char *name) {
-
- char check[81];
- char test[37];
- char *a;
- char *b;
- int handle;
-
- *check=0;
- strcpy(test,name);
- if ((handle=oopen(searchpath("trashcan.ctl"),O_RDONLY | O_TEXT | O_DENYNONE))==-1) return;
-
- while (!eof(handle)) {
- if(!fgetsx(check,81,handle)) break;
- if (strlen(check)<2) goto skipcheck;
- stripcr(check);
-
- if (!stricmp(name,check)) {
- badname:
- cclose(handle);
- user.violations++;
- leaving++;
- readfile("trashcan.xbs",0,0,1);
- say_prompt(337);
- fossil(FLUSHOUT,0);
- fossil(DTR,DOWN);
- logoff();
- userno=0;
- baud=0;
- exit(254);
- }
- a=check;
- if (*a==':') if (stristr(test,++a)) goto badname;
- if (*a==';') {
- b=strtok(test," ");
- b=strtok(0," ");
- if (!(stricmp(test,++a)) || (!stricmp(b,a))) goto badname;
- strcpy(test,name);
- }
- skipcheck:
- ;
- }
- cclose(handle);
- }
-
-
-
- void pascal logoff (void) { /* Update user account */
-
- conf.trace=0;
- if (userno) {
- say_prompt(19);
- user.arq=0;
- user.times++;
- user.callstoday++;
- user.timetoday+=(word)(getxbbstime()/60L);
- if ((user.lastdate.da_day)!=(user.logondate.da_day)) {
- user.callstoday=1;
- timer_off++;
- user.timetoday=(word)(getxbbstime()/60L);
- timer_off=0;
- }
- getdate(&user.lastdate);
- gettime(&user.lasttime);
- user.lastmsgarea=mboard.number;
- update();
- conf.callcount++;
- strcpy(conf.lastcaller,user.name);
- conf.lastusernum=userno;
- conf.lastcall=time(NULL);
- saveconfig();
- }
- fossil(FLUSHOUT,0);
- fossil(DTR,DOWN);
- }
-
-
-
- void pascal userinfo (word baudrate,char type) { /* Writes Door exit files */
-
- int handle,handle2;
- char temp[38];
- char tempname[36];
- char *p=NULL;
- word temptime;
- char nodes[]="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
-
- if (!baudrate) baudrate=baud;
- if (type) strcpy(tempname,user.handle);
- else strcpy(tempname,user.name);
-
- temptime=(word)(timelimit-(getxbbstime()/60))-(word)1;
- if (temptime>(word)(timelimit-(getxbbstime()/60)) || timelimit<(word)(getxbbstime()/60)) temptime=0;
-
- if ((handle=ccreat("USERINFO.XBS",S_IWRITE))==-1) {
- gprintf(LOCALONLY,"\n\04Can't create USERINFO.XBS--%d\n",errno);
- goto Next1;
- }
- ffprintf(handle,"%s\r\n%u\r\n",tempname,baudrate);
- ffprintf(handle,"%s\r\n%s\r\n",saydate(&user.lastdate),saytime(&user.lasttime));
- ffprintf(handle,"%s\r\n%s\r\n",saydate(&user.logondate),saytime(&user.logontime));
- ffprintf(handle,"%lu\r\n%u\r\n%u\r\n%hu\r\n%u\r\n%hu\r\n",user.times,(user.graphics),temptime,pages,(word)user.credit,user.length);
- cclose(handle);
-
- Next1:
-
- sprintf(temp,"dorinfo%c.def",nodes[nodenumber%36]);
- unlink(temp);
- *temp='q';
- if ((handle=ccreat(temp,S_IWRITE))==-1) {
- gprintf(LOCALONLY,"\n\04%s open error--%d\n",temp,errno);
- goto Next2;
- }
- *temp='r';
- if ((handle2=ccreat(temp,S_IWRITE))==-1) {
- gprintf(LOCALONLY,"\n\04%s open error--%d\n",temp,errno);
- cclose(handle);
- *temp='q';
- unlink(temp);
- goto Next2;
- }
- strcpy(temp,conf.sysop);
- p=split(temp,p);
- ffprintf(handle,"%s\r\n%s\r\n%s",conf.system,temp,p);
- strupr(temp);
- strupr(p);
- ffprintf(handle2,"%s\r\n%s\r\n%s",conf.system,temp,p);
- if (!baud) {
- ffprintf(handle,"\r\nCOM0\r\n");
- ffprintf(handle2,"\r\nCOM0\r\n");
- }
- else {
- ffprintf(handle,"\r\nCOM%u\r\n",conf.commport+1);
- ffprintf(handle2,"\r\nCOM%u\r\n",conf.commport+1);
- }
- strcpy(temp,tempname);
- p=split(temp,p);
- ffprintf(handle,"%u BAUD,N,8,1\r\n0\r\n%s\r\n%s\r\n%s, %s\r\n",baudrate,temp,p,user.city,user.state);
- strupr(temp);
- strupr(p);
- if(!baud) ffprintf(handle2,"9600 BAUD,N,8,1\r\n0\r\n%s\r\n%s\r\n%s, %s\r\n",temp,p,user.city,user.state);
- else ffprintf(handle2,"%u BAUD,N,8,1\r\n0\r\n%s\r\n%s\r\n%s, %s\r\n",baudrate,temp,p,user.city,user.state);
- if(user.graphics) ffprintf(handle2,"2\r\n");
- else if (user.hiok) ffprintf(handle2,"1\r\n");
- else ffprintf(handle2,"0\r\n");
- ffprintf(handle,"%hu\r\n",user.graphics);
- ffprintf(handle,"%u\r\n%u\r\n",user.stat[0],temptime);
- ffprintf(handle2,"%u\r\n%u\r\n",user.stat[0],temptime);
- ffprintf(handle2,"1\r\n");
- cclose(handle);
- cclose(handle2);
- {
- char temp2[38];
-
- sprintf(temp,"dorinfo%c.def",nodes[nodenumber%36]);
- strcpy(temp2,temp);
- if(conf.RBBSorQBBS)*temp2='r';
- else *temp2='q';
- rename(temp2,temp);
- }
-
- Next2:
-
- if (!strchr(tempname,' ')) strcpy(tempname,user.name);
-
- if ((handle=ccreat("DOOR.SYS",S_IWRITE))==-1) {
- gprintf(LOCALONLY,"\n\04DOOR.SYS open error--%d\n",errno);
- return;
- }
- baud ? ffprintf(handle,"COM%u\r\n",conf.commport+1) : ffprintf(handle,"COM0\r\n");
- ffprintf(handle,"%u\r\n8\r\n%hu\r\nN\r\nY\r\nN\r\n",baudrate,nodenumber);
- conf.sysopin ? ffprintf(handle,"Y") : ffprintf(handle,"N");
- ffprintf(handle,"\r\nN\r\n%s\r\n%s, %s\r\n%s\r\n",tempname,user.city,user.state,user.phone1);
- ffprintf(handle,"%s\r\n%s\r\n%u\r\n%hu\r\n",user.phone2,user.password,user.stat[0],user.times);
- ffprintf(handle,"%s\r\n%lu\r\n%u\r\n",saydate(&user.lastdate),temptime*60,temptime);
- user.graphics ? ffprintf(handle,"GR") : ffprintf(handle,"NG");
- ffprintf(handle,"\r\n%hu\r\n",user.length);
- user.expert ? ffprintf(handle,"Y") : ffprintf(handle,"N");
- ffprintf(handle,"\r\nABCDEFG\r\n%u\r\n01/01/99\r\n%u\r\nZ\r\n",mboard.number,userno);
- ffprintf(handle,"%lu\r\n%lu\r\n%u\r\n%u\r\n999999\r\n",user.upk,user.downk,user.dktoday);
- cclose(handle);
-
- prepare();
- }
-
-
- void pascal city (void) {
-
- char *p=0;
-
- do {
- helpnum=512;
- p=genin(23,0,0,0,NEAT);
- rstrip(p);
- if (strlen(p)<3) printm("\n-> ");
- }
- while (strlen(p)<3);
- strcpy(user.city,p);
- helpnum=0;
- }
-
- void pascal state (void) {
-
- char *p=0;
-
- if (conf.genstatezip==0) {
- do {
- helpnum=513;
- p=genin(2,0,1,0,ALPHA);
- if (strlen(p)!=2) backup(p);
- }
- while (strlen(p)!=2);
- strcpy(user.state,p);
- }
- else {
- helpnum=514;
- p=genin(8,0,0,0,ALPHANUM);
- strcpy(user.state,p);
- }
- helpnum=0;
- }
-
- void pascal zip (void) {
-
- char *p=0;
-
- if (conf.genstatezip) return;
- do {
- helpnum=515;
- p=genin(5,0,0,0,NUM);
- if (strlen(p)!=5) backup(p);
- } while (strlen(p)!=5);
- strcpy(user.zip,p);
- helpnum=0;
- }
-
-
- void pascal phone1 (void) {
-
- char *p=0;
-
- do {
- helpnum=516;
- p=genin(10,0,1,0,PHONE);
- if (strlen(p)!=10) printm("\n-> ");
- } while (strlen(p)!=10 && !conf.genphone);
- strcpy(user.phone1,p);
- helpnum=0;
- }
-
-
- void pascal phone2 (void) {
-
- char *p=0;
-
- do {
- helpnum=517;
- p=genin(10,0,1,0,PHONE);
- if (strlen(p)!=10) printm("\n-> ");
- } while (strlen(p)!=10 && !conf.genphone);
- strcpy(user.phone2,p);
- helpnum=0;
- }
-
-
- void pascal length (void) {
-
- char *p=0;
-
- do {
- helpnum=518;
- p=genin(2,0,1,0,NUM);
- if ((atoi(p)<10) || (atoi(p)>66)) backup(p);
- } while ((atoi(p)<10) || (atoi(p)>66));
- user.length=atoi(p);
- helpnum=0;
- }
-
-
- void pascal width (void) {
-
- char *p=0;
-
- do {
- helpnum=519;
- p=genin(2,0,1,0,NUM);
- if ((atoi(p)<32) || (atoi(p)>80)) backup(p);
- } while ((atoi(p)<32) || (atoi(p)>80));
- user.width=atoi(p);
- helpnum=0;
- }
-
-
- void pascal usertoggle (word a) {
-
- if (((conf.ansiavail == 'N') || ((baud < conf.ansibaud) && (baud))) && (a==GRAPHICS)) {
- say_prompt(98);
- return;
- }
-
- if (((!user.graphics) || (*conf.edansi==0)) && (a==FULLSCREEN)) {
- say_prompt(98);
- return;
- }
- if (baud) if ((baud<conf.ansibaud) && (a==GRAPHICS)) {
- say_prompt(98);
- return;
- }
- if ((a==DELETED) && (user.nokill)) {
- if (conf.debug) say_prompt(99);
- return;
- }
-
- switch (a) {
- case GRAPHICS:
- user.graphics=1-user.graphics;
- _close(indexhandle);
- _close(prompthandle);
- indexhandle=prompthandle=-1;
- user.graphics ? say_prompt(101) : say_prompt(102);
- break;
- case FULLSCREEN:
- user.fullscreen=1-user.fullscreen;
- user.fullscreen ? say_prompt(104) : say_prompt(105);
- break;
- case SCRNCLR:
- user.scrnclr=1-user.scrnclr;
- user.scrnclr ? say_prompt(107) : say_prompt(108);
- break;
- case EXPERT:
- user.expert=1-user.expert;
- user.expert ? say_prompt(110) : say_prompt(111);
- break;
- case COMMODORE:
- user.commodore=1-user.commodore;
- if (conf.debug) user.commodore ? say_prompt(112) : say_prompt(113);
- break;
- case TWIT:
- user.twit=1-user.twit;
- if (conf.debug) user.twit ? say_prompt(114) : say_prompt(115);
- break;
- case DELETED:
- user.deleted=1-user.deleted;
- if (conf.debug) user.deleted ? say_prompt(116) : say_prompt(117);
- break;
- case IGNOREHRS:
- user.ignorehrs=1-user.ignorehrs;
- if (conf.debug) user.ignorehrs ? say_prompt(118) : say_prompt(119);
- break;
- case IGNORERAT:
- user.ignorerat=1-user.ignorerat;
- if (conf.debug) user.ignorerat ? say_prompt(120) : say_prompt(121);
- break;
- case NOKILL:
- user.nokill=1-user.nokill;
- if (conf.debug) user.nokill ? say_prompt(122) : say_prompt(123);
- break;
- case MORE:
- user.more=1-user.more;
- user.more ? say_prompt(125) : say_prompt(126);
- break;
- case ARQ:
- user.arq=1-user.arq;
- user.arq ? say_prompt(128) : say_prompt(129);
- break;
- case ANSIMENUS:
- user.ansimenus=1-user.ansimenus;
- user.ansimenus ? say_prompt(131) : say_prompt(132);
- break;
- case GEN1:
- user.gen1=1-user.gen1;
- user.gen1 ? say_prompt(133) : say_prompt(134);
- break;
- case GEN2:
- user.gen2=1-user.gen2;
- user.gen2 ? say_prompt(135) : say_prompt(136);
- break;
- case GEN3:
- user.gen3=1-user.gen3;
- user.gen3 ? say_prompt(137) : say_prompt(138);
- break;
- }
- }
-
-
- void pascal usertoggle2 (word a, char b) {
-
- if(b==16) {
- user.cold=1-user.cold;
- user.cold ? say_prompt(439) : say_prompt(469);
- return;
- }
- if (b==17) {
- user.hiok=1-user.hiok;
- user.hiok ? say_prompt(476) : say_prompt(491);
- return;
- }
- user.attr2 = user.attr2 ^ a;
- if (conf.debug) {
- gprintf(LOCALONLY,"\n\x4#%hu ",b);
- (user.attr2 & a) ? say_prompt(139) : say_prompt(140);
- }
- }
-
-
- void pascal handler (void) {
-
- int handle;
- struct _user check;
- char exist;
- struct ffblk f;
- char *r=0;
- word register x=0;
- char tempsafe;
-
- goto handleonce;
-
- handleagain:
-
- say_prompt(141);
- helpnum=520;
- if (*genin(1,0,1,1,YESNO)!='Y') {
- strcpy(user.handle,user.name);
- helpnum=0;
- return;
- }
- handleonce:
- r=NULL;
- while ((r==NULL) || (strlen(r)<3)) {
- say_prompt(142);
- helpnum=521;
- r=genin(35,0,0,0,NAME);
- rstrip(r);
- if (!strlen(r)) {
- strcpy(user.handle,user.name);
- helpnum=0;
- return;
- }
- }
- if(!strcmp(r,user.handle) || !strcmp(r,user.name)) {
- strcpy(user.handle,r);
- return;
- }
- say_prompt(143);
- exist=findfirst(searchpath("users.bbs"),&f,0);
- if ((handle=oopen("users.bbs",O_RDONLY | O_BINARY | O_DENYNONE))==-1) {
- say_prompt(144);
- strcpy(user.handle,user.name);
- return;
- }
- tempsafe=safe;
- safe=0;
- if (!exist && f.ff_fsize) {
- while (!eof(handle)) {
- x++;
- if (!(x%50)) printm(".");
- if (_read(handle,&check,sizeof(check))<1) break;
- if (check.deleted) continue;
- if (!strcmp(r,check.handle)) break;
- if (!strcmp(r,check.name)) break;
- }
- cclose(handle);
- safe=tempsafe;
- printm("\n");
- if ((!strcmp(r,check.handle) || !strcmp(r,check.name)) && !check.deleted) {
- say_prompt(145);
- goto handleagain;
- }
- }
- strcpy(user.handle,r);
- trashcan(r);
- update();
- }
-
-
- void pascal password (void) {
-
- char p[13];
- char *r;
-
- passagain:
-
- say_prompt(146);
- helpnum=522;
- strcpy(p,genin(11,1,0,0,ALPHANUM));
- rstrip(p);
- if (strlen(p)<3) {
- say_prompt(147);
- goto passagain;
- }
- say_prompt(148);
- helpnum=523;
- r=genin(11,1,0,0,ALPHANUM);
- rstrip(r);
- if(strcmp(p,r)==0) {
- strcpy(user.password,p);
- helpnum=0;
- return;
- }
- say_prompt(149);
- goto passagain;
- }
-
-
- void pascal getonline (void) {
-
- int fp;
- char s[90];
- char numnode[4]="";
-
- if (nodenumber!=1) sprintf(numnode,"%hu",nodenumber);
- sprintf(s,"%sonline%s.xbs",conf.homepath,numnode);
- if ((fp=oopen(s,O_RDONLY | O_BINARY | O_DENYNONE))==-1)
- gprintf(LOCALONLY | LOGONLY,"Can't open %s!--%d",s,errno);
- else {
- _read(fp,&user,sizeof(struct _user));
- _read(fp,&userno,sizeof(userno));
- _read(fp,&timelimit,sizeof(timelimit));
- _read(fp,&timeon,sizeof(timeon));
- _read(fp,&starter,sizeof(starter));
- _read(fp,&baud,sizeof(baud));
- _read(fp,&pages,sizeof(pages));
- _read(fp,&age,sizeof(age));
- _read(fp,&timer_off,sizeof(timer_off));
- _read(fp,&hold_time,sizeof(hold_time));
- _read(fp,variable,(sizeof(variable[0])*10));
- _read(fp,&mboard,sizeof(mboard));
- _read(fp,&fboard,sizeof(fboard));
- if (_read(fp,event,(sizeof(struct _events)*10))<1) {
- gprintf(LOCALONLY | LOGONLY,"Came up short!");
- goto FatalError;
- }
- }
- if (eof(fp)==-1) {
- FatalError:
- cclose(fp);
- say_prompt(150);
- fossil(FLUSHOUT,0);
- fossil(DTR,DOWN);
- baud=0;
- exit(253);
- }
- cclose(fp);
- load_lastread();
- }
-
-
- char * pascal split (char *a,char *b) /* a=string to split, b is pointer */
-
- {
- if ((b=strchr(a,' '))) {
- *b=0;
- return(++b);
- }
- else return "";
- }
-
-
-
- void pascal update (void) { /* Updates entry in users.bbs */
-
- int handle;
-
- if (!userno) return;
- rstrip(user.name);
- rstrip(user.handle);
- rstrip(user.phone1);
- rstrip(user.phone2);
- rstrip(user.city);
- rstrip(user.password);
- rstrip(user.state);
- if ((handle=oopen(searchpath("users.bbs"),O_RDWR | O_BINARY | O_DENYNONE))==-1) {
- if ((handle=ccreat("users.bbs",S_IWRITE))==-1) {
- lprint("\n\04Can't create USERS.BBS\n");
- return;
- }
- }
- if(lseek(handle,(long)sizeof(struct _user)*(long)(userno-1),0)==-1) {
- gprintf(0,"\n\04Seek error USERS.BBS--%d\n",errno);
- return;
- }
- _write(handle,&user,sizeof(struct _user));
- cclose(handle);
- save_lastread();
- }
-
-
- void pascal comptype (void) /* Handles changing/setting type of
- computer used by user */
-
- {
-
- char text[91];
-
- if (!conf.numcomps) { /* If config set to 0 insult sysop :-) */
- say_prompt(422);
- return;
- }
- user.comptype=0;
- while (!user.comptype) {
- say_prompt(394);
- sprintf(text,"%s%s",conf.menupath,"comtypes.xbs");
- if (!findfirst(text,&filestat,0)) readfile("comtypes.xbs",0,0,1);
- printm("\n -> ");
- helpnum=532;
- user.comptype=(byte)atoi(genin(3,0,0,0,NUM));
- helpnum=0;
- if ((user.comptype<1) || (user.comptype>conf.numcomps)) user.comptype=0;
- }
- }
-
-
- void pascal user_param (char a) {
-
- char d[48];
- char *cm;
-
- switch (a) {
- case 'f': /* FIRST NAME */
- if (!strchr(user.handle,' ')) {
- printm(user.handle);
- }
- else {
- strcpy(d,user.handle);
- cm=split(d,cm);
- printm(d);
- }
- break;
- case 'l': /* LAST NAME */
- if (!strchr(user.handle,' ')) {
- printm(user.handle);
- }
- else {
- strcpy(d,user.handle);
- cm=split(d,cm);
- printm(cm);
- }
- break;
- case 'w': /* WHOLE NAME */
- printm(user.handle);
- break;
- case 'N': /* REAL NAME */
- printm(user.name);
- break;
- case 'n': /* NUMBER OF TOTAL CALLS */
- gprintf(0,"%lu",(user.times+1));
- break;
- case'm': /* NUMBER OF CALLS TODAY */
- gprintf(0,"%u",(user.callstoday+1));
- break;
- case'o': /* NUMBER OF CALLS REMAINING */
- gprintf(0,"%u",(user.callsperday-(user.callstoday+1)));
- break;
- case'p': /* NUMBER OF CALLS PER DAY */
- gprintf(0,"%u",(user.callsperday));
- break;
- case'c': /* TIME PER CALL */
- gprintf(0,"%u",(user.timepercall));
- break;
- case't': /* TOTAL TIME PER DAY */
- gprintf(0,"%u",(user.totaltime));
- break;
- case's': { /* LAST CALL DATE */
- printm(saydate(&user.lastdate));
- break;
- }
- case 'a': { /* LAST CALL TIME */
- printm(saytime(&user.lasttime));
- break;
- }
- case 'F': /* TIME USED SO FAR TODAY */
- gprintf(0,"%u",(word)(user.timetoday+(getxbbstime()/60L)));
- break;
- case 'u':
- gprintf(0,"%-05u",user.upno);
- break;
- case 'U':
- gprintf(0,"%lu",user.upk);
- break;
- case 'd':
- gprintf(0,"%-05u",user.downno);
- break;
- case 'D':
- gprintf(0,"%lu",user.downk);
- break;
- case 'A':
- gprintf(0,"%hu",age);
- break;
- case 'L':
- if(conf.nolmrs>mboard.number) gprintf(0,"%u",lastread[mboard.number-1]);
- else printm("?");
- break;
- case 'S': printm(user.state);
- break;
- case 'C': printm(user.city);
- break;
- case 'Z': printm(user.zip);
- break;
- }
- }
-
- char pascal change_parm (char a, word secl, long fsize, long totalbytes, word nofiles, char *b) {
-
- switch (a) {
- case 'A': /* ANSI menu flag */
- usertoggle(ANSIMENUS);
- break;
- case 'F': /* Flags 1-16 */
- a=(char)atoi(b);
- if (a<1 || a>18) return 0; /* & cold/hiok */
- secl=1;
- secl=secl<<(--a);
- usertoggle2(secl,a);
- return 1;
- case 'G': /* General flags 1-3 */
- a=atoi(b);
- if (a<1 || a>3) return 0;
- secl=1;
- secl=secl<<(12+a);
- usertoggle(secl);
- return 1;
- case 'p': /* PASSWORD */
- password();
- break;
- case 'h': /* HANDLE */
- handler();
- break;
- case 'l': /* LENGTH */
- length();
- break;
- case 'w': /* WIDTH */
- width();
- break;
- case '1': /* PHONE1 */
- phone1();
- break;
- case '2': /* PHONE2 */
- phone2();
- break;
- case 'z': /* ZIPCODE */
- zip();
- break;
- case 's': /* STATE */
- state();
- break;
- case 'c': /* CITY */
- city();
- break;
- case 'g': /* ANSI */
- usertoggle(GRAPHICS);
- break;
- case 'm': /* MORE */
- usertoggle(MORE);
- break;
- case 'r': /* SCRNCLR */
- usertoggle(SCRNCLR);
- break;
- case 'x': /* EXPERT */
- usertoggle(EXPERT);
- break;
- case 'o': /* COMMODORE */
- usertoggle(COMMODORE);
- break;
- case 'f': /* FULLSCREEN */
- usertoggle(FULLSCREEN);
- break;
- case 'u': /* UPNO */
- user.upno+=secl;
- return 1;
- case 'd': /* DOWNNO */
- user.downno+=secl;
- return 1;
- case 'U': /* UPK */
- user.upk+=(fsize/1024L);
- user.uktoday+=(word)(fsize/1024L);
- break;
- case 'D': /* DOWNK */
- user.downk+=(fsize/1024L);
- user.dktoday+=(word)(fsize/1024L);
- break;
- case 't': /* TWIT */
- usertoggle(TWIT);
- break;
- case 'M': /* ARQ */
- usertoggle(ARQ);
- break;
- case 'k': /* DELETED */
- usertoggle(DELETED);
- break;
- case 'n': /* NOKILL */
- usertoggle(NOKILL);
- break;
- case 'R': /* RATIO */
- usertoggle(IGNORERAT);
- break;
- case 'H': /* HOURS */
- usertoggle(IGNOREHRS);
- break;
- case 'C': /* COMPUTER TYPE */
- comptype();
- return 1;
- case 'K': /* Add total file len to user downk */
- user.downk+=(totalbytes/1024L);
- user.dktoday+=(word)(totalbytes/1024L);
- break;
- case 'L': /* Add total files to user downno */
- user.downno+=(word)(nofiles);
- }
- return 0;
- }
-
-
- char pascal system_parms (char a, char b) {
-
- char d[133];
-
- switch (a) {
- case 'l':
- if (!stricmp(conf.lastcaller,user.handle)) printm("you");
- else printm(conf.lastcaller);
- break;
- case 's':
- if (conf.sysopin) say_prompt(390);
- else say_prompt(391);
- break;
- case 'n':
- printm(conf.system);
- break;
- case '#': {
- struct ffblk f;
- sprintf(d,"%sXDATA.%03x",messpath,mboard.number);
- if (findfirst(d,&f,0)) printm("0");
- else gprintf(0,"%01lu",f.ff_fsize/(long)sizeof(struct _msg));
- break;
- }
- case 'c':
- gprintf(0,"%01lu",conf.callcount);
- break;
- case 'd': {
-
- struct dfree drivefree;
-
- if (b<'A' || b>'Z') break;
- getdfree((b-'@'),&drivefree);
- gprintf(0,"%lu",(long)drivefree.df_avail*(drivefree.df_bsec*drivefree.df_sclus));
- return 1;
- }
- case 'M':
- printm(mboard.name);
- break;
- case 'F':
- printm(fboard.name);
- break;
- }
- return 0;
- }
-
-
- void pascal chat (void) { /* Ultra-cheap chat mode */
-
- char a;
- char temp;
- char last=0;
-
- if (readfile("chaton.xbs",0,0,1)==2) say_prompt(190);
- adjust_time(0);
- printg("\x1b[0;1;33m");
- {
- int p;
-
- if(user.graphics) {
- for(p=wherey();p<(int)(user.length+1);p++) {
- if(p<24) printm("\x1b[K");
- else mprint("\x1b[K");
- if(p<23) printm("\n");
- else mprint("\x1b[K");
- }
- if(user.length<23) {
- for(p=(int)user.length;p<24;p++) {
- lprint("\x1b[K");
- if(p<23) lprint("\n");
- }
- }
- }
- else for(p=wherey();p<23;p++) fputs("\n\x1b[K",stdout);
- gotoxy(1,23);
- }
- while (chatting) {
- a=inkey();
- if(!a) continue;
- if (chatting) {
- r.h.ah=3;
- r.h.bh=0;
- int86(16,&r,&r);
- temp=r.h.dl;
- if(whotyped!=last) {
- if(!whotyped) printg("\x1b[0;1;33m");
- else printg("\x1b[0;1;36m");
- last=whotyped;
- }
- if (a==13) printm("\n");
- if (a==13 || (a==' ' && temp>70)) printm("\n");
- else gprintf(0,"%c",a);
- }
- }
-
- if (readfile("chatoff.xbs",0,0,1)==2) say_prompt(191);
- chatted++;
- adjust_time(1);
- }
-
-