home *** CD-ROM | disk | FTP | other *** search
- Nick #1 @1301
- Thu Jun 29 20:21:28 1995
- ┌────────────────────────────────────────────────────────────────────────────┐
- │ Mod Name : EGG2.MOD Original Author : Scramblegg 1@15284 NET │
- │ Difficulty : ██▒▒▒▒▒▒▒▒ Updated to 4.23 : The Irishman │
- │ WWIV Version : 4.24 Updated to 4.24 : Nick 1@1301 │
- │ Mod Date : 07/07/92 Mod Update: 06/29/95 │
- │ Files Affected: BBS.C, MISCCMD.C, MMENU.C, FCNS.H │
- │ Description : The Fabled and somewhat elusive //ADEIT mod! The BEST │
- │ Enhanced Automessage mod there is! │
- └────────────────────────────────────────────────────────────────────────────┘
- ┌────────────────────────────────────────────────────────────────────────────┐
- │ 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) │
- │ │
- │ 06/29/95 : I was looking for an extremely well done auto message │
- │ modification for 4.24, couldn't find one, so not being │
- │ fond of reinventing the wheel, I revamped this one. │
- │ Watch out for line wrap....!!! │
- │ -Nick, 1@1301 │
- │ │
- └────────────────────────────────────────────────────────────────────────────┘
-
- ============================================================================
- Step 1 - Take out old auto message.
- ============================================================================
- At the beginning of MISCCMD.C, search for:
-
- void read_automessage()
-
- Delete the entire function.
-
- ============================================================================
- Step 2: Add New Auto Message function.
- ============================================================================
- Add this to the bottom of MISCCMD.C:
-
- 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,color
- 2,
- 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<anonysl) {
- 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 %s\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 s
- ave 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");
-
- ============================================================================
- Step 4: Change the call to the function.
- ============================================================================
-
- in MMENU.C, in void mainmenu() look for
-
- case 'A':
-
- And change the:
- write_automessage();
- to
- newam();
-
- ============================================================================
- Step 5: Add auto-message edito.
- ============================================================================
-
- In MMENU.C, function mainmenu(void) search for this:
-
- /* force_callout(2); */
- }
- if (strncmp(s,"DEBUG",5)==0) {
- if((s[5]) && (s[5]!=' '))
- debuglevel=s[5]-'0';
- else if(s[6])
- debuglevel=s[6]-'0';
- }
-
- And insert this:
-
- if (cs()) {
- if (strcmp(s, "AEDIT")==0)
- aedit();
- }
-
- ============================================================================
- Step 6: 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;
- }
- }
- }
- }
- ============================================================================
- Step 6: Function prototypes
- ============================================================================
-
- Either use MAKE FCNS, or edit FCNS.H manually as follows:
-
- Delete void read_automessage()
- void write_automessage1()
- void write_automessage()
-
- Add
- void newam();
- to the end of the functions in MISCCMD.C
-
-
- MAKE the BBS and that should do it.
-