home *** CD-ROM | disk | FTP | other *** search
/ The Arcade BBS / arcadebbs.zip / arcadebbs / bbstools / MODS / SPV067I.ZIP / ADDRESS.C next >
Encoding:
Text File  |  1995-07-17  |  20.0 KB  |  712 lines

  1. #include "vars.h"
  2. #pragma hdrstop
  3.  
  4. #include <ctype.h>
  5.  
  6. typedef struct {
  7.     int  usernumber;
  8.     char addressee[31],
  9.          netaddress[51],
  10.          boardname[75];
  11. } addressrec;
  12.  
  13. static int OpenAddressBook(void);
  14. static void ViewAddresses(void);
  15. static void SearchAddresses(void);
  16. static void AddAddresses(void);
  17. static void CreateBook(void);
  18. static int AddressFile;
  19. static unsigned int NumberEntries;
  20. static void cline(char *String, int Color, int Center);
  21. static void backline(unsigned char NumLines);
  22. static void TransferAddresses(void);
  23.  
  24. void AddressBook(void)
  25. {
  26.   addressrec Address;
  27.   char stemp[81],stemp1[81],ch,Done=0;
  28.   unsigned char topsave;
  29.  
  30. // " NOTE #1 "
  31.   if ((thisuser.sl<=syscfg.newusersl) ||
  32.      (thisuser.restrict & restrict_net) ||    // Any one of these restriction
  33.      (thisuser.restrict & restrict_anony) ||  // can be commented out just by
  34.      (thisuser.restrict & restrict_upload) || // placing a double slash in
  35.      (thisuser.restrict & restrict_logon) ||  // front of the one(s) you
  36.      (restrict_chat & thisuser.restrict) ||   // don't want to use.
  37.      (restrict_email & thisuser.restrict) ||
  38. //     (restrict_vote & thisuser.restrict) ||
  39.      (thisuser.restrict & restrict_automessage) ||
  40.      (restrict_post & thisuser.restrict)) {
  41.      outchr(12);
  42.      pl("6You don't have access to the Address Book. Ask your Sysop why!0");
  43.      nl();
  44.      return;
  45.   }
  46.   irt_name[0]=irt[0]=0;
  47.   if (wfc)
  48.     usernum=1;
  49.   sprintf(stemp,"%sADDRESS\\%d.ADR",syscfg.gfilesdir,usernum);
  50.   if (exist(stemp)) {
  51.     npr("5Old address book found, download now? 0");
  52.     if (ny()) {
  53.       sprintf(stemp1,"%sADDRESS",syscfgovr.tempdir);
  54.       add_arc(stemp1,stemp,1);
  55.       download_temp_arc(stemp1,0);
  56.       unlink(stemp);
  57.     }
  58.   }
  59.   do {
  60.     sprintf(stemp,"%sADDRESS.DAT",syscfg.datadir);
  61.     if (!exist(stemp))
  62.       CreateBook();
  63.     topsave=topdata;
  64.     topdata=0;
  65.     topscreen();
  66.     outchr(12);
  67.     sprintf(stemp,"-= %s's Personal Address Book =-",thisuser.name);
  68.     properize(stemp);
  69.     cline(stemp,1,1);
  70.     printmenu(22);
  71.     npr("5    Your Selection?2: 0");
  72.     ch=onek("QE?VSDAT");
  73.     checkhangup();
  74.     switch(ch) {
  75.       case 'Q':
  76.         outchr(12);
  77.         Done=1;
  78.         break;
  79.       case 'T':
  80.         TransferAddresses();
  81.         break;
  82.       case '?':
  83.         outchr(12);
  84.         sprintf(stemp,"-= Welcome to %s's Personal Address Book Help =-",
  85.                       syscfg.systemname);
  86.         cline(stemp,1,1);
  87.         printfile("ADDRESS.MSG");
  88.         pausescr();
  89.         break;
  90.       case 'S':
  91.         SearchAddresses();
  92.         break;
  93.       case 'V':
  94.         ViewAddresses();
  95.         break;
  96.       case 'D':
  97.         DeleteAddresses(0);
  98.         break;
  99.       case 'A':
  100.         AddAddresses();
  101.         break;
  102.       case 'E':
  103.         nl();
  104.         npr("5Search through address book for addressee first? 0");
  105.         if (ny())
  106.           SendEmail();
  107.         else
  108.           send_email();
  109.         pausescr();
  110.         break;
  111.     }
  112.   } while ((!hangup) && (!Done));
  113.     topdata=topsave;
  114.     topscreen();
  115. }
  116.  
  117. int OpenAddressBook(void)
  118. {
  119.   char stemp[81],stemp1[81];
  120.  
  121.   sprintf(stemp,"%sADDRESS.DAT",syscfg.datadir);
  122.   if ((AddressFile=
  123.        sh_open(stemp,O_BINARY|O_RDWR|O_CREAT,S_IWRITE|S_IREAD))<0) {
  124.     nl();
  125.     strcpy(stemp1,"6\007\007Error opening address file!0");
  126.     pl(stemp1);
  127.     if (so()) {
  128.       npr(" 6Try deleting 2%s 6and starting fresh!0",stemp);
  129.       nl();
  130.     } else {
  131.       ssm(1,0,stemp1);
  132.       pl(" 2Notifying SysOp! Do not use the address book!0");
  133.     }
  134.     nl();
  135.     pausescr();
  136.     return(0);
  137.   }
  138.   NumberEntries=(unsigned int)
  139.                 ((filelength(AddressFile)/sizeof(addressrec))-1);
  140.   return(1);
  141. }
  142.  
  143. void ViewAddresses(void)
  144. {
  145.   char stemp[81],stemp1[81];
  146.   unsigned int i;
  147.   unsigned char abt,all=0;
  148.   addressrec Address;
  149.   userrec User;
  150.  
  151.   if (!OpenAddressBook())
  152.     return;
  153.   if (so()) {
  154.     nl();
  155.     npr("4SysOp Option:5 View all entires? 0");
  156.     if (yn())
  157.       all=1;
  158.   }
  159.   AddressHeader("VIEWING");
  160.   for (i=1;(i<=NumberEntries) && (!abt) && (!hangup);i++) {
  161.     sh_lseek(AddressFile,((long)i)*((long)sizeof(addressrec)),SEEK_SET);
  162.     sh_read(AddressFile,(void *)&Address,sizeof(addressrec));
  163.     if ((usernum==Address.usernumber) ||
  164.         ((all) && (Address.usernumber!=-1))) {
  165.       npr("5%-30.30s %s0",Address.addressee,Address.netaddress);  nl();
  166.       npr("9Note1: 5%s0",Address.boardname);
  167.       if (all) {
  168.         nl();
  169.         read_user(Address.usernumber,&User);
  170.         npr(" 4Entered by:3 %s0",nam(&User,Address.usernumber));
  171.         nl();
  172.       }
  173.     }
  174.     if (Address.usernumber>0)
  175.       nln(2);
  176.     abt=toupper(inkey());
  177.     if (abt=='P') {
  178.       getkey();
  179.       abt=0;
  180.     }
  181.   }
  182.   sh_close(AddressFile);
  183.   nl();
  184.   pl("2Listing complete!0");
  185.   nl();
  186.   pausescr();
  187. }
  188.  
  189.  
  190. void SearchAddresses(void)
  191. {
  192.   char stemp[81],SearchSpec[76],handle[31],address[51],bbs[75];
  193.   unsigned int i,i1;
  194.   unsigned char abt=0,ch,all=0,ch1,chng,Done;
  195.   addressrec Address;
  196.   unsigned short sy,un;
  197.   userrec User;
  198.  
  199.   nl();
  200.   pl("5Enter a {partial} search string.  Searchs ALL address fields2:0");
  201.   npr("6:0");
  202.   mpl(62);
  203.   input(SearchSpec,62);
  204.   if (!SearchSpec[0])
  205.     return;
  206.   if (so()) {
  207.     nl();
  208.     npr("4SysOp Option:5 Search ALL records? 0");
  209.     if (yn())
  210.       all=1;
  211.   }
  212.   if (!OpenAddressBook())
  213.     return;
  214.   AddressHeader("SEARCHING");
  215.   for (i=1;(i<=NumberEntries) && (!abt) && (!hangup);i++) {
  216.     sh_lseek(AddressFile,((long)i)*((long)sizeof(addressrec)),SEEK_SET);
  217.     sh_read(AddressFile,(void *)&Address,sizeof(addressrec));
  218.     strcpy(handle,Address.addressee);
  219.     strcpy(address,Address.netaddress);
  220.     strcpy(bbs,Address.boardname);
  221.     if ((usernum==Address.usernumber) ||
  222.         ((all) && (Address.usernumber!=-1))) {
  223.       if ((strstr(strupr(address),SearchSpec)) ||
  224.          (strstr(strupr(bbs),SearchSpec)) ||
  225.          (strstr(strupr(handle),SearchSpec))) {
  226.         npr("5%-30.30s %s0",Address.addressee,Address.netaddress);  nl();
  227.         npr("9Note1: 5%s0",Address.boardname);
  228.         if (all) {
  229.           nl();
  230.           read_user(Address.usernumber,&User);
  231.           npr(" 4Entered by:3 %s0",nam(&User,Address.usernumber));
  232.           nl();
  233.         }
  234.         if (Address.usernumber>0)
  235.           nln(2);
  236.         npr("5Match Found2: 4C3ontinue, 4D3elete, 0");
  237.         npr("4E3mail, 4M3odify, 4Q3uit?0 ");
  238.         ch=onek("QC\rDEM");
  239.         backline(1);
  240.         switch (ch) {
  241.           case 'M':
  242.             chng=0;
  243.             do {
  244.               Done=0;
  245.               AddressHeader("SEARCH/MODIFYING");
  246.               npr("5%-30.30s %s0",Address.addressee,Address.netaddress);
  247.               nl();
  248.               npr("9Note1: 5%s0",Address.boardname);
  249.               nln(2);
  250.               npr("5Edit2: 4H3andle, 4A3ddress, 0");
  251.               npr("4B3BS name/note, 4Q3uit?0 ");
  252.               ch1=onek("Q\rHAB");
  253.               backline(1);
  254.               switch (ch1) {
  255.                 case 13:
  256.                 case 'Q':
  257.                   if (chng) {
  258.                     AddressHeader("SEARCH/MODIFY/CONFIRMING");
  259.                     npr("5%-30.30s %s0",Address.addressee,
  260.                          Address.netaddress);
  261.                     nl();
  262.                     npr("9Note1: 5%s0",Address.boardname);
  263.                     nln(2);
  264.                     npr("5Is this correct? 0");
  265.                     if (yn()) {
  266.                       sh_lseek(AddressFile,
  267.                            ((long)i)*((long)sizeof(addressrec)),SEEK_SET);
  268.                       sh_write(AddressFile,
  269.                            (void *)&Address,sizeof(addressrec));
  270.                       AddressHeader("SEARCH/MODIFY/CONFIRMING");
  271.                     }
  272.                   }
  273.                   Done=1;
  274.                   AddressHeader("SEARCHING");
  275.                   break;
  276.                 case 'H':
  277.                   npr("5New handle2: 0");
  278.                   mpl(30);
  279.                   inputl(stemp,30);
  280.                   if (stemp[0]) {
  281.                     strcpy(Address.addressee,stemp);
  282.                     chng=1;
  283.                   }
  284.                   backline(1);
  285.                   break;
  286.                 case 'A':
  287.                   do {
  288.                     i1=0;
  289.                     npr("5New address (6recommended format2: 0");
  290.                     pl("1usernumber@systemnumber.networkname5)0");
  291.                     npr("3(5IE: 21@11579.wwivnet3) 6: 0");
  292.                     mpl(50);
  293.                     inputl(stemp,50);
  294.                     if (stemp[0]) {
  295.                       strcpy(Address.netaddress,stemp);
  296.                       i1=chng=1;
  297.                     } else {
  298.                       stemp[0]=0;
  299.                       backline(2);
  300.                       npr("6Enter a network or local address! 0");
  301.                       pl("2Press any key.0");
  302.                       getkey();
  303.                       backline(1);
  304.                     }
  305.                   } while ((!hangup) && (!i1));
  306.                   backline(2);
  307.                   break;
  308.                 case 'B':
  309.                   pl("5New BBS name/note2: 0");
  310.                   npr("6:0");
  311.                   mpl(74);
  312.                   inputl(stemp,74);
  313.                   if (stemp[0]) {
  314.                     strcpy(Address.boardname,stemp);
  315.                     chng=1;
  316.                   }
  317.                   backline(2);
  318.                   break;
  319.               }
  320.             } while ((!Done) && (!hangup));
  321.             break;
  322.           case 'D':
  323.             Address.usernumber=-1;
  324.             sh_lseek(AddressFile,
  325.                      ((long)i)*((long)sizeof(addressrec)),SEEK_SET);
  326.             sh_write(AddressFile,(void *)&Address,sizeof(addressrec));
  327.             if (all)
  328.               backline(4);
  329.             else
  330.               backline(2);
  331.             npr("%-79s","9Note1: 6DELETED!0");  nl();
  332.             nln(2);
  333.             break;
  334.           case 'Q':
  335.             abt=1;
  336.             break;
  337.           case 'C':
  338.           case 13:
  339.             break;
  340.           case 'E':
  341.             parse_email_info(Address.netaddress,&un,&sy);
  342.             if (!un && !sy) {
  343.               nl();
  344.               pl("6ERROR! 2Invalid address!0");
  345.               nl();
  346.               pausescr();
  347.             } else
  348.               email(un,sy,0,0);
  349.             break;
  350.         }
  351.       }
  352.     }
  353.   }
  354.   sh_close(AddressFile);
  355.   nl();
  356.   pl("6Search Complete!0");
  357.   nl();
  358.   pausescr();
  359. }
  360.  
  361. void DeleteAddresses(int UserNumber)
  362. {
  363.   addressrec Address;
  364.   unsigned int i;
  365.   int UserNum;
  366.   char stemp[81];
  367.   userrec User;
  368.  
  369.   if (!UserNumber) {
  370.     nl();
  371.     if (so()) {
  372.       nl();
  373.       pl("3Remove entries for what user number (1ENTER for YOURS3)?0");
  374.       npr("3Type in 4ALL3 to remove entire address book data file2: 0");
  375.       mpl(4);
  376.       input(stemp,4);
  377.       if (strcmp(stemp,"ALL")==0) {
  378.         sprintf(stemp,"%sADDRESS.DAT",syscfg.datadir);
  379.         unlink(stemp);
  380.         nl();
  381.         npr("6%s has been removed -- now reinitializing...0",stemp);
  382.         nln(2);
  383.         pausescr();
  384.         return;
  385.       }
  386.       nl();
  387.       if (!stemp[0]) {
  388.         npr("6Are you certain you want to remove your entries? 0");
  389.         if (yn())
  390.           UserNum=usernum;
  391.         else
  392.           return;
  393.       } else {
  394.         read_user(atoi(stemp),&User);
  395.         npr("6Are you certain you want to remove %s's entries? 0",
  396.              nam(&User,atoi(stemp)));
  397.         if (yn())
  398.           UserNum=atoi(stemp);
  399.         else
  400.           return;
  401.       }
  402.     } else {
  403.       npr("6Are you CERTAIN you want to delete your address entries? 0");
  404.       if (yn())
  405.         UserNum=usernum;
  406.       else
  407.         return;
  408.     }
  409.   } else
  410.     UserNum=UserNumber;
  411.   if (!OpenAddressBook())
  412.     return;
  413.   for (i=1;(i<=NumberEntries) && (!hangup);i++) {
  414.     sh_lseek(AddressFile,((long)i)*((long)sizeof(addressrec)),SEEK_SET);
  415.     sh_read(AddressFile,(void *)&Address,sizeof(addressrec));
  416.     if (UserNum==Address.usernumber)
  417.       Address.usernumber=-1;
  418.     sh_lseek(AddressFile,((long)i)*((long)sizeof(addressrec)),SEEK_SET);
  419.     sh_write(AddressFile,(void *)&Address,sizeof(addressrec));
  420.   }
  421.   sh_close(AddressFile);
  422.   if (!UserNumber) {
  423.     nl();
  424.     npr("6All addresses for 2%u6 have been removed!0",atoi(stemp));
  425.     nln(2);
  426.     pausescr();
  427.   }
  428. }
  429.  
  430. void AddAddresses(void)
  431. {
  432.   char address[51],board[75],name[31],stemp[81];
  433.   unsigned char Done,add=1;
  434.  
  435.   address[0]=board[0]=name[0]=0;
  436.   outchr(12);
  437.   cline("Entering new data.  Pressing ENTER on a blank field exits.",1,1);
  438.   nl();
  439.   pl("5Enter the user's name or handle.0");
  440.   npr("6:0");
  441.   mpl(24);
  442.   inputl(name,24);
  443.   if (!name[0])
  444.     return;
  445.   do {
  446.     Done=0;
  447.     nl();
  448.     pl("5Enter the user's network address (1IE: 1@11579.wwivnet5).0");
  449.     npr("6:0");
  450.     mpl(50);
  451.     inputl(address,50);
  452.     if (!address[0])
  453.       return;
  454.     else {
  455.       if ((strchr(address,'.')==NULL) || (strchr(address,'@')==NULL)) {
  456.         address[0]=0;
  457.         nl();
  458.         pl("6ERROR! 2Invalid network address, try again!0");
  459.         nl();
  460.         pausescr();
  461.       } else
  462.         Done=1;
  463.     }
  464.   } while ((!hangup) && (!Done));
  465.   nl();
  466.   pl("5Enter user's BBS name (or some other note).0");
  467.   npr("6:0");
  468.   mpl(74);
  469.   inputl(board,74);
  470.   if (CheckForDupe(name,address)) {
  471.     nl();
  472.     npr("2Possible address/handle matches, 0");
  473.     npr("2go ahead and add to book? 0");
  474.     if (yn())
  475.       add=1;
  476.     else
  477.       add=0;
  478.   }
  479.   if (add) {
  480.     AddressHeader("ADD ADDRESS/CONFIRMING");
  481.     npr("5%-30.30s %s0",name,address);  nl();
  482.     npr("9Note1: 5%s0",board);
  483.     nln(2);
  484.     npr("5Is this correct? 0");
  485.     if (yn())
  486.       WriteAddress(name,address,board);
  487.   }
  488. }
  489.  
  490. void WriteAddress(char *Name,char *NetAddress, char *Board)
  491. {
  492.   addressrec Address;
  493.   unsigned int i,Pos=0;
  494.   char stemp[31];
  495.  
  496.   if (!OpenAddressBook())
  497.     return;
  498.   for (i=1;(i<=NumberEntries) && (!hangup) && (!Pos);i++) {
  499.     sh_lseek(AddressFile,((long)i)*((long)sizeof(addressrec)),SEEK_SET);
  500.     sh_read(AddressFile,(void *)&Address,sizeof(addressrec));
  501.     if ((Address.usernumber==-1) || (Address.usernumber>status.users))
  502.       Pos=i;
  503.   }
  504.   memset(&Address,0,sizeof(addressrec));
  505.   Address.usernumber=usernum;
  506.   strcpy(Address.addressee,Name);
  507.   strcpy(Address.netaddress,NetAddress);
  508.   strcpy(Address.boardname,Board);
  509.   if (Pos)
  510.     sh_lseek(AddressFile,((long)Pos)*((long)sizeof(addressrec)),SEEK_SET);
  511.   else
  512.     sh_lseek(AddressFile,0L,SEEK_END);
  513.   sh_write(AddressFile,(void *)&Address,sizeof(addressrec));
  514.   sh_close(AddressFile);
  515.   nl();
  516.   pl("5Address added to file!0");
  517.   nl();
  518.   pausescr();
  519. }
  520.  
  521. void CreateBook(void)
  522. {
  523.   addressrec Address;
  524.  
  525.   memset(&Address,0,sizeof(addressrec));
  526.   if (!OpenAddressBook())
  527.     return;
  528.   Address.usernumber=1;
  529.   strcpy(Address.addressee,"-=*>Pâpâ ßêâr<*=-");
  530.   strcpy(Address.netaddress,"1@11579.wwivnet");
  531.   strcpy(Address.boardname,"StarPort Valhalla");
  532.   sh_lseek(AddressFile,0L,SEEK_SET);
  533.   sh_write(AddressFile,(void *)&Address,sizeof(addressrec));
  534.   sh_close(AddressFile);
  535. }
  536.  
  537. void cline(char *String, int Color, int Center)
  538. {
  539. // Color  0 = black         1 = blue          2 = green       3 = cyan
  540. //        4 = red           5 = magenta       6 = brown       7 = grey
  541. //        8 = lt. blue      9 = lt. green    10 = lt. cyan   11 = lt.red
  542. //       12 = lt. magenta  13 = yellow       14 = white
  543.  
  544.   char color[15][62]=
  545.        {"[0;30;47m","[0;34;47m","[0;32;47m","[0;36;47m","[0;31;47m",
  546.         "[0;35;47m","[0;33;47m","[1;30;47m","[1;34;47m","[1;32;47m",
  547.         "[1;36;47m","[1;31;47m","[1;35;47m","[1;33;47m","[1;37;47m"};
  548.   char stemp[81],stemp1[81];
  549.   int len,i=0;
  550.  
  551.   if (Center) {
  552.     strcpy(stemp,"");
  553.     i=40-((strlen(stripcolors(String)))/2);
  554.     for (len=0;len<i;len++)
  555.       strcat(stemp," ");
  556.     sprintf(stemp1,"%s%s",stemp,String);
  557.   } else
  558.     strcpy(stemp1,String);
  559.   for (len=0;len<((79-strlen(String))-i);len++)
  560.     strcat(stemp1," ");
  561.   if (okansi()) {
  562.     npr("%s\r\n",charstr(79,'▄'));
  563.     npr("%s%s\r\n",color[Color],stemp1);
  564.     npr("%s\r\n",charstr(79,'▀'));
  565.   } else {
  566.     pl(stemp1);
  567.     pl(charstr(80,205));
  568.   }
  569. }
  570.  
  571. void AddressHeader(char *Area)
  572. {
  573.   char stemp[81];
  574.  
  575.   outchr(12);
  576.   sprintf(stemp,
  577.           "Users Handle or Name           Network Address    [%s]",Area);
  578.   cline(stemp,1,0);
  579. }
  580.  
  581. void backline(unsigned char NumLines)
  582. {
  583.   int i,j;
  584.  
  585.   for (j=0;j<NumLines;j++) {
  586.     for (i=0;i<80;i++)
  587.        backspace();
  588.   }
  589. }
  590.  
  591. unsigned char CheckForDupe(char *Handle, char *NetAddress)
  592. {
  593.   addressrec Address;
  594.   unsigned int i;
  595.   unsigned char abt=0;
  596.  
  597.   if (!OpenAddressBook())
  598.     return(0);
  599.   AddressHeader("CHECKING FOR DUPES");
  600.   pl("6Searching for possible duplicate address book entries:0");
  601.   for (i=1;(i<=NumberEntries) && (!hangup);i++) {
  602.     sh_lseek(AddressFile,((long)i)*((long)sizeof(addressrec)),SEEK_SET);
  603.     sh_read(AddressFile,(void *)&Address,sizeof(addressrec));
  604.     if (Address.usernumber==usernum) {
  605.       if ((stricmp(Address.addressee,Handle)==0) ||
  606.           (stricmp(Address.netaddress,NetAddress)==0)) {
  607.         abt=1;
  608.         npr("5%-30.30s %s0",Address.addressee,Address.netaddress);  nl();
  609.         npr("9Note1: 5%s0",Address.boardname);
  610.         nln(2);
  611.       }
  612.     }
  613.   }
  614.   sh_close(AddressFile);
  615.   nl();
  616.   if (abt)
  617.     return(1);
  618.   else
  619.     return(0);
  620. }
  621.  
  622. void TransferAddresses(void)
  623. {
  624.   addressrec Address;
  625.   unsigned int i;
  626.   FILE *OutFile;
  627.   char stemp[81],stemp1[81];
  628.  
  629.   if (!OpenAddressBook())
  630.     return;
  631.   sprintf(stemp,"%s%u.ADD",syscfgovr.tempdir,usernum);
  632.   if ((OutFile=fopen(stemp,"wt"))==NULL) {
  633.     sh_close(AddressFile);
  634.     return;
  635.   }
  636.   fprintf(OutFile,"%s's Address Book from %s\n\n",thisuser.name,
  637.           syscfg.systemname);
  638.   for (i=1;(i<=NumberEntries) && (!hangup);i++) {
  639.     sh_lseek(AddressFile,((long)i)*((long)sizeof(addressrec)),SEEK_SET);
  640.     sh_read(AddressFile,(void *)&Address,sizeof(addressrec));
  641.     if (Address.usernumber==usernum) {
  642.       fprintf(OutFile,"Name: %s\n",Address.addressee);
  643.       fprintf(OutFile,"Addr: %s\n",Address.netaddress);
  644.       fprintf(OutFile,"Note: %s\n\n",Address.boardname);
  645.     }
  646.   }
  647.   fclose(OutFile);
  648.   sh_close(AddressFile);
  649.   sprintf(stemp1,"%sADDRESS",syscfgovr.tempdir);
  650.   add_arc(stemp1,stemp,1);
  651.   download_temp_arc(stemp1,0);
  652. }
  653.  
  654. void SendEmail(void)
  655. {
  656.   addressrec Address;
  657.   unsigned char i,abt=0;
  658.   char Name[31],stemp[81],stemp1[81],stemp2[81];
  659.   unsigned short sy,un;
  660.  
  661.   irt_name[0]=irt[0]=0;
  662.   if (!OpenAddressBook())
  663.     return;
  664.   nl();
  665.   npr("5{Partial} name, BBS name, or address to mail? 0");
  666.   mpl(30);
  667.   input(Name,30);
  668.   if (!Name[0])
  669.     return;
  670.   AddressHeader("E-MAILING");
  671.   pl("6Searching for matching address(es).0");
  672.   for (i=1;(i<=NumberEntries) && (!abt) && (!hangup);i++) {
  673.     sh_lseek(AddressFile,((long)i)*((long)sizeof(addressrec)),SEEK_SET);
  674.     sh_read(AddressFile,(void *)&Address,sizeof(addressrec));
  675.     strcpy(stemp,Address.addressee);
  676.     strcpy(stemp1,Address.boardname);
  677.     strcpy(stemp2,Address.netaddress);
  678.     if (Address.usernumber==usernum) {
  679.       if ((strstr(strupr(stemp),Name)) ||
  680.           (strstr(strupr(stemp1),Name)) ||
  681.           (strstr(strupr(stemp2),Name))) {
  682.         npr("5%-30.30s %s0",Address.addressee,Address.netaddress);  nl();
  683.         npr("9Note1: 5%s0",Address.boardname);
  684.         nln(2);
  685.         npr("5Do you want to E-Mail this account?0 ");
  686.         if (ny()) {
  687.           backline(1);
  688.           abt=1;
  689.         } else
  690.           backline(1);
  691.       }
  692.     }
  693.   }
  694.   sh_close(AddressFile);
  695.   if (abt) {
  696.     parse_email_info(Address.netaddress,&un,&sy);
  697.     if (!un && !sy) {
  698.       nl();
  699.       pl("6ERROR! 2Invalid address!0");
  700.       nl();
  701.       pausescr();
  702.     } else
  703.       email(un,sy,0,0);
  704.   } else {
  705.     nl();
  706.     pl("5No match found -- using stock E-Mail.0");
  707.     send_email();
  708.   }
  709. }
  710. ---
  711. 1No, I don't have any taglines to give you.  Go Away.
  712.