home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Devil's Doorknob BBS Capture (1996-2003)
/
devilsdoorknobbbscapture1996-2003.iso
/
Dloads
/
WWIVMODS
/
MODSUNKN.ZIP
/
MSGQUOTE.MOD
< prev
next >
Wrap
Text File
|
1990-07-28
|
15KB
|
352 lines
91/100: Enhanced Message Quote Mod - Final Version
Name: Goose #1 @7312
Date: Sat Jul 21 09:48:50 1990
From: The Twilight Zone [703-369-5225]
Enhanced Message Quoting Mod (MSGQUOTE.MOD)
by Goose, 1@7312 (WWIVnet)
This is *hopefully* the final version of this mod. I've incorporated every
change/fix that has been sent to me, so I think there's been enough testing.
If you already have this mod installed, the only changes from the latest
version I sent out are in void quote_message - so just replace the existing
code with the one from here. If you're starting from scratch, this file
should be all you need.
=============================================================================
Many BBS software programs these days offer a "quoting" feature when replying
messages, which provides a "> " at the beginning of each quoted line, plus
provides the quoted text after it. For example, you would see a message like:
------------------------------------------------------------------------------
> How can I get rid of the DGROUP error in WWIV? I've been modding my board
> and now I get that whenever I recompile.
A DGROUP error means that you've run of out variable space in the board.....
------------------------------------------------------------------------------
If you didn't already know what I was talking about, you should get the idea
by now. What happens when you quote is the old message is read in, a "> " is
added to the beginning of each line, and you are put into the editor at the
bottom of the current message. There has been at least one other mod that has
been released that is similar, but not quite as flexible as this one (it
doesn't use the quote ">" indicator, which makes the message a little
confusing, and it doesn't work with the internal editor).
OK, now for the first part of the mod. Load up FCNS.H and make the following
one line addition (- indicates existing code, + indicates new/modified code):
- void grab_user_name(messagerec *m, char *fn);
- void quote_message(messagerec *m1, char *aux); /* mod - add */
- void scan(int msgnum, int optype, int *nextsub);
- void qscan(int bn, int *ns);
Now, go into MSGBASE1.C and find the void scan(....), and read in the following
code right before it.
+ void quote_message(messagerec *m1, char *aux) /* mod - add entire void */
+ {
+ char *b,*c,s1[81];
+ int cc,dq,lc,f,ok,mc;
+ long l,l1,l2;
+ messagerec m;
+
+ sprintf(s1,"%sINPUT.MSG",syscfg.tempdir);
+ if (exist(s1))
+ return;
+ nl();
+ prt(2,"Quote from message? ");
+ if (!yn())
+ return;
+ m=*m1;
+ b=readfile(&m,aux,&l);
+ if ((c=malloca(l+1000))==NULL) {
+ farfree(b);
+ return;
+ }
+ lc=0; l1=0; l2=0; ok=1;
+ do {
+ if (b[l1]==10)
+ lc++;
+ l1++;
+ } while (lc<2);
+ lc=0; dq=1; cc=48;
+ do {
+ if (lc==0) {
+ for (f=0; f<dq; f++) {
+ c[l2++]='>'; lc++;
+ }
+ if (dq==1) {
+ c[l2++]=' '; lc++;
+ }
+ if (cc!=48) {
+ c[l2++]=3;
+ c[l2++]=cc;
+ }
+ }
+ switch(b[l1]) {
+ case 3:
+ l1++;
+ cc=b[l1++];
+ c[l2++]=3;
+ c[l2++]=cc;
+ break;
+ case 1:
+ if (b[l1-1]!=32)
+ c[l2++]=' ';
+ l1+=3;
+ dq=1;
+ break;
+ case 13:
+ lc=0;
+ l1+=2;
+ dq=1;
+ while (b[l1]=='>') {
+ dq++; l1++;
+ }
+ if (dq>=6)
+ ok=0;
+ if (dq==1) {
+ cc=48;
+ c[l2++]=3;
+ c[l2++]=48;
+ }
+ c[l2++]=13;
+ c[l2++]=10;
+ break;
+ default:
+ c[l2++]=b[l1++];
+ lc++;
+ break;
+ }
+ if (dq==1)
+ mc=72;
+ else
+ mc=78;
+ if (lc>=mc) {
+ while ((b[l1]!=32) && (lc>0)) {
+ --l1; --l2; --lc;
+ if (b[l1]==3) {
+ lc+=2;
+ l2++;
+ }
+ if (b[l1]==1) {
+ l2+=3;
+ lc+=3;
+ }
+ }
+ if (lc==0) {
+ l1+=mc;
+ l2+=mc;
+ } else {
+ lc=0;
+ l1++;
+ }
+ c[l2++]=13;
+ c[l2++]=10;
+ }
+ } while (l1<l);
+ c[l2++]=13;
+ c[l2++]=10;
+ if (ok) {
+ sprintf(s1,"%sQUOTE.MSG",syscfg.tempdir);
+ f=open(s1,O_RDWR | O_BINARY | O_CREAT | O_TRUNC, S_IREAD | S_IWRITE);
+ write(f,(void *)c,l2);
+ close(f);
+ farfree(b);
+ farfree(c);
+ load_workspace(s1,0);
+ unlink(s1);
+ }
+ }
Now, in void scan(...), make the following changes:
- case 'R':
- optype=2;
- break;
- case 'A':
+ quote_message(&(msgs[msgnum].msg), /* mod - add */
+ (subboards[curlsub].filename)); /* mod - add */
- if ((msgs[msgnum].ownersys) && (!msgs[msgnum].owneruser))
and a little farther down:
- case 'W':
+ if (s[0]!='P') /* mod - add */
+ quote_message(&(msgs[msgnum].msg), /* mod - add */
+ (subboards[curlsub].filename)); /* mod - add */
- deleted_flag=0;
- post();
- if (deleted_flag && (deleted_flag<=msgnum))
Then, find void readmail(), and make the following changes:
- case 'A':
- case 'S':
- if (!okmail)
- break;
- close(f);
+ quote_message(&(m.msg),"EMAIL"); /* mod - add */
- num_mail=((long) thisuser.feedbacksent) +
- ((long) thisuser.emailsent) +
That's it for the quote itself. It will work fine as long as the user has
selected a full screen editor. Unfortunately, many don't like to do this and
instead stick with the internal editor in WWIV. The next part of this mod
allows the user to delete lines using the internal editor (which is necessary
to be able to really use the quote feature), and allows the internal editor to
be loaded from an external file. Load up MSGBASE.C and find void
load_workspace(...), then make the following change to allow editing of
messages when using the internal editor:
- strcat(s,"INPUT.MSG");
- i5=open(s,O_RDWR | O_CREAT | O_BINARY,S_IREAD | S_IWRITE);
- write(i5, (void *)b,l);
- close(i5);
- farfree(b);
+ if (no_edit) /* mod - change */
- use_workspace=1;
- else
- use_workspace=0;
Then go down to void inmsg(...), and add the variable declarations as shown.
You can include them on the line with the other int variables if you want, I
just figured it would be easier this way.
+ int i6,i7; /* mod - add */
And if you haven't defined it in another mod, you'll have to add l2 as well:
+ long l2; /* mod - add */
Then, go down a few lines and make the following change to correctly set the
flag only if an external editor is selected:
- strcat(fnx,"INPUT.MSG");
- if (fsed)
- fsed=1;
+ if ((use_workspace) && (okfsed)) { /* mod - change */
- if (!exist(fnx))
And a few lines farther down, add the following code to read in the input file
for the internal editor:
- for (i=0; i<maxli; i++)
- lin[i*LEN]=0;
- ro[0]=0;
+ if (exist(fnx)) { /* mod - add */
+ f=open(fnx,O_RDONLY | O_BINARY); /* mod - add */
+ l1=filelength(f); /* mod - add */
+ if ((b=malloca(l1))!=NULL) { /* mod - add */
+ read(f,(void *)b,l1); /* mod - add */
+ i7=0; l2=0; /* mod - add */
+ do { /* mod - add */
+ if (b[l2]==13) { /* mod - add */
+ s[i7]=0; /* mod - add */
+ strcpy(&(lin[(curli++)*LEN]),s); /* mod - add */
+ ++l2; /* mod - add */
+ i7=0; /* mod - add */
+ } else /* mod - add */
+ if ((b[l2]!=10) && (b[l2]!=26)) { /* mod - add */
+ s[i7]=b[l2]; /* mod - add */
+ ++i7; /* mod - add */
+ } /* mod - add */
+ ++l2; /* mod - add */
+ } while ((l2<l1) && (curli<maxli)); /* mod - add */
+ farfree(b); /* mod - add */
+ } /* mod - add */
+ close(f); /* mod - add */
+ unlink(fnx); /* mod - add */
+ } /* mod - add */
- }
-
- nl();
- helpl=6;
And right before the loop to start inputting text (right after the title has
been entered), add the following code to print out the quoted part of the
message so the user knows what he's working with:
- s[thisuser.screenchars]=0;
- pl(s);
+ if (curli!=0) { /* mod - add */
+ i1=0; i2=0; i3=thisuser.screenchars; /* mod - add */
+ for (i=0; (i<curli) && (!i2); i++) { /* mod - add */
+ strcpy(s1,&(lin[i*LEN])); /* mod - add */
+ if (s1[0]==2) { /* mod - add */
+ strcpy(s1,&(s1[1])); /* mod - add */
+ i7=0; /* mod - add */
+ for(i4=0; i4<strlen(s1); i4++) /* mod - add */
+ if ((s1[i4]==8) || (s1[i4]==3)) /* mod - add */
+ --i7; /* mod - add */
+ else /* mod - add */
+ ++i7; /* mod - add */
+ for (i4=0; (i4<(i3-i7)/2) && (!i2); i4++) /* mod - add */
+ osan(" ",&i2,&i1); /* mod - add */
+ } /* mod - add */
+ pla(s1,&i2); /* mod - add */
+ } /* mod - add */
+ pl("Use /D to delete extra lines, or begin entering.."); /* mod - add */
+ } /* mod - add */
-
- while (!done) {
- helpl=27;
Then, about 150 lines down, add the following code to add the /D (delete)
command for editing of the message:
- pl("Replace:");
- } else {
- pl("Nothing to replace.");
- }
- }
+ if ((stricmp(s,"/D")==0) && (curli>1)) { /* mod - add */
+ savel=0; /* mod - add */
+ sprintf(s1,"Delete from line 1-%d?",curli-1); /* mod - add */
+ prt(5,s1); /* mod - add */
+ input(s1,2); /* mod - add */
+ i7=atoi(s1); /* mod - add */
+ if (i7==curli-1) /* mod - add */
+ i6=i7; /* mod - add */
+ else { /* mod - add */
+ sprintf(s1,"through line %d-%d?",i7,curli-1); /* mod - add */
+ prt(5,s1); /* mod - add */
+ input(s1,2); /* mod - add */
+ i6=atoi(s1); /* mod - add */
+ } /* mod - add */
+ if ((i7>0) && (i6>=i7) && (i6<=curli-1)) { /* mod - add */
+ memmove(&lin[(i7-1)*LEN],&lin[(i6)*LEN], /* mod - add */
+ LEN*(curli-i6+1)); /* mod - add */
+ curli+=i7-i6-1; /* mod - add */
+ pl("Line(s) deleted. Continue entering..."); /* mod - add */
+ } else /* mod - add */
+ pl("Nothing deleted."); /* mod - add */
+ } /* mod - add */
- if (stricmp(s,"/TI")==0) {
- savel=0;
- helpl=26;
Update the menus to reflect the changes, and recompile the entire board (since
FCNS.H has changed). One thing about this mod... since it removes the "soft
returns" that allow messages to flow correctly if the user is set for 80
columns, the quoted part of the message may look a little strange for these
users. Unfortunately, there was no easy way to accomplish this without forcing
everyone to use this mod, so I guess some will just have to live with that.
However, since most user do have 80 columns, it really shouldn't be much of a
problem, but you might want to consider your user base before you decide to
install this mod. Also, if a message contains real ANSI codes it probably will
come out strange looking if it is quoted. The normal WWIV colors should be
handled with no problems.
Tony "Goose" Geisler The Twilight Zone BBS
703-369-5225 WWIVnet node @7312
300/1200/2400/9600/19.2K baud USR HST modem (MNP level 5)
An Official WWIV Support Board WWIV Sysop Autovalidation