home *** CD-ROM | disk | FTP | other *** search
/ The Devil's Doorknob BBS Capture (1996-2003) / devilsdoorknobbbscapture1996-2003.iso / Dloads / WWIVMODS / MODSUNKN.ZIP / BBSADD.MOD < prev    next >
Text File  |  1992-12-01  |  5KB  |  234 lines

  1. /*****************************************************************************
  2.                  BBS ADD
  3.             by: Dude 1@13121
  4.  
  5.   Here we go, a mod that prints a BBS Add after the Auto message, i wrote this
  6.   similar to the Automessage. But this is for you people that like to
  7.   advertise your bbs, so you write an automessage advertising your bbs. You
  8.   call back 1 hour later, and some guy has something else that is worthless
  9.   written in the automessage... This will print out a BBS Add right after
  10.   the Automessage.
  11.  
  12. *****************************************************************************/
  13.  
  14. Step 1
  15.  
  16. Load up BBSUTL1.C
  17.  
  18. Read (^KR) these files in the end of the bbsutl1.c file
  19.  
  20. void read_bbsadd()
  21. {
  22.   int i,i1,i2,i3,f,len,ptrbeg[10],ptrend[10];
  23.   char s[81],l[6][81],anon,buf[512];
  24.   slrec ss;
  25.  
  26.   strcpy(s,syscfg.gfilesdir);
  27.   strcat(s,"BBSADD.MSG");
  28.   f=open(s,O_RDWR | O_BINARY);
  29.   nl();
  30.   anon=status.amsganon;
  31.   if (f<1) {
  32.     prt(1,"No BBS Add, Make one by typing //BBSADD at the main menu");
  33.   } else {
  34.     len=read(f,(void *)buf,512);
  35.     close(f);
  36.     for (i=0; i<10; i++) {
  37.       ptrbeg[i]=0;
  38.       ptrend[i]=0;
  39.     }
  40.     i=0;
  41.     i1=0;
  42.     i2=0;
  43.     for(i=0; i<len; i++) {
  44.       if (i1) {
  45.         if (buf[i]==10) {
  46.           ptrbeg[i2]=i+1;
  47.           i1=0;
  48.         }
  49.       } else {
  50.         if (buf[i]==13) {
  51.           ptrend[i2]=i-1;
  52.           if (i2<6) {
  53.             for (i3=ptrbeg[i2]; i3<=ptrend[i2]; i3++)
  54.               l[i2][i3-ptrbeg[i2]]=buf[i3];
  55.               l[i2][ptrend[i2]-ptrbeg[i2]+1]=0;
  56.           }
  57.           ++i2;
  58.           i1=1;
  59.         }
  60.       }
  61.     }
  62.     ss=syscfg.sl[thisuser.sl];
  63.     if (anon)
  64.       if (ss.ability & ability_read_post_anony) {
  65.         strcpy(s,"<<< ");
  66.         strcat(s,&(l[0][0]));
  67.         strcat(s," >>>");
  68.       } else
  69.         strcpy(s,">UNKNOWN<");
  70.     else
  71.       strcpy(s,&(l[0][0]));
  72.     nl();
  73.     prt(2,"BBS Add by: %s",s,"");
  74.     nl();
  75.     i=1;
  76.     while ((ptrend[i]) && (i<6)) {
  77.       pl(&(l[i][0]));
  78.       ++i;
  79.     }
  80.   }
  81.   nl();
  82. }
  83.  
  84.  
  85. void write_bbsadd1()
  86. {
  87.   int i,i1,f;
  88.   char s[81],l[4][81];
  89.   slrec ss;
  90.  
  91.   nl();
  92.   prt(1,"Please Enter your BBS Add, you have 3 lines:");
  93.   nl();
  94.   for (i=0; i<3; i++) {
  95.     outchr(i+'1');
  96.     outchr(':');
  97.     inputl(&(l[i][0]),39);
  98.     strcat(&(l[i][0]),"\r\n");
  99.   }
  100.   nl();
  101.   ss=syscfg.sl[thisuser.sl];
  102.   if (ss.ability & ability_post_anony) {
  103.     prt(5,"Anonymous? ");
  104.     if (yn())
  105.       i1=anony_sender;
  106.     else
  107.       i1=0;
  108.   } else
  109.     i1=0;
  110.   prt(5,"Is this OK? ");
  111.   if (yn()) {
  112.     status.amsganon=i1;
  113.     status.amsguser=usernum;
  114.     save_status();
  115.     strcpy(s,syscfg.gfilesdir);
  116.     strcat(s,"BBSADD.MSG");
  117.     f=open(s,O_RDWR | O_BINARY | O_CREAT | O_TRUNC, S_IREAD | S_IWRITE);
  118.     strcpy(s,nam(&thisuser,usernum));
  119.     strcat(s,"\r\n");
  120.     write(f,(void *)s,strlen(s));
  121.     for (i=0; i<3; i++)
  122.       write(f,(void *)&(l[i][0]),strlen(&(l[i][0])));
  123.     sysoplog("Changed BBS Add");
  124.     for (i=0; i<3; i++) {
  125.       strcpy(s,"   ");
  126.       l[i][strlen(&(l[i][0]))-2]=0;
  127.       strcat(s,&(l[i][0]));
  128.       sysoplog(s);
  129.     }
  130.     nl();
  131.     prt(3,"Thank you, Your BBS Add is Saved...");
  132.     nl();
  133.     close(f);
  134.   }
  135.  
  136. }
  137.  
  138.  
  139. void write_bbsadd()
  140. {
  141.   char ch;
  142.   int done,okwrite;
  143.   slrec ss;
  144.  
  145.   ss=syscfg.sl[thisuser.sl];
  146.   if (ss.posts)
  147.     okwrite=1;
  148.   else
  149.     okwrite=0;
  150.   done=0;
  151.   do {
  152.     nl();
  153.     if (okwrite) {
  154.       prt(2,"=============] BBS Add Menu [============");
  155.       nl();
  156.       nl();
  157.       prt(5,"R - Read"); nl();
  158.       prt(5,"W - Write"); nl();
  159.       prt(5,"Q - Quit"); nl();
  160.       prt(1,"[BBS Add Menu] : ");
  161.       ch=onek("QRW");
  162.     }
  163.     switch(ch) {
  164.       case 'Q':
  165.         done=1;
  166.         break;
  167.       case 'R':
  168.         read_bbsadd();
  169.         break;
  170.       case 'W':
  171.         write_bbsadd1();
  172.         break;
  173.     }
  174.   } while ((!done) && (!hangup));
  175.  
  176. }
  177.  
  178.  
  179. Step 2
  180.  
  181. Load up BBS.C
  182.  
  183.  
  184.   if (strcmp(s,"CLS")==0)    /* SEARCH */
  185.     outstr("\x0c");
  186.   if (strcmp(s,"/O")==0)
  187.     hangup=1;
  188.   if (strcmp(s,"/E")==0)
  189.     slash_e();
  190.   if (strcmp(s,"/N")==0)
  191.     nscan(cursub);
  192.   if (strcmp(s,"NET")==0)
  193.     print_net_listing();
  194.   if (strcmp(s,"BBSADD")==0)             /* ADD */
  195.     write_bbsadd();                      /* ADD */
  196.   if (strcmp(s,"VER")==0) {
  197.     nl();
  198.     pl(VERSION_NUMBER);
  199.     nl();
  200.     pl("The author may be contacted at:");
  201.     nl();
  202.     pl("   Wayne Bell");
  203.     pl("   904 Silver Spur Road #636");
  204.     pl("   Rolling Hills Estates, CA  90274");
  205.     nl();
  206.   }
  207.  
  208.  
  209.  Step 3
  210.  
  211. Load up BBSUTL.C
  212.  
  213. IN - "void logon()"
  214.  
  215.   if (live_user)
  216.     read_automessage();             /* SEARCH */
  217.   if (live_user)                    /* ADD */
  218.     read_bbsadd();                  /* ADD */
  219.   timeon=timer();
  220.   useron=1;
  221.   if (live_user)
  222.     topscreen();
  223.  
  224. You may get a Warning, but i have seen no cause for alarm with it
  225.  
  226. Disclaimer -> I am NOT Responsible if it Nukes your house, kills your goldfish
  227. or Sucks you through the Floppy Drive.... or messes up your bbs.....
  228.  
  229. I hope you enjoy this mod.... Tell me if you are using it.... E-mail me on ANY
  230. WWIVLink BBS i am (1@13121)
  231.  
  232. Thanks.......
  233.  
  234.