Category : BBS Programs+Doors
Archive   : TONSMOD.ZIP
Filename : EGG02A.MOD

 
Output of file : EGG02A.MOD contained in archive : TONSMOD.ZIP
Rick! #1 @5803
Mon Aug 24 19:58:25 1992
Auto Message Mod <4.21...>
Nostromo #1 @7425
Sun Aug 16 22:19:16 1992

EGG2.MOD -- Version 1.1 ! (upgrade or new install)
Scramblegg #1 @15284
Tue Jul 07 21:00:20 1992
ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
³ EGG2.MOD - A New Auto-Message (Version 1.1) ³
³ Frustrated with the small auto-message in stock WWIV, I wrote this. It ³
³ lets you write an auto-message with Ctrl-P color, word wrap, unlimited ³
³ lines, the Ctrl-N/X/W features, etc. You can lock the auto message ³
³ (letting only the sysop write it) or unlock it (letting anyone change it) ³
³ while in the BBS, without having to recompile. ³
³ New features in 1.1: Now all variables are kept external, so that you ³
³ can change them without recompiling the BBS. They are: maximum lines per ³
³ message, the security level to write anonymous, the auto-message colors, ³
³ the auto-message lock, whether or not the auto-message is anonymous, and ³
³ the author of the auto-message. There is now an editor, accessed with ³
³ //AEDIT from the main menu, to edit those variables. ³
³ More stuff: The ability to write anonymous auto-messages, configurable ³
³ colors, two auto-message files are written now, one for ansi users and one ³
³ for those without ansi, the choice to abort an auto-message if no subject ³
³ is given, auto-replying to the author of an auto-message. ³
³ ³
³ The Disclaimer: I'm only responsible for the GOOD things this mod does. ³
³ Simple enough, eh? 🙂 Address any comments, etc to 1@15284 (Scramblegg) ³
ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
³Upgrading from Version 1.0 -- Read this ONLY if you are upgrading from 1.0 ³
³ ³
³ You will probably just want to delete your newam() function, and just ³
³add the new one in its place. But be sure to follow the directions since ³
³some stuff will need to be modified. Do ALL of the steps except #1. ³
ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ

Help: Anything in a box is code that you need to look for or change. Just
follow the instructions.

============================================================================
Step 1 - Take out old auto message (Skip if you are upgrading)
============================================================================
At the beginning of MISCCMD.C, change
ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
³void read_automessage()³
ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
to
ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
³/* ³
³void read_automessage()³
ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
and then at the end of write_automessage(), where it has
ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
³ } while ((!done) && (!hangup));³
³ ³
³} ³
ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
change to
ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
³ } while ((!done) && (!hangup));³
³ ³
³}*/ ³
ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ

This deletes the normal auto-message functions by putting them in comments.
But, they are still available should you have problems.

============================================================================
Step 2: Add New Auto Message function (Be sure and do this step!)
============================================================================
Add this to the bottom of MISCCMD.C:

/* If you're upgrading, be sure to take out the #define AMSGLINES */

void newam()
{
time_t secs_now;
struct tm *mt;
char k,s[161],ro[160],fn[80],author[80],color1,color2,lock,anony;
int optoo,AMSGLINES,mailto,anonysl;
FILE *ff,*gg;

gg=fopen("AUTOMSG.CNT","r+");
if(gg==NULL) {
nl();
prt(1,"Auto message status file not found. Creating with defaults.");
gg=fopen("AUTOMSG.CNT","w+");
fprintf(gg,"20\n255\n7\n1\n0\n0\n ");
fseek(gg,0,SEEK_SET);
nl();
}
AMSGLINES=atoi(fgets(s,80,gg));
anonysl=atoi(fgets(s,80,gg));
color1=atoi(fgets(s,80,gg));
color2=atoi(fgets(s,80,gg));
lock=atoi(fgets(s,80,gg));
anony=atoi(fgets(s,80,gg));
fgets(author,80,gg);
fclose(gg);

for(;;) {
ro[0]=0;
nl();
npr("%c%d%s Auto-Message Menu\r\n",3,color1,syscfg.systemname);
sprintf(fn,", [%c%dL%c%d]ock/Unlock Auto-Message",3,color1,3,color2);
ansic(color2);
npr("[%c%dR%c%d]ead, [%c%dW%c%d]rite, [%c%dQ%c%d]uit, [%c%dA%c%d]uto-Reply%s : ",3,color1,3,
color2,3,color1, 3,color2, 3,color1, 3,color2, 3,color1,3,color2,
so() ? fn : "");
if(!so())
k=onek("RWQA");
else
k=onek("RWQAL");
switch(k) {
case 'Q': return;
case 'L':
nl();
lock = (!lock);
ansic(7);
npr("Auto-Message is now %s\r\n", lock ? "Locked" :
"Unlocked");
break;
case 'R': printfile("NEW_AUTO"); break;
case 'A':
if(anony && actsl nl();
ansic(2);
pl("This is an anonymous auto-message. You cannot auto-reply.");
break;
}
nl();
mailto=finduser(author);
if(mailto>0)
email(mailto,0,0,0);
else
pl("Sorry, the user who wrote this auto-message cannot be found.");
break;
case 'W':
if(lock && (!so())) {
nl();
prt(7,"The auto-message has been locked by the SysOp");
break;
}
secs_now = time(NULL);
mt = localtime(&secs_now);
sprintf(fn,"%sTEMP.MSG",syscfg.gfilesdir);
ff=fopen(fn,"w");
if(ff==NULL) return;
nl();
if(actsl>=anonysl) {
outstr("Would you like this to be anonymous? ");
anony=yn();
}
fprintf(ff,"%c%dAuto-Message written by %c%d%s%c%d on %c%d%d/%d/%d%c0\n",
3,color2, 3, color1, anony ? "ANONYMOUS" : thisuser.name,
3,color2, 3, color1, (mt->tm_mon)+1,mt->tm_mday,
mt->tm_year,3);
fprintf(ff,"%c%d",3,color2);
for(k=0;k<79;k++)
fputc(196, ff);
fprintf(ff,"\n");
ansic(7);
outstr("Subject: ");
ansic(0);
mpl(60);
inputl(s,60);
if(strlen(s)==0) {
prt(2,"No subject. Abort? ");
if(yn()) break;
}
fprintf(ff,"%c%dSubject:%c%d %s0\n", 3,color1, 3, color2, s);
s[0]=0;
fprintf(ff,"%c%d",3,color2);
for(k=0;k<79;k++)
fputc(196, ff);
fprintf(ff,"\n");
nl();
optoo=0;
npr("Enter Auto-Message now - %s line limit. /ES saves."
" /ABT aborts. ", (AMSGLINES) ? itoa(AMSGLINES,s,10) : "No");
s[0]=0;
pl("Control-P color codes are recognized.");
outstr("[--------.---------.---------.---------.---------.---------.---------.---------]");
for(k=0;optoo==0;) {
if(k==AMSGLINES && (AMSGLINES)) {
for(;;) {
outstr("Save? ");
if(yn()) optoo=1;
outstr("Abort? ");
if(!ny()) {
nl();
prt(1,"You have reached the maximum line limit -- You MUST save or abort!\r\n");
}
else optoo=2;
if(optoo) break;
}
}
if(k==(AMSGLINES-1) && (AMSGLINES))
prt(0,"This is your 6last0 line!\r\n");
inli(s,ro,160,1);
if(stricmp(s,"/ES")==0) optoo=1;
if(stricmp(s,"/ABT")==0) optoo=2;
if(optoo) break;
fprintf(ff,"%s\n",s);
k++;
}
if(optoo==2) {
fclose(ff);
unlink(fn);
pl("Auto-Message aborted.");
}
if(optoo==1) {
outstr("Saving...");
strcpy(author,thisuser.name);
fprintf(ff,"%c%d",3,color2);
for(k=0;k<79;k++)
fputc(196, ff);
fprintf(ff,"\n");
fclose(ff);
sprintf(s,"copy %stemp.msg %snew_auto.ans > nul",syscfg.gfilesdir,
syscfg.gfilesdir);
system(s);
for(k=0;k<9;k++) {
outstr("<");
backspace();
backspace();
}
prt(2,"Creating non-ansi auto-message...");
sprintf(s,"%snew_auto.ans",syscfg.gfilesdir);
ff=fopen(s,"r");
sprintf(s,"%snew_auto.msg",syscfg.gfilesdir);
gg=fopen(s,"w");
while(!feof(ff)) {
s[0]=fgetc(ff);
if(s[0]=='Ä') fputc('-',gg);
else if(s[0]==3) fgetc(ff);
else fputc(s[0],gg);
}
fclose(ff);
fclose(gg);
for(k=0;k<33;k++) {
outstr("<");
backspace();
backspace();
}
prt(2,"Rewriting status...");
gg=fopen("AUTOMSG.CNT","w");
fprintf(gg,"%d\n%d\n%d\n%d\n%d\n%d\n%s",AMSGLINES,anonysl,
color1,color2,lock,anony,author);
fclose(gg);
for(k=0;k<19;k++) {
outstr("<");
backspace();
backspace();
}
prt(2,"Auto-Message saved.");
}
break;
}
}
}


============================================================================
Step 3: Change calls to old auto-message to new auto-message
============================================================================


In LILO.C, in void logon(), look for this:
ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
³ if (ss!=NULL) ³
³ farfree(ss); ³
³ nl(); ³
³ if (live_user) ³
³ read_automessage();³
ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
Change
read_automessage();
to
printfile("NEW_AUTO"); /* This is for Version 1.1 -- Change this line! */

in BBS.C, in void mainmenu() look for
ÚÄÄÄÄÄÄÄÄÄ¿
³case 'A':³
ÀÄÄÄÄÄÄÄÄÄÙ
And change the:
write_automessage();
to
newam();

============================================================================
Step 4: Add auto-message editor (Be sure and do this step!)
============================================================================

First, go to BBS.C, and in void mainmenu() look for this:
ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
³ for (i=0; i ³ if (strcmp(usub[i].keys,s)==0) ³
³ cursub=i; ³
³/**************************************************/ ³
³ if (so()) { ³
ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
And add this RIGHT after the last line:

if (strcmp(s, "AEDIT")==0)
aedit();

============================================================================
Step 5: Add the Auto-Message setup editor
============================================================================

Open MISCCMD.C. Add the following function to the end:

void aedit()
{
FILE *gg;
char choice,color1,color2,lock,anony,author[81],s[81];
int anonysl,lines;

gg=fopen("AUTOMSG.CNT","r+");
if(gg==NULL) {
prt(1,"\r\nAuto message status file not found. Creating with defaults.\r\n");
gg=fopen("AUTOMSG.CNT","w+");
fprintf(gg,"20\n255\n7\n1\n0\n0\n ");
fseek(gg,0,SEEK_SET);
}
lines=atoi(fgets(s,80,gg));
anonysl=atoi(fgets(s,80,gg));
color1=atoi(fgets(s,80,gg));
color2=atoi(fgets(s,80,gg));
lock=atoi(fgets(s,80,gg));
anony=atoi(fgets(s,80,gg));
fgets(author,80,gg);
fclose(gg);

for(;;) {
nl();
itoa(lines,s,10);
npr(" %c7Auto-Message Stats:\r\n",3);
npr("1> Max. Lines: %s\r\n",lines ? s : "Unlimited");
npr("2> Anony Security Level: %d\r\n",anonysl);
npr("3> Color #1: %c%dColor %c0(#%d)\r\n",3,color1,3,color1);
npr("4> Color #2: %c%dColor %c0(#%d)\r\n",3,color2,3,color2);
npr("5> Locked? %s\r\n", lock ? "Yes" : "No");
pl("Q> Quit+Save");
pl("X> Quit Without Saving");
npr("Auto-Message Written by: %s\r\n", author);
outstr("Choose: [1-5,Q,X] ? ");
choice=getkey();
npr("%c",choice);
if(isalpha(choice)) choice=toupper(choice);
if(choice=='Q' || choice=='X' || (choice>='1' && choice<='5')) {
nl();
switch(choice) {
case '1':
outstr("Enter new max lines (0 for unlimited): ");
mpl(3);
input(s,3);
lines=atoi(s);
npr("Maximum lines now: %s.", lines ? s : "Unlimited");
break;
case '2':
outstr("Enter new security level to write anonymous: ");
mpl(3);
input(s,3);
anonysl=atoi(s);
npr("New Anony SL: %d.",anonysl);
break;
case '3':
outstr("Enter new color for Color #1: ");
mpl(1);
s[0]=getkey();
npr("%c",s[0]);
nl();
if(s[0]>='0' && s[0]<='7')
color1=(s[0]-'0');
else
pl("Not a valid color (range: 0-7)");
break;
case '4':
outstr("Enter new color for Color #2: ");
mpl(1);
s[0]=getkey();
npr("%c",s[0]);
nl();
if(s[0]>='0' && s[0]<='7')
color2=(s[0]-'0');
else
pl("Not a valid color (range: 0-7)");
break;
case '5':
lock = (!lock);
npr("Auto-Message now %s.", lock ? "locked" : "unlocked");
break;
case 'X':
return;
case 'Q':
gg=fopen("AUTOMSG.CNT","w");
fprintf(gg,"%d\n%d\n%d\n%d\n%d\n%d\n%s",lines,anonysl,
color1,color2,lock,anony,author);
fclose(gg);
return;
break;
}
}
}
}
============================================================================
Step 6: Function prototypes
============================================================================

Either use MAKE FCNS, or edit FCNS.H. Delete the void read_automessage(),
void write_automessage1(), and void write_automessage(). Then add void
newam(void); to the end of the functions in MISCCMD.C (I suggest using MAKE
FCNS, though :-)).



That should do it. Let me know if you have any problems or suggestions, etc
at the above WWIVnet address.



  3 Responses to “Category : BBS Programs+Doors
Archive   : TONSMOD.ZIP
Filename : EGG02A.MOD

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/