home *** CD-ROM | disk | FTP | other *** search
/ The Arcade BBS / arcadebbs.zip / arcadebbs / bbstools / MODS / ALLMODS.ZIP / FMD-36A.ZIP / FMD-36A.MOD < prev    next >
Encoding:
Text File  |  1995-06-22  |  10.4 KB  |  438 lines

  1. Nicolas Leblanc #2 @20302
  2. Sun Jun 18 23:40:51 1995
  3.    ┌┬─── ──  ─   ─  ── ───────────────────────────────────────────────────┬─ ∙∙
  4.    ││                    Alternative Worlds Presents                      │
  5.    └┼─────────────────────────────────────────────────────────────────────┐
  6.    ││ Mod Name       » FMD-36a.MOD                                        │∙
  7.    ││ Difficulty     » █▒▒▒▒▒▒▒▒▒▒ (1/10)                                 │:
  8.    ││ WWIV Version   » 4.24                                               ││
  9.    ││ Date Affected  » 06/01/95                                           ││
  10.    :│ Files Affected » XFEROVL2.C / NEWUSER.C / COM.C / MISCCMD.C         ││
  11.    :│                  UEDIT.C                                            ││
  12.    ∙│ Description    » Slashes And Dashes System For WWIV                 ││
  13.     └─────────────────────────────────────────────────────────────────────┼┐
  14.     │       A French Mod Division Release - (C) 1995 FMD Software         ││
  15. ∙∙ ─┴─────────────────────────────────────────────────── ──  ─   ─  ── ───└┘
  16.  
  17.  ┌┬══════════════════┐
  18.  ││ Long Description ││
  19.   └══════════════════┴┘
  20.  
  21.   This modification will enhance your system, particulary the new user
  22. routine. It will input slashes and dashes automatically in phone numbers,
  23. zip code, birthday and nscan date.
  24.  
  25.   It will also be Canadian aware, it will allow us, Canadians to enter our
  26. postcal code in the correct format, but only if the user enter CAN as his
  27. country.
  28.  
  29.   It will also take care of the bbslist phone input.
  30.  
  31. Revision A:
  32.  
  33.  - Updated for WWIV v4.24
  34.  - More robust bday prompt
  35.  - Fixed goxy problem when entering unvalid bday
  36.  
  37.  ┌┬═══════┐
  38.  ││ Tests ││
  39.   └═══════┴┘
  40.  
  41.   This modification has been tested on a virgin WWIV v4.24 source using
  42.   Borland C++ v4.5
  43.  
  44. ──────────────────────────────────────────────────────────────────────────────
  45.                                    Legend
  46.                           ╔═══╤══════════════════┐
  47.                           │ + │ Add This Line    │
  48.                           │ - │ Delete This Line │
  49.                           │ * │ Modify This Line │
  50.                           │ = │ Existing Line    │
  51.                           └═══╧══════════════════╝
  52. ───[Step 1]────────────────────────────────────────────────────────────────────
  53.  
  54. Load COM.C and put the following function after void mpl(...)
  55.  
  56. void mpl2(int i)
  57. {
  58.   char s[81];
  59.  
  60.   if (okansi()) {
  61.     npr("9[4%s9]", charstr(i, ' '));
  62.     outstr("\x1b[");
  63.     itoa(i + 1, s, 10);
  64.     outstr(s);
  65.     outstr("D");
  66.     ansic(4);
  67.   }
  68. }
  69.  
  70. and this one after char onek:
  71.  
  72. char oneknlf(char *s)
  73. {
  74.   char ch;
  75.  
  76.   while (!strchr(s, ch = upcase(getkey())) && !hangup)
  77.     ;
  78.   if (hangup)
  79.     ch = s[0];
  80.   if (ch!='\b')
  81.     outchr(ch);
  82.   return(ch);
  83. }
  84.  
  85. And this one at the end of the file:
  86.  
  87. void get_phone(char *phone)
  88. {
  89.   int i=0;
  90.   char c;
  91.  
  92.   do
  93.   {
  94.     if (i<12)
  95.       c=oneknlf("0123456789\b\r\n");
  96.     else
  97.       c=oneknlf("\b\r\n");
  98.     phone[i]=c;
  99.     if (phone[i]=='\b')
  100.     {
  101.       if (i>0)
  102.       {
  103.         i--;
  104.         if ((i==3) || (i==7))
  105.         {
  106.           outstr("\b\b  \b\b");
  107.           i--;
  108.         } else
  109.           backspace();
  110.       }
  111.     } else {
  112.       i++;
  113.     }
  114.     if (i==3||i==7)
  115.     {
  116.       phone[i]='-';
  117.       outchr('-');
  118.       i++;
  119.     }
  120.   } while((!hangup) && (c!='\r'&&c!='\n'&&i<13));
  121.   nl();
  122.   if (i<12)
  123.     phone[0]=0;
  124.   phone[12]=0;
  125. }
  126.  
  127. ───[Step 2]────────────────────────────────────────────────────────────────────
  128.  
  129. Load NEWUSER.C and replace the following 3 functions
  130.  
  131. void input_phone(void)
  132. {
  133.   int i=0;
  134.   char c;
  135.  
  136.   nl();
  137.   ansic(3);
  138.   pl(get_string(527));
  139.   ansic(3);
  140.   pl(get_string(493));
  141.   prt(2,":");
  142.   mpl(12);
  143.   do
  144.   {
  145.     if (i<12)
  146.       c=oneknlf("0123456789\b");
  147.     else
  148.       c=oneknlf("\b\r\n");
  149.     thisuser.phone[i]=c;
  150.     if (thisuser.phone[i]=='\b')
  151.     {
  152.       if (i>0)
  153.       {
  154.         i--;
  155.         if ((i==3) || (i==7))
  156.         {
  157.           outstr("\b\b  \b\b");
  158.           i--;
  159.         } else
  160.           backspace();
  161.       }
  162.     } else {
  163.       i++;
  164.     }
  165.     if (i==3||i==7)
  166.     {
  167.       thisuser.phone[i]='-';
  168.       outchr('-');
  169.       i++;
  170.     }
  171.   } while((!hangup) && (c!='\r'&&c!='\n'&&i<13));
  172.   nl();
  173.   if (i<12)
  174.     thisuser.phone[0]=0;
  175.   thisuser.phone[12]=0;
  176. }
  177.  
  178. void input_dataphone(void)
  179. {
  180.   int i=0;
  181.   char c;
  182.  
  183.   nl();
  184.   ansic(3);
  185.   pl(get_string(540));
  186.   ansic(3);
  187.   pl(get_string(493));
  188.   prt(2,":");
  189.   mpl(12);
  190.   do
  191.   {
  192.     if (i<12)
  193.       c=oneknlf("0123456789\b");
  194.     else
  195.       c=oneknlf("\b\r\n");
  196.     thisuser.dataphone[i]=c;
  197.     if (thisuser.dataphone[i]=='\b')
  198.     {
  199.       if (i>0)
  200.       {
  201.         i--;
  202.         if ((i==3) || (i==7))
  203.         {
  204.           outstr("\b\b  \b\b");
  205.           i--;
  206.         } else
  207.           backspace();
  208.       }
  209.     } else {
  210.       i++;
  211.     }
  212.     if (i==3||i==7)
  213.     {
  214.       thisuser.dataphone[i]='-';
  215.       outchr('-');
  216.       i++;
  217.     }
  218.   } while((!hangup) && (c!='\r'&&c!='\n'&&i<13));
  219.   nl();
  220.   if (i<12)
  221.     thisuser.dataphone[0]=0;
  222.   thisuser.dataphone[12]=0;
  223. }
  224.  
  225. void input_age(userrec *u)
  226. {
  227.   int ok,y,m,d,i;
  228.   char ag[10], m1[3], d1[3], y1[3];
  229.  
  230.   do
  231.   {
  232.     nl();
  233.     pl("3Enter your birthday in the format MM/DD/YY:");
  234.     prt(2,":");
  235.     mpl(8);
  236.     for (i=0; i<8; i++) {
  237.       if ((i==2) || (i==5)) {
  238.         ag[i]='/';
  239.         prt(4, "/");
  240.       } else {
  241.         ansic(4);
  242.         switch (i)
  243.         {
  244.            case 0: ag[i]=oneknlf("01"); break;
  245.            case 3: ag[i]=oneknlf("0123\b"); break;
  246.            case 1:
  247.              if (ag[0]=='1')
  248.              {
  249.                ag[i]=oneknlf("012\b");
  250.                break;
  251.              }
  252.            case 4:
  253.              if (ag[3]=='3')
  254.              {
  255.                ag[i]=oneknlf("01\b");
  256.                break;
  257.              }
  258.            case 6: case 7: ag[i]=oneknlf("0123456789\b"); break;
  259.         }
  260.         if (ag[i]=='\b') {
  261.           ag[i]=0;
  262.           if (i>0) {
  263.             if ((i==3) || (i==6)) {
  264.               backspace();
  265.               i--;
  266.             }
  267.             backspace();
  268.             i-=2;
  269.           } else {
  270.             i=0;
  271.           }
  272.         }
  273.       }
  274.     }
  275.     sprintf(m1, "%c%c", ag[0], ag[1]);
  276.     sprintf(d1, "%c%c", ag[3], ag[4]);
  277.     sprintf(y1, "%c%c", ag[6], ag[7]);
  278.     m=atoi(m1);
  279.     d=atoi(d1);
  280.     y=atoi(y1)+1900;
  281.     ok=1;
  282.     if ((((m==2) || (m==9) || (m==4) || (m==6) || (m==11)) && (d==31)) ||
  283.        ((m==2) && (((y%4!=0) && (d==29)) || (d==30))) ||
  284.        (years_old((unsigned char)m, (unsigned char)d,
  285.        (unsigned char)(y-1900))<5) || ((m==0) || (y==0) || (d==0))) {
  286.       ok=0;
  287.       nl();
  288.       outstr("\76Invalid Format.");
  289.       nl();
  290.       i=0;
  291.     }
  292.   } while ((!ok) && (!hangup));
  293.   u->month=(unsigned char) m;
  294.   u->day=(unsigned char) d;
  295.   u->year=(unsigned char) (y-1900);
  296.   u->age=years_old(u->month,u->day,u->year);
  297. }
  298.  
  299. ───[Step 3]────────────────────────────────────────────────────────────────────
  300.  
  301. Load XFEROVL2.C and replace the following function:
  302.  
  303. void setldate(void)
  304. {
  305.   struct date d;
  306.   struct time t;
  307.   char s[81];
  308.   int m,dd,y,i;
  309.  
  310.   unixtodos(nscandate,&d,&t);
  311.   nl();
  312.   ansic(7);
  313.   npr(get_string(791));
  314.   nln(2);
  315.   npr("9(1Press 9[1Enter9] for 9(1%02d/%02d/%02d9)): ",d.da_mon,d.da_day,(d.da_year-1900));
  316.   mpl2(8);
  317.   s[0]=0;
  318.   for (i=0; i<8; i++) {
  319.     if ((i==2) || (i==5)) {
  320.       s[i]='/';
  321.       prt(4, "/");
  322.     } else {
  323.       ansic(4);
  324.       switch (i)
  325.       {
  326.          case 0: s[i]=oneknlf("01\r"); break;
  327.          case 3: s[i]=oneknlf("012\b\r"); break;
  328.          case 1: case 4: case 6: case 7: s[i]=oneknlf("0123456789\b\r"); break;
  329.       }
  330.       if (s[i]=='\r')
  331.         return;
  332.       if (s[i]=='\b') {
  333.         s[i]=0;
  334.         if (i>0) {
  335.           if ((i==3) || (i==6)) {
  336.             backspace();
  337.             i--;
  338.           }
  339.           backspace();
  340.           i-=2;
  341.         } else {
  342.           i=0;
  343.         }
  344.       }
  345.     }
  346.   }
  347.   nl();
  348.   s[8]='\0';
  349.   m=atoi(s);
  350.   dd=atoi(&(s[3]));
  351.   y=atoi(&(s[6]))+1900;
  352.   if ((strlen(s)==8) && (m>0) && (m<=12) && (dd>0) && (dd<32) && (y>=1980)) {
  353.     t.ti_min=0;
  354.     t.ti_hour=0;
  355.     t.ti_hund=0;
  356.     t.ti_sec=0;
  357.     d.da_year=y;
  358.     d.da_day=dd;
  359.     d.da_mon=m;
  360.     nl();
  361.     outstr(get_string(790));
  362.     npr("%02d/%02d/%02d\r\n",m,dd,(y-1900));
  363.     nl();
  364.     nscandate=dostounix(&d,&t);
  365.   }
  366. }
  367.  
  368.  
  369. ───[Step 4]────────────────────────────────────────────────────────────────────
  370.  
  371. Load MISCCMD.C and do the following change to function bbslist:
  372.  
  373. =        pl(get_string(493));
  374. =        outstr(":");
  375. =        mpl(12);
  376. *        get_phone(phone);
  377. =        if ((phone[3]!='-') || (phone[7]!='-'))
  378. =          phone[0]=0;
  379. =        for (i=0; i<12; i++) {
  380. =          if (strchr("0123456789-",phone[i])==0)
  381.  
  382.  
  383. ───[Step 5]────────────────────────────────────────────────────────────────────
  384.  
  385. Load UEDIT.C and do the following changes in function uedit:
  386.  
  387. =        case 'P':
  388. =          nl();
  389. =          prt(2,get_string(272));
  390. *          get_phone(s);
  391. =          if (s[0]) {
  392. =            strcpy(u.phone,s);
  393. =            write_user(un,&u);
  394. =          }
  395. =          prt(2,"New data phone number? ");
  396. *          get_phone(s);
  397. =          if (s[0]) {
  398. =            strcpy(u.dataphone,s);
  399. =            write_user(un,&u);
  400. =          }
  401. =          break;
  402. =        case 'Q':
  403. =          done=1;
  404.  
  405. And lower...
  406.  
  407. =            strcpy(u.zipcode,s1);
  408. =            write_user(un,&u);
  409. =          }
  410. =          prt(2,get_string(287));
  411. *          get_phone(s1);
  412. =          if (s1[0]){
  413. =            strcpy(u.dataphone,s1);
  414.  
  415.  
  416. ───[Step 6]────────────────────────────────────────────────────────────────────
  417.  
  418. Do "MAKE FCNS" and compile the entire BBS, the slashes and dashes system is
  419. now installed on your system and should be fully working.
  420.  
  421. French Proverb: Il faut que jeunesse se passe.
  422.  
  423. For comments, bug report and suggestion, e-mail at the following address:
  424.  
  425. Nicolas LeBlanc  2@20302.WWIVnet (aka Spotnick)
  426.                  -> spotnick@gamemaster.qc.ca
  427. Martin Bourdages 242@20306 / 3@20302.WWIVnet (aka Dark Shadow)
  428.                  -> martin.bourdages@radio.magicnet.com
  429.  
  430.                  =>   French Mod Division Support Sub   <=
  431.                                 SubType: FMD
  432.                            Host: @20302 (WWIVnet)
  433.                       Scan sublist for other networks
  434.  
  435.         Read PRODUCTS.FMD for the full list of our support systems.
  436.  
  437. ───[EOF]──────────────────────────────────────────────────────────────────────
  438.