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.....Bulls & Msg reading */
- /*======================================================================*/
-
-
- #include "msg.h"
- #include "xext.h"
-
-
- struct _mboard far *marea=NULL;
- struct _fboard holdboard;
- struct _mboard holdmboard;
- char exporting;
- word maxareas=0;
- word higharea;
-
-
- /* Bulls-mode support routines */
-
- void pascal load_areas (char *areasfile) {
-
- register word x;
- int fphandle;
- struct ffblk f;
- char string[256];
- word tempareas=0;
- char filename[128];
- char *p;
- char *pp;
-
- maxareas=higharea=0;
- marea=NULL;
-
- if (areasfile==NULL || *areasfile==0) sprintf(filename,"%sMSGAREAS.XBS",messpath);
- else strcpy(filename,areasfile);
- if (findfirst(filename,&f,0)) {
- say_prompt(257);
- return;
- }
- if ((fphandle=oopen(filename,O_RDONLY | O_TEXT | O_DENYNONE))==-1) {
- say_prompt(258);
- return;
- }
-
- /* Find out how many areas there are */
-
- while (!eof(fphandle)) {
- if (fgetsx(string,255,fphandle)==NULL) break;
- if (*string=='\r' || *string=='\n' || *string==';' || !*string) continue;
- maxareas++;
- }
-
- lseek(fphandle,0L,SEEK_SET);
-
- /* Allocate memory for areas */
-
- marea=(struct _mboard far*)mmalloc((maxareas+1)*sizeof(struct _mboard));
- if (marea==NULL) {
- say_prompt(259);
- maxareas=0;
- cclose(fphandle);
- return;
- }
-
- /* Parse through the file */
-
- while (!eof(fphandle) && tempareas<maxareas+1) {
- BreakOut:
- if (fgetsx(string,255,fphandle)==NULL) break;
- if (*string=='\n' || *string==';' || !*string) continue;
- stripcr(string);
- strncpy(marea[tempareas].name,strtok(string,","),47);
- marea[tempareas].name[47]=0;
- marea[tempareas].attr=(word)atoi(strtok(0," ,"));
- marea[tempareas].max=(word)atoi(strtok(0," ,"));
- marea[tempareas].number=(word)atoi(strtok(0," ,"));
- marea[tempareas].substat1=(word)atoi(strtok(0," ,"));
- if(marea[tempareas].substat1>user.stat[0]) continue;
- marea[tempareas].substat2=(word)atoi(strtok(0," ,"));
- pp=strtok(0,"\n");
- p=NULL;
- if(pp && *pp) {
- if(*pp!=',') {
- p=strtok(pp,",");
- pp=strtok(0,"\n");
- }
- else pp++;
- }
- if(p!=NULL)strncpy(marea[tempareas].forceto,p,36);
- else *marea[tempareas].forceto=0;
- marea[tempareas].forceto[35]=0;
- p=NULL;
- if(pp && *pp) {
- if(*pp!=',') {
- p=strtok(pp,",");
- pp=strtok(0,"\n");
- }
- else pp++;
- }
- p=NULL;
- if(pp && *pp) {
- if(*pp!=',') {
- p=strtok(pp,",");
- pp=strtok(0,"\n");
- }
- else pp++;
- }
- if(!p) marea[tempareas].age=0;
- else marea[tempareas].age=(signed char)atoi(p);
- if(marea[tempareas].age) {
- if(marea[tempareas].age<0) {
- if(age>(char)abs(marea[tempareas].age)) continue;
- }
- else {
- if(age<(char)marea[tempareas].age) continue;
- }
- }
- p=NULL;
- if(pp && *pp) {
- if(*pp!=',') {
- p=strtok(pp,",");
- pp=strtok(0,"\n");
- }
- else pp++;
- }
- if(!p)marea[tempareas].flags=0;
- else marea[tempareas].flags=(word)atol(p);
- if(marea[tempareas].flags) {
- for(x=0;x<16;x++) {
- if(mboard.flags & (1<<x)) {
- if(!(user.attr2 & (1<<x))) {
- goto BreakOut;
- }
- }
- }
- }
- p=NULL;
- if(pp && *pp) {
- if(*pp!=',') {
- p=strtok(pp,",");
- pp=strtok(0,"\n");
- }
- else pp++;
- }
- p=NULL;
- if(pp && *pp) {
- if(*pp!=',') {
- p=strtok(pp,",");
- pp=strtok(0,"\n");
- }
- else pp++;
- }
- p=NULL;
- if(pp && *pp) {
- if(*pp!=',') {
- p=strtok(pp,",");
- pp=strtok(0,"\n");
- }
- else pp++;
- }
- if(p){
- marea[tempareas].minwrite=(word)atol(p);
- }
- else marea[tempareas].minwrite=0;
-
- if (marea[tempareas].number>higharea) higharea=marea[tempareas].number;
- tempareas++;
- }
- if (tempareas<maxareas) maxareas=tempareas;
- cclose(fphandle);
- }
-
-
-
- char pascal find_area (word areano,char type) {
-
- word register x;
- /* word register y; */
-
- for (x=0;x<maxareas;x++) {
- if (marea[x].number==areano) {
- /* if (user.stat[0]<marea[x].substat1) goto NullArea;
- if (marea[x].flags) {
- for(y=0;y<16;y++) {
- if(marea[x].flags & (1<<y)) {
- if(!(user.attr2 & (1<<y))) {
- goto NullArea;
- }
- }
- }
- }
- if(marea[x].age) {
- if(marea[x].age>0) {
- if(age<(char)marea[x].age) {
- goto NullArea;
- }
- }
- else {
- if(age>(char)abs(marea[x].age)) {
- goto NullArea;
- }
- }
- }
- */ if ((marea[x].attr & ANSI)!=0 && user.graphics==0) goto NullArea; /* No graphics */
- memcpy(&mboard,&marea[x],sizeof(struct _mboard));
- if((mboard.attr & ASSOC) && !exporting) {
- find_filearea(say_prompt(446),mboard.name,user.stat[0]);
- strcpy(mboard.name,marea[x].name);
- }
- else {
- memcpy(&fboard,&holdboard,sizeof(struct _fboard));
- }
- if (type) return (1+tellabout(type));
- return 1;
- }
- }
-
- NullArea:
-
- if (!type) say_prompt(20);
- return 0;
- }
-
-
-
-
- void pascal dobulls (char *areasfile,char uploads) { /* Bulls-mode */
-
- static unsigned deja_vu[4096];
- static char exported=0;
- long maxexportsize;
- long total=0;
- char command;
- char selecting;
- char neworold;
- word areano;
- word temparea;
- word temp;
- char filename[148];
- static char counter=0;
- char string[79];
- int fp;
- int comval;
- register word x;
- word tempbaud;
- static char comstring[41];
- static char doprompting=0;
- char prettystring[384];
- char *divie[43];
- char lastcommand=0,highcommand,wascommand,useftn;
-
- exporting=0;
- memcpy(&holdboard,&fboard,sizeof(struct _fboard));
- memcpy(&holdmboard,&mboard,sizeof(struct _mboard));
- find_filearea(say_prompt(446),mboard.name,user.stat[0]);
-
- load_areas(areasfile);
- if (!maxareas) {
- if(marea)ffree(marea);
- marea=NULL;
- return;
- }
- areano=mboard.number;
- if (!find_area(areano,2)) {
- if (marea) ffree(marea);
- marea=NULL;
- maxareas=0;
- return;
- }
- sprintf(filename,"%sBULLS\\INTRO.%03x",conf.menupath,areano);
- if (!findfirst(filename,&filestat,0)) readfile(filename,0,0,1);
- if (areano<(conf.nolmrs+1) && lastread[areano-1]==0) {
- sprintf(filename,"%sBULLS\\RULES.%03x",conf.menupath,areano);
- if (!findfirst(filename,&filestat,0)) readtext(filename);
- }
- if(!*comstring) {
- strncpy(comstring,say_prompt(433),41);
- say_prompt(461);
- }
- strncpy(prettystring,say_prompt(582),384);
- prettystring[383]=0;
- divie[0]=strtok(prettystring," ");
- if(divie[0]) {
- x=1;
- while((divie[x]=strtok(0," ")) && x<41) {
-
- char *p;
-
- while(p=strchr(divie[x],'_')) *p=' ';
- x++;
- }
- highcommand=(char)x-1;
- }
- deja_vu[areano-1]=1;
-
- while(1) {
- temparea=areano;
- exporting=0;
- useftn=0;
- FancyReDo:
- tellabout(0);
- printg("\x1b[0;1;36m");
- if ((user.ansimenus || !user.graphics) || !divie[0]) {
- say_prompt(22);
- helpnum=560;
- command=*genin(1,0,1,1,ALLL);
- helpnum=0;
- }
- else {
- say_prompt(585);
- FancyRepeat:
- printm(divie[lastcommand]);
- FancyNull:
- helpnum=0;
- command=*genin(1,0,1,1,HYPER);
- wascommand=lastcommand;
- switch((int)command) {
- case 0: command=toupper(*divie[lastcommand]);
- backup(divie[lastcommand]);
- gprintf(0,"%c",*divie[lastcommand]);
- goto DirectEntry;
- case 1:
- case 4:
- case '4':
- case '8': if(lastcommand==0) lastcommand=highcommand;
- else lastcommand--;
- break;
- case 5:
- case 2:
- case '6':
- case '2': if(lastcommand==highcommand) lastcommand=0;
- else lastcommand++;
- break;
- case 11:
- case 27: printm("\n");
- say_prompt(178);
- readfile("BullHelp.XBS",1,1,1);
- printm("\n");
- goto FancyReDo;
- case 3: printm("\n");
- goto FancyReDo;
- default: backup(divie[wascommand]);
- gprintf(0,"%c",toupper(command));
- goto DirectEntry;
- }
- backup(divie[wascommand]);
- goto FancyRepeat;
- }
- DirectEntry:
- if(command)comval=-1;
- else comval=0;
- if(comval) {
- for(x=0;x<42;x++) {
- if(!comstring[x])break;
- if(command==comstring[x]) {
- comval=(int)x+1;
- break;
- }
- }
- }
- switch (comval) {
-
- case '*': readfile("BullXTRA.XBS",0,0,1);
- break;
- case 0: break;
- case 1:
- case 2: say_prompt(178);
- readfile("BullHelp.XBS",1,1,1);
- break;
- case 3: say_prompt(179);
- goto SkipTheAsk;
- case 4: x=areano;
- do {
- x++;
- } while (!find_area(x,2) && x<(higharea+1));
- if (x>higharea) continue;
- else {
- areano=x;
- goto GotArea;
- }
- case 5: x=areano;
- do {
- x--;
- } while (!find_area(x,2) && x);
- if (!x) continue;
- else {
- areano=x;
- goto GotArea;
- }
- case 6: if(user.cold) goto ColdJump;
- helpnum=561;
- strcpy(string,genin(48,0,1,0,SUBJECT));
- helpnum=0;
- if(!(word)atol(string) && *string) {
-
- for(x=0;x<maxareas;x++) {
- if(!stricmp(marea[x].name,string)) {
- areano=marea[x].number;
- break;
- }
- }
- }
- else areano=(word)atol(string);
- SkipTheAsk:
- if (!areano || command==comstring[2]) {
- sprintf(filename,"%sBULLS\\BOARDLST.XBS",conf.menupath,areano);
- if (!findfirst(filename,&filestat,0)) {
- readfile(filename,1,1,1);
- }
- else {
- neworold=0;
- temparea=areano=mboard.number;
- for (x=1;x<(higharea+1);x++) {
- if (find_area(x,1)) {
- neworold++;
- if (user.width<65) neworold++;
- if (mboard.attr & ANSI) say_prompt(288);
- if ((mboard.attr & ECHO) || (mboard.attr & ALTECHO)) say_prompt(289);
- if (mboard.attr & NET) say_prompt(290);
- if (mboard.attr & ALTERNATE) say_prompt(336);
- if (mboard.attr & MCI) say_prompt(291);
- }
- if (!user.more && ((char)neworold>=(user.length-1))) {
- say_prompt(23);
- if (*genin(1,0,1,1,YESNOM)=='N') {
- say_prompt(399);
- break;
- }
- say_prompt(399);
- neworold=0;
- }
- }
- }
- if (command==comstring[2]) {
- find_area(areano,0);
- if (neworold>(user.length-4)) hitreturn();
- printm("\n");
- break;
- }
- ColdJump:
- if(command==comstring[2]) break;
- say_prompt(21);
- helpnum=562;
- strcpy(string,genin(48,0,1,0,SUBJECT));
- helpnum=0;
- if(!(word)atol(string)) {
-
- for(x=0;x<maxareas;x++) {
- if(!stricmp(marea[x].name,string)) {
- areano=marea[x].number;
- break;
- }
- }
- }
- else areano=(word)atol(string);
- }
- if (areano<1 || areano>4096) areano=temparea;
- GotArea:
- find_area(areano,0);
- if (!deja_vu[areano-1]) {
- sprintf(filename,"%sBULLS\\INTRO.%03x",conf.menupath,areano);
- if (!findfirst(filename,&filestat,0)) readfile(filename,0,0,1);
- if (areano<(conf.nolmrs+1) && lastread[areano-1]==0) {
- sprintf(filename,"%sBULLS\\RULES.%03x",conf.menupath,areano);
- if (!findfirst(filename,&filestat,0)) readtext(filename);
- }
- }
- deja_vu[areano-1]=1;
- break;
- case 7: say_prompt(180);
- readamessage(0,0);
- break;
- case 8: say_prompt(181);
- if(user.stat[0]<mboard.minwrite) {
- say_prompt(591);
- break;
- }
- safe=0;
- *assocfile=0;
- if (!(level=(word)askwrite(0))) {
- if (!(level=(word)writemessage(0))) {
- level=(word)makemessage(0);
- }
- }
- safe=1;
- break;
- case 9: say_prompt(182);
- readamessage(128,0);
- break;
- case 10: say_prompt(260);
- if (*genin(1,0,1,1,YESNO)!='N') {
- printm("\n");
- areano=mboard.number;
- for (x=areano;x<(higharea+1);x++) {
- if (inkey()==' ' || toupper(inkey())=='S') break;
- if (find_area(x,1)) {
- if(!doprompting && x<(conf.nolmrs+1)) readamessage(2,0);
- else readamessage(2,lastread[x-1]+1);
- }
- }
- find_area(areano,0);
- printm("\n");
- }
- else {
- printm("\n");
- readamessage(1,0);
- }
- break;
- case 11: say_prompt(184);
- if (marea) ffree(marea);
- marea=NULL;
- maxareas=0;
- memcpy(&fboard,&holdboard,sizeof(struct _fboard));
- memcpy(&mboard,&holdmboard,sizeof(struct _mboard));
- return;
- case 12: say_prompt(185);
- readamessage(4,0);
- break;
- case 13: if (!(uploads & 2)) break;
- say_prompt(425);
- say_prompt(589);
- if(*genin(1,0,1,1,ALPHA)=='F') {
- if(user.pointid==0) {
- say_prompt(586);
- break;
- }
- useftn=1;
- counter++;
- }
- else useftn=0;
- if (exported!=0 && !useftn) {
- if (nodenumber!=1) sprintf(string,"%sXPORT%hu\\*.MAL",conf.homepath,nodenumber);
- else sprintf(string,"%sXPORT\\*.MAL",conf.homepath);
- if (!findfirst(string,&filestat,0)) {
- say_prompt(384);
- if (*genin(1,0,1,1,YESNO)!='N') goto DoMailPacketDL;
- }
- say_prompt(355);
- if (*genin(1,0,1,1,YESNO)!='Y') break;
- exported=0;
- }
- if(!useftn) {
- if (nodenumber!=1) sprintf(string,"%sXPORT%hu\\*.*",conf.homepath,nodenumber);
- else sprintf(string,"%sXPORT\\*.*",conf.homepath);
- if (!findfirst(string,&filestat,0)) {
- if (nodenumber!=1) sprintf(string,"%sXPORT%hu\\%s",conf.homepath,nodenumber,filestat.ff_name);
- else sprintf(string,"%sXPORT\\%s",conf.homepath,filestat.ff_name);
- unlink(string);
- while (!findnext(&filestat)) {
- if (nodenumber!=1) sprintf(string,"%sXPORT%hu\\%s",conf.homepath,nodenumber,filestat.ff_name);
- else sprintf(string,"%sXPORT\\%s",conf.homepath,filestat.ff_name);
- unlink(string);
- }
- }
- if(!doprompting) {
- say_prompt(266);
- if (*genin(1,0,1,1,YESNO)=='Y') selecting=1;
- else selecting=0;
- }
- else selecting=0;
- tempbaud=baud;
- if (!baud) tempbaud=1200;
- maxexportsize=(long)((((long)tempbaud)*(((long)timelimit-(getxbbstime()/60L))*60L)))/11L;
- sprintf(string,say_prompt(373),maxexportsize);
- }
- else selecting=0;
- exporting=1;
- case 14:
- case 15: if ((command==comstring[14] || command==comstring[13]) && !useftn) {
- if(command==comstring[14]) {
- if(!doprompting)say_prompt(24);
- selecting=0;
- }
- else if (command==comstring[13]) {
- if(!doprompting)say_prompt(183);
- selecting=1;
- }
- exporting=0;
- *string=0;
- }
- if(!doprompting && !useftn) {
- if(command==comstring[12]) say_prompt(353);
- if (*genin(1,0,1,1,YESNO)!='N') neworold=2;
- else neworold=1;
- }
- else neworold=2;
- printm("\n");
- printm(string);
- areano=mboard.number;
- for (x=areano;x<(higharea+1);x++) {
- if (inkey()==' ' || toupper(inkey())=='S') break;
- temp=find_area(x,1);
- if(!temp) continue;
- if (temp==neworold || neworold==1) {
- sprintf(filename,"%sXDATA.%03x",messpath,x);
- if (findfirst(filename,&filestat,0)) filestat.ff_fsize=0;
- if (!filestat.ff_fsize) continue;
- if(x<(conf.nolmrs+1) && lastread[x-1]>(word)(filestat.ff_fsize/(long)sizeof(struct _xmsg))) lastread[x-1]=(word)(filestat.ff_fsize/(long)sizeof(struct _xmsg));
- if(!doprompting) {
- if (exporting) say_prompt(372);
- else say_prompt(292);
- helpnum=563;
- command=*genin(1,0,1,1,ALPHA);
- helpnum=0;
- }
- else command=0; /* Default */
- if (command=='S') continue;
- if (command=='A') break;
- if (command=='I') {
- if(x<(conf.nolmrs+1)) lastread[x-1]=(word)(filestat.ff_fsize/(long)sizeof(struct _xmsg));
- continue;
- }
- if (!deja_vu[x-1] && !doprompting) {
- sprintf(filename,"%sBULLS\\INTRO.%03x",conf.menupath,x);
- if (!findfirst(filename,&filestat,0)) readfile(filename,0,0,1);
- if (x<(conf.nolmrs+1) && lastread[x-1]==0) {
- sprintf(filename,"%sBULLS\\RULES.%03x",conf.menupath,x);
- if (!findfirst(filename,&filestat,0)) readtext(filename);
- }
- deja_vu[x-1]=1;
- }
- temp=0;
- if(doprompting && x<(conf.nolmrs+1)) {
- if(inkey()==' ') break;
- if (lastread[x-1]>=(filestat.ff_fsize/(long)sizeof(struct _xmsg))) continue;
- if (lastread[x-1]!=0) {
- if(!useftn) {
- temp=readamessage((64 * exporting),lastread[x-1]+1);
- }
- else export_mail(mboard.number,lastread[x-1]+1);
- }
- else {
- if(useftn) export_mail(mboard.number,0);
- else temp=readamessage((64 * exporting),1);
- }
- }
- else {
- if(useftn) export_mail(mboard.number,lastread[x-1]+1);
- else temp=readamessage((64 * (exporting))+((16 * (selecting))),0);
- }
- if (temp) {
- if (exporting && !useftn) {
- if (nodenumber!=1) sprintf(string,"%sXPORT%hu\\MSGAREAS.XBS",conf.homepath,nodenumber);
- else sprintf(string,"%sXPORT\\MSGAREAS.XBS",conf.homepath);
- if(findfirst(string,&filestat,0)) {
-
- word xx;
-
- if ((fp=oopen(string,O_RDWR | O_TEXT | O_APPEND | O_DENYNONE))==-1)
- if((fp=ccreat(string,S_IWRITE))==-1) {
- say_prompt(354);
- break;
- }
- ffprintf(fp,"%u:%u/%u\r\n",conf.zone,conf.net,conf.node);
- ffprintf(fp,"%s\r\n",conf.system);
- ffprintf(fp,"%s\r\n",say_prompt(358));
- ffprintf(fp,"%s\r\n",say_prompt(359));
- ffprintf(fp,"%s\r\n",say_prompt(360));
- for (xx=0;xx<maxareas;xx++) {
- ffprintf(fp,"%s,%u,%u,%u,%u,%u",marea[xx].name,marea[xx].attr,marea[xx].max,marea[xx].number,marea[xx].substat1,marea[xx].substat2);
- if(marea[xx].forceto && *marea[xx].forceto) ffprintf(fp,",%s",marea[xx].forceto);
- ffprintf(fp,"\r\n");
- }
- exported=1;
- cclose(fp);
- }
- if (nodenumber!=1) sprintf(string,"%sXPORT%hu\\MSGAREAS.XBS",conf.homepath,nodenumber);
- else sprintf(string,"%sXPORT\\MSGAREAS.XBS",conf.homepath);
- if (!findfirst(string,&filestat,0)) total=filestat.ff_fsize;
- if (nodenumber!=1) sprintf(string,"%sXPORT%hu\\X*.*",conf.homepath,nodenumber);
- else sprintf(string,"%sXPORT\\X*.*",conf.homepath);
- if (!findfirst(string,&filestat,0)) {
- total+=filestat.ff_fsize;
- while (!findnext(&filestat)) {
- total+=filestat.ff_fsize;
- }
- }
- gprintf(0,say_prompt(378),total);
- if (total>=maxexportsize) {
- say_prompt(379);
- break;
- }
- }
- else if (useftn) {
- if (nodenumber!=1) sprintf(string,"%sXPORT%hu\\*.PKT",conf.homepath,nodenumber);
- else sprintf(string,"%sXPORT\\*.PKT",conf.homepath);
- if (!findfirst(string,&filestat,0)) {
- gprintf(0,say_prompt(378),filestat.ff_fsize);
- }
- }
- }
- }
- }
- if(useftn) goto DoMailPacketDL;
- if (exporting && exported) {
- if(!useftn) {
- say_prompt(374);
- if (nodenumber!=1) sprintf(string,"%sXPORT%hu\\MSGAREAS.XBS",conf.homepath,nodenumber);
- else sprintf(string,"%sXPORT\\MSGAREAS.XBS",conf.homepath);
- if ((fp=oopen(string,O_RDONLY | O_TEXT | O_DENYNONE))!=-1) {
-
- struct ftime t;
- struct date dos_date;
-
- t.ft_tsec=0;
- t.ft_min=0;
- t.ft_hour=0;
- getdate(&dos_date);
- t.ft_day=(unsigned) dos_date.da_day;
- t.ft_month=(unsigned) dos_date.da_mon;
- t.ft_year=(unsigned) (dos_date.da_year-1980);
-
- setftime(fp,&t);
- cclose(fp);
- }
- if (nodenumber!=1) sprintf(string,"%hu",nodenumber);
- else *string=0;
- sprintf(filename,say_prompt(356),string,conf.net,conf.node,string);
- spawnit(filename,0,0);
- sprintf(filename,say_prompt(361),string,conf.net,conf.node,string);
- spawnit(filename,0,0);
- sprintf(filename,"XPORT%s\\%04x%04x.MAL",string,conf.net,conf.node);
- unlink(filename);
- if (nodenumber!=1) sprintf(string,"%sXPORT%hu\\%04x%04x.EXE",conf.homepath,nodenumber,conf.net,conf.node);
- else sprintf(string,"%sXPORT\\%04x%04x.EXE",conf.homepath,conf.net,conf.node);
- rename(string,filename);
- if (nodenumber!=1) sprintf(string,"%sXPORT%hu\\MSGAREAS.XBS",conf.homepath,nodenumber);
- else sprintf(string,"%sXPORT\\MSGAREAS.XBS",conf.homepath);
- unlink(string);
- if (nodenumber!=1) sprintf(string,"%sXPORT%hu\\X*.*",conf.homepath,nodenumber);
- else sprintf(string,"%sXPORT\\X*.*",conf.homepath);
- if (!findfirst(string,&filestat,0)) {
- if (nodenumber!=1) sprintf(string,"%sXPORT%hu\\%s",nodenumber,filestat.ff_name);
- else sprintf(string,"%sXPORT\\%s",conf.homepath,filestat.ff_name);
- unlink(string);
- while (!findnext(&filestat)) {
- if (nodenumber!=1) sprintf(string,"%sXPORT%hu\\%s",conf.homepath,nodenumber,filestat.ff_name);
- else sprintf(string,"%sXPORT\\%s",conf.homepath,filestat.ff_name);
- unlink(string);
- }
- }
- }
- DoMailPacketDL:
- if(!useftn) sprintf(filename,"%04x%04x.MAL",conf.net,conf.node);
- else {
- if(nodenumber!=1) sprintf(filename,"%sXPORT%hu\\%04x%04x.PKT",conf.homepath,nodenumber,conf.net,conf.node);
- else sprintf(filename,"%sXPORT\\%04x%04x.PKT",conf.homepath,conf.net,conf.node);
- if(findfirst(filename,&filestat,0)) goto NoPacket;
- if(nodenumber!=1) {
- sprintf(filename,"%s%sXPORT%hu\\00000000.MO%hu %sXPORT%hu\\%04x%04x.PKT",say_prompt(594),conf.homepath,nodenumber,counter,conf.homepath,nodenumber,conf.net,conf.node);
- }
- else {
- sprintf(filename,"%s%sXPORT\\00000000.MO%hu %sXPORT\\%04x%04x.PKT",say_prompt(594),conf.homepath,counter,conf.homepath,conf.net,conf.node);
- }
- gprintf(0,say_prompt(378),filestat.ff_fsize);
- say_prompt(374);
- spawnit(filename,0,0);
- sprintf(filename,"00000000.*");
- }
- if(nodenumber!=1) {
- sprintf(fboard.dpath,"%sXPORT%hu\\",conf.homepath,nodenumber);
- sprintf(fboard.upath,"%sMPORT%hu\\",conf.homepath,nodenumber);
- }
- else {
- sprintf(fboard.dpath,"%sXPORT\\",conf.homepath);
- sprintf(fboard.upath,"%sMPORT\\",conf.homepath);
- }
- fboard.flags=7;
- strcpy(fboard.name,"XPORT");
- if (!askdl(filename,128,NULL,0)) {
- say_prompt(381);
- if (*genin(1,0,1,1,YESNO)!='N') {
- if (!askdl(filename,128,NULL,0)) {
- say_prompt(382);
- if (*genin(1,0,1,1,YESNO)!='N') {
- if (!askdl(filename,128,NULL,0)) say_prompt(383);
- }
- }
- }
- }
- }
- NoPacket:
- find_area(areano,0);
- printm("\n");
- break;
- case 16: say_prompt(186);
- sprintf(filename,"%sBULLS\\RULES.%03x",conf.menupath,areano);
- if (!findfirst(filename,&filestat,0)) readtext(filename);
- else say_prompt(25);
- break;
- case 17: if ((uploads & 1) || (uploads & 2)) {
- if ((uploads & 2) && (uploads & 1)) {
- say_prompt(375);
- helpnum=564;
- if (*genin(1,0,1,1,ALPHA)=='R') {
- helpnum=0;
- if(nodenumber!=1) {
- sprintf(fboard.dpath,"%sXPORT%hu\\",conf.homepath,nodenumber);
- sprintf(fboard.upath,"%sMPORT%hu\\",conf.homepath,nodenumber);
- }
- else {
- sprintf(fboard.dpath,"%sXPORT\\",conf.homepath);
- sprintf(fboard.upath,"%sMPORT\\",conf.homepath);
- }
- fboard.flags=7;
- strcpy(fboard.name,"MPORT");
- say_prompt(589);
- if(*genin(1,0,1,1,ALPHA)!='F') {
- sprintf(filename,"%04x%04x.RPK",conf.net,conf.node);
- upload(filename,0);
- }
- else {
- if(!user.pointid) {
- gprintf(0,say_prompt(586),conf.sysop);
- }
- else {
- sprintf(filename,"*.MO?");
- upload(filename,0);
- }
- }
- break;
- }
- helpnum=0;
- printm("\n");
- }
- else if (uploads & 2) {
- say_prompt(376);
- sprintf(fboard.dpath,"%sXPORT\\",conf.homepath);
- sprintf(fboard.upath,"%sMPORT\\",conf.homepath);
- fboard.flags=7;
- strcpy(fboard.name,"MPORT");
- say_prompt(589);
- if(*genin(1,0,1,1,ALPHA)!='F') {
- sprintf(filename,"%04x%04x.RPK",conf.net,conf.node);
- upload(filename,0);
- }
- else {
- if(!user.pointid) {
- gprintf(0,say_prompt(586),conf.sysop);
- }
- else {
- sprintf(filename,"*.MO?");
- upload(filename,0);
- }
- }
- break;
- }
- else say_prompt(187);
- if(user.stat[0]<mboard.minwrite) {
- say_prompt(591);
- break;
- }
- safe=0;
- *assocfile=0;
- if (!(level=(word)askwrite(0))) {
- if (!(level=(word)writemessage(4))) {
- level=(word)makemessage(0);
- }
- }
- safe=1;
- break;
- }
- case 18: say_prompt(471);
- doprompting=1-doprompting;
- (doprompting) ? say_prompt(472) : say_prompt(474);
- break;
- default: sprintf(filename,"BULLS%03u.XBS",comval);
- readfile(filename,1,1,1);
- printm("\n");
- break;
- }
- }
- }
-
-
-
- word pascal readamessage (char type,word messno) {
- /* Type=0.....Read messages public & private
- Type=1.....Read personal mail
- Type=2.....Quiet check for personal mess
- Type=4.....Read non-stop
- Type=8.....Selected read use what's there
- Type=16....Selected read
- Type=32....Associated search
- Type=64....Export
- Type=128...Scan
- Extremely large, ugly function, but it works
- */
-
- static char comstring[40]="";
- int comval;
- char qstring[6];
- char text[124];
- char textarc[127];
- char filearc[127];
- static char p294[41]="";
- static char p295[24];
- static char p296[24];
- static char p297[24];
- static char p298[24];
- static char p370[24];
- static char p380[24];
- static char p349[24];
- static char p466[24];
- int ta=0;
- int fa=0;
- int pp=0;
- word threadstart=0;
- word nomess;
- word temp;
- char ctla=0;
- char message[81];
- char nextkey;
- char sub=0;
- word lastmess=0;
- char *hold=NULL;
- char *tempo;
- char *p;
- char * pos[51];
- char page;
- register word x;
- word exported=0;
- char lastmsgid[80]="";
- char lastreply[80]="";
- char matchany=0;
- char scanflag=0;
- char wasone=0;
- char tweenavail=0;
-
- *msginfo=0;
- if (!*p294) {
- strcpy(p294,say_prompt(294));
- strcpy(p295,say_prompt(295));
- strcpy(p296,say_prompt(296));
- strcpy(p297,say_prompt(297));
- strcpy(p298,say_prompt(298));
- strcpy(p370,say_prompt(370));
- strcpy(p380,say_prompt(380));
- strcpy(p349,say_prompt(349));
- strcpy(p466,say_prompt(466));
- }
- if(!*comstring) {
- strncpy(comstring,say_prompt(434),40);
- }
- nextkey=comstring[3];
-
- sprintf(filearc,"%sTWEENMSG.XBS",conf.messpath);
- if(!findfirst(filearc,&filestat,0)) tweenavail=1;
- *filearc=0;
-
- if (type & 64) {
- if (nodenumber==1) {
- sprintf(filearc,"%sXPORT\\XDATA.%03x",conf.homepath,mboard.number);
- sprintf(textarc,"%sXPORT\\XTEXT.%03x",conf.homepath,mboard.number);
- }
- else {
- sprintf(filearc,"%sXPORT%hu\\XDATA.%03x",conf.homepath,nodenumber,mboard.number);
- sprintf(textarc,"%sXPORT%hu\\XTEXT.%03x",conf.homepath,nodenumber,mboard.number);
- }
- }
- if (mboard.number<(conf.nolmrs+1)) lastmess=lastread[mboard.number-1];
-
-
- DoNumber:
-
- sprintf(buffer,"%sXDATA.%03x",messpath,mboard.number);
- if (findfirst(buffer,&filestat,0)) {
- if (!(type & 2)) say_prompt(26);
- return(0);
- }
- threadstart=0;
- if (!(type & 2)) {
- printm("\n");
- gprintf(0,say_prompt(27),mboard.number,mboard.name);
- }
- nomess=(word)((filestat.ff_fsize/(long)sizeof(struct _xmsg)));
-
- if (mboard.number<(conf.nolmrs+1) && (!messno || messno>nomess)) {
- if (lastread[mboard.number-1]>nomess) lastread[mboard.number-1]=nomess;
- if (type & 2) if (lastread[mboard.number-1]>=nomess) {
- lastread[mboard.number-1]=nomess;
- goto SetLast;
- }
- }
- if(messno>nomess) messno=nomess;
-
- if (!(type & 2)) {
- gprintf(0,"%u%s",nomess,say_prompt(29));
- }
- if (!(type & 2)) {
- if (mboard.number<(conf.nolmrs+1)) if ((nomess) && (lastread[mboard.number-1]<nomess)) {
- gprintf(0,"%s%u)",say_prompt(30),lastread[mboard.number-1]+1);
- }
- }
- if (!messno) {
- if (!(type & 2)) {
- if (type & 16) {
- *msgto=*msgsubj=*msgbody=*msgfrom=0;
- say_prompt(31);
- say_prompt(34);
- helpnum=565;
- strcpy(msgfrom,genin(36,0,0,0,NEAT));
- say_prompt(35);
- helpnum=566;
- strcpy(msgto,genin(36,0,0,0,NEAT));
- say_prompt(36);
- helpnum=567;
- strcpy(msgsubj,genin(64,0,0,0,SUBJECT));
- say_prompt(37);
- helpnum=568;
- strcpy(msgbody,genin(80,0,0,0,ALLL));
- helpnum=0;
- say_prompt(93);
- helpnum=575;
- if(*genin(1,0,1,1,YESNO)=='Y') matchany=1;
- else matchany=0;
- helpnum=0;
- printm("\n");
- }
- Scanswitch:
- if (type & 128) {
- say_prompt(32);
- }
- else if (type & 64) say_prompt(371);
- else say_prompt(33);
- say_prompt(261); /* From which #? */
- if(mboard.number<(conf.nolmrs+1))
- if(lastmess>0 && lastmess<nomess && lastread[mboard.number-1]<nomess)
- gprintf(0,"[%u] ",lastmess+1); /* default */
- helpnum=569;
- strcpy(text,genin(5,0,0,0,NUM));
- helpnum=0;
- messno=(word)atol(text);
- if ((messno<1) or (messno>nomess)) {
- if (!messno && strlen(text)) {
- say_prompt(262);
- return(0);
- }
- else if (mboard.number<(conf.nolmrs+1)) {
- if (nomess && lastmess<nomess && !strlen(text)) {
- gprintf(0,"%u\n",lastmess+1);
- messno=lastmess+1;
- }
- else {
- printm("\n");
- goto SetLast;
- }
- }
- else {
- printm("\n");
- goto SetLast;
- }
- }
- printm("\n");
- }
- else {
- if (nomess) {
- if(mboard.number<(conf.nolmrs+1)) {
- if (lastread[mboard.number-1]<nomess) messno=lastread[mboard.number-1]+1;
- }
- else {
- messno=1;
- }
- }
- }
- }
- else if(!(type & 2)) printm("\n");
-
- if (type & 64) {
- if ((ta=oopen(textarc,O_RDWR | O_BINARY | O_APPEND | O_DENYNONE))==-1)
- if((ta=ccreat(textarc,S_IWRITE))==-1) {
- if (!(type & 2)) say_prompt(351);
- return (0);
- }
- lseek(ta,0L,SEEK_END);
- if ((fa=oopen(filearc,O_RDWR | O_BINARY | O_APPEND | O_DENYNONE))==-1)
- if((fa=ccreat(filearc,S_IWRITE))==-1) {
- if (!(type & 2)) say_prompt(352);
- cclose(ta);
- return (0);
- }
- lseek(fa,0L,SEEK_END);
- }
- if ((type & 16) || (type & 8)) say_prompt(39);
- goto Readhere;
-
- Restart:
-
- slowprint=0;
- if(type & 2) {
- messno=get_abunch (messno,0,1,"");
- if(!messno) goto SetLast;
- }
- if(type & 64) safe=0;
- sprintf(buffer,"%sXDATA.%03x",messpath,mboard.number);
- if (!findfirst(buffer,&filestat,0)) {
- nomess=(word)((filestat.ff_fsize/(long)sizeof(struct _xmsg)));
- }
- if (!(type & 32)) *assocfile=0;
- if (type & 128) messno++;
- else {
- if (!(type & 16) && !(type & 64) && !(type & 8) && !(type & 2)) printg("\x1b[0;1;32m");
- sub=0;
- if (nextkey=='S') goto SetLast;
- if (nextkey==comstring[6]) {
- messno--;
- }
- else if (nextkey!=comstring[6]) {
- if(!(type & 2)) messno++;
- }
- }
-
- Thread:
-
- if ((messno>nomess) or (messno<1)) {
- if (!(type & 2) && !(type & 64)) {
- if (mboard.attr & ANSI) printg("\x1b[23;1H\x1b[K");
- say_prompt(40);
- }
- if(!(type & 128))if (lastmess>nomess) lastmess=nomess;
- if((type & 128) && wasone) goto AfterScan;
- goto SetLast;
- }
-
- Readhere:
-
- if (get_mess(messno)) goto SetLast;
- if ((type & 2) || (type & 1)) {
- if (stricmp(user.name,msg.to) && stricmp(user.handle,msg.to)) {
- goto Restart;
- }
- }
- if (type & 2) if (msg.attr & MSGREAD) goto Restart;
- if (msg.m_attr & MSGDELETED) if ((user.stat[0]<mboard.substat1) || (user.stat[1]<mboard.substat2)) {
- if (!(type & 2) && !(type & 1) && !(type & 128)) lastmess=messno;
- if (!(type & 2) && !(type & 64) & !(type & 16)) {
- pauser=2;
- printg("\x1b[0;1;33m");
- pauser=1;
- if (gprintf(0,"#%-5u%s",messno,say_prompt(42))) {
- if (type & 128) {
- safe=1;
- if(wasone)goto AfterScan;
- else goto SetLast;
- }
- else goto SetLast;
- }
- }
- goto Restart;
- }
- if (msg.attr & MSGPRIVATE) if (((user.stat[0]<mboard.substat1) || (user.stat[1]<mboard.substat2)) && stricmp(user.name,msg.to) && stricmp(user.handle,msg.to) && stricmp(user.name,msg.from) && stricmp(user.handle,msg.from)) {
- if (!(type & 2) && !(type & 1) && !(type & 128)) lastmess=messno;
- if (!(type & 2) && !(type & 64) &&!(type & 16)) {
- pauser=2;
- printg("\x1b[0;1;33m");
- pauser=1;
- if (gprintf(0,"#%-5u%s",messno,say_prompt(43))) {
- if (type & 128) {
- safe=1;
- if(wasone) goto AfterScan;
- else goto SetLast;
- }
- else goto SetLast;
- }
- }
- goto Restart;
- }
- if ((type & 16) || (type & 8) && !(type & 64) && !(type & 2)) {
-
- char hit=0;
- char miss=0;
-
- pauser=0;
- printm(".");
- if (*msgfrom) {
- if (stricmp(msg.from,msgfrom)) {
- if(!matchany) goto Restart;
- miss++;
- }
- else hit++;
- }
- if (*msgto) {
- if (stricmp(msg.to,msgto)) {
- if(!matchany) goto Restart;
- miss++;
- }
- else hit++;
- }
- if (*msgsubj) {
- if (stristr(msg.subj,msgsubj)==NULL) {
- if(!matchany) goto Restart;
- miss++;
- }
- else hit++;
- }
- if (*msgbody) {
- hold=get_text(messno);
- if (hold==NULL) {
- say_prompt(41);
- goto Restart;
- }
- tempo=stristr(hold,msgbody);
-
- #ifdef DEBUG
-
- gprintf("FOUND: %s\n",tempo);
-
- #endif
-
- ffree(hold);
- if (tempo==NULL) {
- if(!matchany) goto Restart;
- miss++;
- }
- else hit++;
- }
- if((!matchany && miss) || !hit) goto Restart;
- printm("\n");
- }
- if (type & 128) {
- pauser=2;
- wasone=1;
- if ((msg.m_attr & MSGANON)) {
- sprintf(message,say_prompt(45));
- message[32]=0;
- }
- else {
- sprintf(message,"%-31.31s",msg.from);
- message[32]=0;
- }
-
- {
-
- char tempstring[80];
- int tempint;
-
- printg("\x1b[0;1;33m");
- sprintf(tempstring,"#%-5u To: %-0.30s..",messno,msg.to);
- tempstring[34]=0;
- tempint=41-strlen(tempstring);
- for(x=0;x<tempint;x++) strcat(tempstring,".");
- printm(tempstring);
- printg("\x1b[0;1;32m");
- gprintf(0,"Fm: %s\n",message);
- msg.subj[63]=0;
- printg("\x1b[0;1;36m");
- lines+=2;
- if (gprintf(0," Subj: %s\n",msg.subj)) goto SetLast;
- nextkey=toupper(inkey());
- switch (nextkey) {
- case 'S':
- case ' ':
- goto SetLast;
- case 'P':
- case 19:
- pauseit();
- }
- nextkey=0;
- if(lines>(user.length-3)) {
- AfterScan:
- say_prompt(477);
- ScanAgain:
- helpnum=478;
- nextkey=*genin(1,0,1,1,ALPHA);
- helpnum=0;
- if(user.graphics) {
- fputs("\r",stdout);
- if (baud) while (!fossil(TRANSMIT,'\r')) carrchk();
- printm("\x1b[K");
- }
- else printm("\n");
- if(nextkey=='A' || nextkey=='S') goto SetLast;
- if(nextkey=='H') {
- say_prompt(478);
- goto ScanAgain;
- }
- if(nextkey=='R') {
- type=type & (~128);
- scanflag=1;
- nextkey=0;
- goto Scanswitch;
- }
- if(nextkey=='C' && messno>nomess) goto SetLast;
- nextkey=0;
- }
- }
- goto Restart;
- }
-
- if (messno>lastmess && !(type & 128)) lastmess=messno;
- if (!(msg.attr & MSGPRIVATE) || (!stricmp(user.name,msg.to) || !stricmp(user.handle,msg.to))) {
- if (!stricmp(user.name,msg.to) || !stricmp(user.handle,msg.to)) msg.attr = msg.attr | MSGREAD;
- msg.times++;
- put_mess(messno);
- }
- Over:
- if (!(type&4) && !(type&64) && !(mboard.attr & ANSI)) cls();
- if ((mboard.attr & ANSI) && !(type&64)) printm("\x1b[2J");
- page=0;
-
- if (!(type & 64)) {
- printheader(page,messno,type,nomess);
- if(!(mboard.attr & ANSI)) printm("\n");
- lines=7;
- if (user.graphics) if (!user.scrnclr) if (!user.more) if (type!=4) if (baud==0 || baud>1200) lines=6;
- if (!(type & 4)) pauser=1;
- }
- else {
- pauser=0;
- if (!exported) printm("\nExporting...");
- else printm(".");
- }
-
- hold=get_text(messno);
- if (hold==NULL) {
- say_prompt(41);
- goto SetLast;
- }
-
- if(tempo=strstr(hold,"\01INFO:")) {
- strncpy(msginfo,&tempo[6],81);
- msginfo[80]=0;
- tempo=strchr(msginfo,'\r');
- if(tempo)*tempo=0;
- lstrip(msginfo);
- rstrip(msginfo);
- }
- else *msginfo=0;
- if(!threadstart) {
- if(tempo=strstr(hold,"\01MSGID:")) {
- strncpy(lastmsgid,&tempo[7],80);
- lastmsgid[79]=0;
- tempo=strchr(lastmsgid,'\r');
- if(tempo)*tempo=0;
- lstrip(lastmsgid);
- rstrip(lastmsgid);
- }
- else *lastmsgid=0;
- if(tempo=strstr(hold,"\01REPLY:")) {
- strncpy(lastreply,&tempo[7],80);
- lastreply[79]=0;
- tempo=strchr(lastreply,'\r');
- if(tempo)*tempo=0;
- lstrip(lastreply);
- rstrip(lastreply);
- }
- else *lastreply=0;
- }
- strip_seenbys(hold);
- strip_blanklines(hold);
- if (type & 64) {
- msg.start=tell(ta);
- msg.length=strlen(hold)+1;
- msg.times=0;
- msg.attr = msg.attr & (~MSGLOCAL);
- lseek(fa,0L,SEEK_END);
- _write(fa,&msg,sizeof(struct _xmsg));
- _write(ta,hold,strlen(hold));
- _write(ta,"\0",1);
- if (hold) ffree(hold);
- nextkey=comstring[3];
- exported++;
- goto Restart;
- }
-
- if (mboard.attr & ANSI) {
- pauser=0;
- tempo=hold;
- while (*tempo) {
- tempo++;
- if(*tempo=='\01' && !ctla) {
- do {
- tempo++;
- }while(*tempo!='\r' && *tempo);
- if(tempo)tempo++;
- continue;
- }
- if (baud) while (!fossil(TRANSMIT,*tempo)) carrchk();
- fputc(*tempo,stdout);
- temp=wherey();
- if(temp>23) gotoxy(wherex(),23);
- if(temp<6) gotoxy(wherex(),6);
- nextkey=toupper(inkey());
- if (nextkey) if (nextkey=='S' || nextkey==comstring[3] ||
- nextkey==comstring[6]) {
- fossil(PURGEOUT,0);
- goto StopIt;
- }
- }
- nextkey=0;
- goto StopIt;
- }
- if ((tempo=strstr(hold,"\01ASSOC: ")) && (mboard.attr & ASSOC) && (fboard.flags & FILEASSOC)) {
-
- long filelen;
- word temp;
- struct fdate {
- bit day: 5;
- bit month: 4;
- bit year: 7;
- };
- union df {
- struct fdate fd;
- int x;
- } fdf;
-
- tempo+=8;
- x=0;
- while (x<133 && tempo[x] && tempo[x]!='\r' && tempo[x]!=' ') {
- assocfile[x]=tempo[x];
- x++;
- }
- assocfile[x]=0;
- if(strchr(assocfile,'\\') || strchr(assocfile,':')) strcpy(buffer,assocfile);
- else sprintf(buffer,"%s%s",fboard.dpath,assocfile);
- temp = findfirst(buffer,&filestat,0);
- if(!temp) {
- if(strchr(assocfile,'\\') || strchr(assocfile,':')) *buffer=0;
- else strcpy(buffer,fboard.dpath);
- }
- else {
- sprintf(buffer,"%s%s",fboard.upath,assocfile);
- temp=findfirst(buffer,&filestat,0);
- if (!temp) strcpy(buffer,fboard.upath);
- else *buffer=0;
- }
- if (!temp) {
- strcat(buffer,assocfile);
- temp=baud;
- if (temp==0) temp=1200;
- filelen=(long)((((filestat.ff_fsize)/temp)*1000)/80);
- fdf.x=filestat.ff_fdate;
- printg("\x1b[0;1;33m");
- gprintf(0,"%-12s (%lu bytes) %02u/%02u/%02u %d mins %d secs @ %u baud\n",filestat.ff_name,filestat.ff_fsize,fdf.fd.month,fdf.fd.day,fdf.fd.year+80,(int)filelen/60,(int)filelen%60,temp);
- printg("\x1b[0;1;32m");
- }
- }
- else *assocfile=0;
-
- if(*assocfile || *msginfo) readfile("BETWEEN.XBS",0,0,1);
- else if(tweenavail) {
- readfile("TWEENMSG.XBS",0,0,1);
- }
-
- page=0;
- for(x=1;x<50;x++) pos[x]=NULL;
- pos[0]=tempo=p=hold;
- while (*p) {
- strcpy(message,write_line(&p,user.width,ctla));
- strcat(message,"\n");
- tempo=message;
- if (mboard.attr & MCI) {
- if (strchr(tempo,'^')) {
- tempo=mci(tempo);
- if (strlen(tempo)>user.width+1) {
- lines+=strlen(tempo)/user.width;
- }
- }
- fast=0;
- }
- else fast=1;
- if (printm(tempo)) {
- nextkey='S';
- goto Shutdown;
- }
- nextkey=toupper(inkey());
- Shutdown:
- slowprint=0;
- switch (nextkey) {
- case 0: break;
- case 'S':
- case 'N':
- case '-':
- case ' ':
- fossil(PURGEOUT,0);
- goto StopIt;
- case 'P':
- case 19:
- pauseit();
- nextkey=0;
- }
- if (user.graphics) if (!user.scrnclr) if (!user.more) if (type!=4) if (!baud || baud>1200) if (lines>(user.length-3)+((mboard.attr & MCI)!=0)) {
- if(!*p) break;
- pauser=0;
- lprint("\x1b[23;1H");
- if (baud) while (!fossil(TRANSMIT,'\r')) carrchk();
- say_prompt(293);
- if (page || pos[page+1]) printheader(page,messno,type,nomess);
- printm("\x1b[u");
- fossil(FLUSHOUT,0);
- fossil(PURGEIN,0);
- pos[page+1]=p;
- Getitagain:
- keymess=messno;
- helpnum=570;
- nextkey=*genin(1,0,1,1,ALPHA+128);
- helpnum=0;
- switch (nextkey) {
- case 'S': nextkey=0;
- fputs("\r",stdout);
- if (baud) while (fossil(TRANSMIT,'\r')==0) carrchk();
- goto StopIt;
- case 'N':
- case 0: nextkey='N';
- if (++page>49) page=1;
- pos[page]=p;
- break;
- case 'O': p=pos[page];
- break;
- case 'P':
- case '-': if (!page) goto StopIt;
- p=pos[--page];
- break;
- default: printm(BACKSPACE);
- goto Getitagain;
- }
- fputs("\r",stdout);
- if (baud) while (!fossil(TRANSMIT,'\r')) carrchk();
- printm("\x1b[K\x1b[0;1;32m");
- pauser=1;
- lines=6;
- }
- }
-
- StopIt:
-
- if (hold!=NULL) ffree(hold);
- pauser=0;
-
- Aborted:
-
- slowprint=0;
- if(nextkey)comval=-1;
- else comval=0;
- if(comval) {
- for(x=0;x<18;x++) {
- if(!comstring[x])break;
- if(nextkey==comstring[x]) {
- comval=(int)x+1;
- break;
- }
- }
- }
- switch (comval) {
- case 8: nextkey=comstring[6];
- case 4:
- case 7:
- case 6: goto Restart;
- }
-
- Doitall:
-
- scanflag=1;
- slowprint=0;
- if (strcmp(message,"\n") && !(mboard.attr & ANSI)) printm("\n");
- if (type&4) {
- if (nextkey!=comstring[4]) {
- nextkey=comstring[3];
- goto Restart;
- }
- }
- if (mboard.attr & ANSI) printm(" \x1b[0;1;31m\x1b[23;1H\x1b[K");
- else printg("\x1b[0;1;31m");
- printm(p294);
- if (nomess>1 && (!(type & 2))) printm(p295);
- if (!(type & 2)) printm(p296);
- if (((mboard.substat1<=user.stat[0]) && (mboard.substat2<=user.stat[1])) || ((!stricmp(user.handle,msg.to)) || (!stricmp(user.handle,msg.from)) || (!stricmp(user.name,msg.to)) || (!stricmp(user.name,msg.from)))) {
- printm(p297);
- sub=1;
- }
- else sub=0;
- if ((!(mboard.attr & READONLY)) or (sub)) printm(p298);
- gprintf(0,"\n%s",p466);
- if ((mboard.attr & ASSOC) && (fboard.flags & FILEASSOC) && *assocfile) printm(p349);
- if (mboard.attr & EXTERN) printm(p370);
- if (threadstart) printm(p380);
- printm(": ");
-
- Doitover:
-
- keymess=messno;
- helpnum=571;
- nextkey=*genin(1,0,1,1,ALLL);
- helpnum=0;
-
- if(nextkey) comval=-1;
- else comval=0;
- if(comval)for(x=0;x<40;x++) {
- if(!comstring[x]) break;
- if(nextkey==comstring[x]) {
- comval=(int)x+1;
- break;
- }
- }
- switch (comval) {
- case 1: say_prompt(424);
- goto Doitall;
- case 2:
- if(type & 16) {
- type=type &(~16);
- say_prompt(369);
- }
- else {
- type=type | 16;
- }
- if(type & 16) {
- messno=0;
- goto DoNumber;
- }
- else goto Doitall;
- case 3:
- if (!threadstart || (type & 2)) goto Doitall;
- messno=threadstart;
- nextkey=comstring[6];
- threadstart=0;
- printm("\n");
- get_mess(messno);
- goto Thread;
- case 0:
- nextkey=comstring[3];
- case 4:
- threadstart=0;
- printm("\n");
- goto Restart;
- case 5:
- goto SetLast;
- case 6:
- printm("\n");
- goto Over;
- case 7:
- case 8:
- threadstart=0;
- nextkey=comstring[6];
- printm("\n");
- goto Restart;
- case 9:
- if (!(type & 2)) {
- messno=0;
- goto DoNumber;
- }
- break;
- case 10:
- nextkey=comstring[5];
- ctla=1-ctla;
- ctla!=0 ? say_prompt(299) : say_prompt(300);
- goto Over;
- case 11:
- case 12:
- case 13:
- if (type & 2) break;
- ReThreadLoop:
- if(comval==13) nextkey='B';
- else if (comval==12) nextkey='F';
- else {
- while (comval!=12 && comval!=13) {
- say_prompt(51);
- helpnum=573;
- nextkey=*genin(1,0,1,1,ALPHA);
- helpnum=0;
- if(nextkey==0) nextkey=comstring[11];
- for(x=0;x<27;x++) {
- if(!comstring[x])break;
- if(nextkey==comstring[x]) {
- comval=(int)x+1;
- break;
- }
- }
- if (nextkey=='A') threadstart=0;
- if (nextkey=='Q') goto Doitall;
- *lastmsgid=0;
- *lastreply=0;
- }
- }
- printm("\n");
-
- {
- char *p;
- char type;
- int direction;
-
- if((nextkey=='F' && messno!=nomess) || messno==1) {
- direction=1;
- if(*lastmsgid) {
- type=2;
- p=lastmsgid;
- }
- else {
- type=1;
- p=msg.subj;
- }
- }
- else {
- direction=-1;
- if(*lastreply) {
- type=2;
- p=lastreply;
- }
- else {
- type=1;
- p=msg.subj;
- }
- }
- say_prompt(52);
- temp=get_abunch(messno,type,direction,p);
-
- }
- if (temp) {
- if (!threadstart) threadstart=messno;
- messno=temp;
- goto Thread;
- }
- say_prompt(53);
- goto Doitall;
- case 14:
- if (mboard.attr & EXTERN) {
- readfile("EXTRAMSG.XBS",0,0,1);
- }
- goto Doitall;
- case 15:
- if ((mboard.attr & ASSOC) && (fboard.flags & FILEASSOC) && *assocfile) {
-
- char tempfile[133]="";
- char *p;
-
- if(strchr(assocfile,'\\') || strchr(assocfile,':')) strcpy(tempfile,assocfile);
- else sprintf(tempfile,"%s%s",fboard.dpath,assocfile);
- temp = findfirst(tempfile,&filestat,0);
- if (!temp) {
- if(strchr(assocfile,'\\') || strchr(assocfile,':')) *tempfile=0;
- else strcpy(tempfile,fboard.dpath);
- }
- else {
- sprintf(tempfile,"%s%s",fboard.upath,assocfile);
- temp=findfirst(tempfile,&filestat,0);
- if (!temp) strcpy(tempfile,fboard.upath);
- }
- if (temp && !maxareas) {
- say_prompt(350);
- goto Doitall;
- }
- strcat(tempfile,assocfile);
- p=strrchr(assocfile,'.');
- if(!p)p=assocfile;
- if (p>assocfile) if (!stricmp(p,".TXT") || !stricmp(p,".DOC") || !strchr(assocfile,'.')) {
- readtext(tempfile);
- goto Doitall;
- }
- readfile("VIEWFILE.XBS",0,0,1);
- goto Doitall;
- }
- goto Doitall;
- case 16:
- if(user.stat[0]<mboard.minwrite) {
- say_prompt(591);
- goto Doitall;
- }
- memcpy(&oldmsg,&msg,sizeof(struct _xmsg));
- *replyid=0;
- if ((sub) || (!(mboard.attr & READONLY))) {
- if (nodenumber!=1) sprintf(message,"MSGTMP%hu",nodenumber);
- else strcpy(message,"MSGTMP");
- unlink(message);
- if(mboard.attr & ALTERNATE) strcpy(to_domain,conf.alt_domain);
- else strcpy(to_domain,conf.domain);
- if ((pp=oopen(message,O_RDWR | O_BINARY | O_DENYNONE))==-1)
- if((pp=ccreat(message,S_IWRITE))==-1) {
- say_prompt(301);
- goto Replyhere;
- }
- hold=get_text(messno);
- if (hold==NULL) {
- cclose(pp);
- say_prompt(41);
- goto SetLast;
- }
- strip_seenbys(hold);
- strip_blanklines(hold);
- p=tempo=hold;
-
- x=user.width-9;
- if (x>65) x=65;
-
- say_prompt(426);
-
- helpnum=572;
- strcpy(qstring,genin(5,0,0,0,ALLL));
- helpnum=0;
- if(!*qstring) {
- ffprintf(pp,"\r\n");
- ffprintf(pp,say_prompt(427),msg.date,msg.from,msg.to,msg.subj);
- ffprintf(pp,"\r\n%s\r\n",say_prompt(428));
- }
-
- while (*p) {
- strcpy(message,write_line(&p,x,1));
- Restrip:
- if (*message=='\x1') {
- if (!strncmp(message,"\01PATH:",6)) break;
- if(msg.o_zone==0) {
- if (!strncmp(message,"\01FMPT",5)) {
- msg.o_point=(word)atol(&message[6]);
- continue;
- }
- else if (!strncmp(message,"\01INTL",5)) {
- strtok(message," :");
- strtok(0," ");
- tempo=strtok(0,":");
- if(tempo) if ((word)atoi(tempo)) msg.o_zone=(word)atol(tempo);
- continue;
- }
- if (!strncmp(message,"\01DOMAIN",7)) {
- strtok(message," ");
- tempo=strtok(0,"\n");
- if(tempo) {
- strncpy(to_domain,tempo,37);
- to_domain[36]=0;
- }
- continue;
- }
- }
- if (!strncmp(message,"\01MSGID",6)) {
-
- char *p;
- char *ispoint;
- char *isdomain;
- char *isnumsign;
- char *mss;
-
- strncpy(replyid,&message[7],80);
- replyid[79]=0;
- lstrip(replyid);
- rstrip(replyid);
- mss=message;
- ispoint=strchr(mss,'.');
- isdomain=strchr(mss,'@');
- isnumsign=strchr(mss,'#');
- if(isnumsign) { /* For [user@]domain#z:n/n.p */
- if(isdomain) {
- if(isnumsign<isdomain) {
- strtok(mss,"@");
- strncpy(msg.to,mss,36);
- msg.to[35]=0;
- mss=strtok(0,"\n");
- isdomain=NULL; /* Was username */
- }
- }
- strtok(mss,"#");
- strncpy(to_domain,mss,37);
- to_domain[36]=0;
- mss=strtok(0,"\n");
- }
- strtok(mss," :");
- p=strtok(0,":");
- if(p)msg.o_zone=(word)atol(p);
- p=strtok(0,"/");
- msg.orig_net=(word)atol(p);
- if(ispoint) p=strtok(0,".");
- else if (isdomain) p=strtok(0,"@");
- else p=strtok(0," ");
- if(p)msg.orig=(word)atol(p);
- if(ispoint) {
- p=strtok(0,"@ ");
- if(p && (word)atoi(p) && atol(p)<65536)
- msg.o_point=(word)atol(p);
- }
- if(isdomain) {
- p=strtok(0," \r");
- if(p) strncpy(to_domain,p,37);
- to_domain[36]=0;
- }
- continue;
- }
- else {
- if(!ctla) continue;
- while ((tempo=strchr(hold,'\x1'))) *tempo='@';
- }
- }
- if(!*message)ffprintf(pp,"\r\n");
- else ffprintf(pp,"%s%s\r\n",qstring,message);
- }
- if (hold) ffree(hold);
- if(!*qstring) ffprintf(pp,"%s\r\n",say_prompt(429));
- cclose(pp);
- Replyhere:
- x=(word)*msginfo;
- if(!strstr(msginfo,"RETAIN "))*msginfo=0;
- if ((mboard.attr & NET) || (mboard.attr & ALTERNATE)) {
- msg.m_attr = msg.m_attr | MSGNET;
- msg.dest=msg.orig;
- msg.dest_net=msg.orig_net;
- msg.d_zone=msg.o_zone;
- msg.d_point=msg.o_point;
- }
- if (strnicmp(msg.subj,"Re:",3)) {
- strcpy(message,msg.subj);
- strcpy(msg.subj,"Re: ");
- strncat(msg.subj,message,64);
- msg.subj[63]=0;
- strcpy(oldmsg.subj,msg.subj);
- }
- if (!(msg.m_attr & MSGANON)) strcpy(msg.to,msg.from);
- else {
- strcpy(msg.to,say_prompt(47));
- strcpy(oldmsg.from,say_prompt(47));
- }
- safe=0;
- if (!askwrite(1+(16*(msg.attr & MSGPRIVATE)))) {
- if (!writemessage(0)) level=(word)makemessage(0);
- }
- else {
- level=1;
- if (nodenumber!=1) sprintf(message,"MSGTMP%hu",nodenumber);
- else strcpy(message,"MSGTMP");
- unlink(message);
- strcat(message,".INF");
- unlink(message);
- tempo=strchr(message,'.');
- *tempo=0;
- strcat(message,".HDR");
- unlink(message);
- }
- safe=1;
- sprintf(buffer,"%sXDATA.%03x",messpath,mboard.number);
- if(findfirst(buffer,&filestat,0)) {
- say_prompt(48);
- goto SetLast;
- }
- nomess=(word)((filestat.ff_fsize/(long)sizeof(struct _xmsg)));
- get_mess(messno);
- *msginfo=(char)x;
- goto Doitall;
- }
- break;
- case 17:
- if (sub) {
- msg.m_attr=(msg.m_attr ^ MSGDELETED);
- (msg.m_attr & MSGDELETED)!=0 ? say_prompt(303) : say_prompt(304);
- put_mess(messno);
- if((msg.m_attr & MSGNET) && !(msg.attr & MSGSENT) && !(msg.m_attr & MSGSCANNED)) {
- if(msg.m_attr & MSGDELETED) gprintf(LOGONLY,"Deleted net msg MSGID %s",lastmsgid);
- else gprintf(LOGONLY,"Undeleted net msg MSGID %s",lastmsgid);
- }
- goto Doitall;
- }
- break;
- case 18:
- type=type|128;
- nextkey=0;
- goto Scanswitch;
- default: {
- char s[13];
-
- sprintf(s,"AFTER%03u.XBS",comval);
- readfile(s,1,1,1);
- goto Doitall;
- }
- }
- printm(BACKSPACE);
- goto Doitover;
-
- SetLast:
-
- *msginfo=0;
- pauser=0;
- slowprint=0;
-
- keymess=lastmess;
- cclose(ta);
- cclose(fa);
- if (exported) {
- gprintf(0,say_prompt(377),exported);
- }
- safe=1;
- if((type & 128) && !scanflag) return (lastmess);
- if (!(type & 2)) {
- if (mboard.number<(conf.nolmrs+1)) {
- if (lastmess>lastread[mboard.number-1]) {
- if(conf.logmsg) gprintf(LOGONLY,"Read msgs in %s (%u)",mboard.name,mboard.number);
- lastread[mboard.number-1]=lastmess;
- }
- }
- }
- return (lastmess);
- }
-
-
-
- char * pascal mci (char *text) {
-
- static char s[256];
- char work[81];
- char temp[36];
- char *p;
- register word x=0;
- struct date dos_date;
- struct time dos_time;
-
- if (!*text) return text;
- stripcr(text);
- if (!*text) return "\r\n";
- *work=0;
- if (*text=='^') strcat(work," ");
- strcat(work,text);
- text=work;
- strcpy(s,strtok(text,"^"));
- while ((p=strtok(0,"^"))!=NULL && (strlen(s)+strlen(p)+1)<(256-35)) {
- switch ((int)toupper(*p)) {
- case 'H': if (!isdigit(p[1])) {
- strcat(s,BACKSPACE);
- p++;
- break;
- }
- for (x=0;x<(p[1]-'0');x++) strcat(s,BACKSPACE);
- p+=2;
- break;
- case 'U': if (!(mboard.attr & REAL)) strcpy(temp,user.name);
- else strcpy(temp,user.handle);
- if (!isdigit(p[1]) || p[1]=='0') {
- strcat(s,temp);
- if (p[1]!='0') {
- p++;
- break;
- }
- }
- else if (p[1]=='1' || !strchr(temp,' ')) {
-
- char *pp;
-
- if(pp=strchr(temp,' ')) *pp=0;
- strcat(s,temp);
- }
- else {
- strtok(temp," ");
- strcat(s,strtok(0," "));
- }
- p+=2;
- break;
- case 'B': strcat(s,"\x7");
- p++;
- break;
- case 'A': p++;
- if(isdigit(*p)) *p=*p-'0';
- else if(toupper(*p)=='A') {
- strcat(temp,"\x1b[36m");
- goto CoitusInterruptus;
- }
- else {
- p--;
- break;
- }
- strcat(temp,"\x1b[");
- switch((int)(*p)) {
- case 0: strcat(temp,"0;1;32");
- break;
- case 1: strcat(temp,"1");
- break;
- case 2: strcat(temp,"2");
- break;
- case 3: strcat(temp,"5");
- break;
- case 4: strcat(temp,"7");
- break;
- case 5: strcat(temp,"31");
- break;
- case 6: strcat(temp,"32");
- break;
- case 7: strcat(temp,"33");
- break;
- case 8: strcat(temp,"34");
- break;
- case 9: strcat(temp,"35");
- break;
- }
- strcat(temp,"m");
- CoitusInterruptus:
- if(user.graphics)strcat(s,temp);
- p++;
- break;
- case 'T': gettime(&dos_time);
- strcat(s,saytime(&dos_time));
- p++;
- break;
- case 'D': getdate(&dos_date);
- strcat(s,saydate(&dos_date));
- p++;
- break;
- case 'R': sprintf(temp,"%u",(word)(timelimit-(getxbbstime()/60)));
- strcat(s,temp);
- p++;
- break;
- case 'S': slowprint=1;
- p++;
- break;
- default: break;
- }
- strcat(s,p);
- }
- strcat(s,"\n");
- return s;
- }
-
-
-
- void pascal printheader (page,messno,type,nomess)
-
- char page;
- word messno;
- char type;
- word nomess;
-
- {
-
- char text[125];
- static char readprompt[80]="";
- static char headprompt[90];
- static char messprompt[80];
-
- if (!*readprompt) {
- strcpy(readprompt,say_prompt(316));
- strcpy(messprompt,say_prompt(317));
- strcpy(headprompt,say_prompt(318));
- }
- if (!user.scrnclr && !(type & 4) && user.graphics) printm("\x1b[1;1H");
- else printm("\n");
- printg("\x1b[0;2;37m\x1b[K");
- gprintf(0,headprompt,mboard.number,mboard.name,nomess,page+1);
- printg("\x1b[0;1;36m\x1b[K");
- gprintf(0,messprompt,messno);
- if ((msg.attr & MSGPRIVATE)) say_prompt(305);
- if ((msg.m_attr & MSGDELETED)) say_prompt(306);
- if ((mboard.attr & NET) || (mboard.attr & ALTERNATE)) {
- if ((msg.attr & MSGCRASH)) say_prompt(307);
- if ((msg.attr & MSGKILL)) say_prompt(308);
- if ((msg.attr & MSGSENT)) say_prompt(309);
- if ((msg.attr & MSGFWD)) say_prompt(310);
- if ((msg.attr & MSGRRQ)) say_prompt(312);
- if ((msg.attr & MSGCPT)) say_prompt(313);
- if ((msg.attr & MSGARQ)) say_prompt(314);
- if ((msg.attr & MSGURQ)) say_prompt(315);
- }
- if ((msg.attr & MSGREAD)) say_prompt(311);
- gprintf(0,readprompt,msg.times);
- printg("\x1b[K");
- gprintf(0,"To: %-36s",msg.to);
- if ((mboard.attr & NET) || (mboard.attr & ALTERNATE)) {
- gprintf(0," (%u:%u/%u.%01u) ",msg.d_zone,msg.dest_net,msg.dest,msg.d_point);
- }
- if ((msg.m_attr & MSGANON)) {
- left(text,msg.date,9);
- printm(text);
- }
- else printm(msg.date);
- printm("\n");
- printg("\x1b[K");
- printm("From: ");
- if (msg.m_attr & MSGANON) {
- say_prompt(264);
- gprintf(LOCALONLY," \04(%s)",msg.from);
- }
- else printm(msg.from);
- if ((mboard.attr & NET) || (mboard.attr & ALTERNATE)) {
- gprintf(0," (%u:%u/%u.%01u)",msg.o_zone,msg.orig_net,msg.orig,msg.o_point);
- }
- printm("\n");
- printg("\x1b[K");
- if ((msg.attr & MSGFILE)) say_prompt(329);
- else if ((msg.attr & MSGFRQ)) say_prompt(330);
- else if ((msg.attr & MSGURQ)) say_prompt(331);
- else printm("Subj: ");
- printm(msg.subj);
- printm("\n");
- printg("\x1b[K\x1b[0;1;32m");
-
- }
-
-
-
- void pascal strip_seenbys (char *hold) {
-
- char *path=NULL;
- char *seenby=NULL;
- char *origin=NULL;
- char *p;
-
- origin=strstr(hold,"\r * Origin:");
- if (origin) {
- while(p=strstr(&origin[1],"\r * Origin:")) origin=p;
- path=stristr(origin,"\r\01PATH:");
- seenby=strstr(origin,"\rSEEN-BY:");
- if (!seenby) seenby=stristr(origin,"\r\01SEEN-BY:");
- if (!path) if (seenby) *seenby=0;
- if (seenby && path) memmove (seenby,path,strlen(path)+1);
- }
- }
-
-
-
- char * pascal write_line (char **text,word linelen,char ctla) {
-
- static char line[133];
- word register x=0;
- char *p;
- char *pp;
-
- if(!*text) return "";
- if(!**text) return *text;
- p=*text;
- pp=line;
- *pp=0;
- while(++x<linelen && *p && *p!='\r') {
- if(*p=='\n' || *p=='\x8d') {
- p++;
- continue;
- }
- if((*p=='\01' && (*(p-1)=='\r' || p==*text)) && !ctla) {
- while(*p!='\r' && *p)p++;
- if(*p=='\r') p++;
- continue;
- }
- *pp++=*p++;
- *pp=0;
- }
- if(*p=='\r') {
- *pp=0;
- p++;
- }
- else if(*p==' ') {
- *pp=0;
- while(*p==' ') p++;
- }
- else if(x==linelen) {
- if(strchr(line,' ')) {
- while(p>*text && *pp!=' ') {
- *pp=0;
- pp--;
- p--;
- if(*p=='\n' || *p=='\x8d') p--;
- }
- if(p==*text) {
- strncpy(line,*text,linelen);
- line[linelen]=0;
- p=text[linelen];
- }
- else p++;
- }
- }
- while(*pp==' ' && pp>line) { /* Rstrip returned string */
- *pp=0;
- --pp;
- }
- *text=p;
- return line;
- }
-
-
- void pascal strip_blanklines (char *hold) {
-
- char *p;
-
- p=&hold[strlen(hold)-1];
- while(*p=='\r' && p>hold) {
- *p=0;
- p--;
- }
- }
-
-