home *** CD-ROM | disk | FTP | other *** search
/ PC Online 1998 September / PCO_0998.ISO / filesbbs / dos / sbbs_src.exe / SBBS / SCFG / SCFGNET.C < prev    next >
Encoding:
C/C++ Source or Header  |  1997-04-13  |  40.4 KB  |  1,458 lines

  1. #line 2 "SCFGNET.C"
  2.  
  3. /* Developed 1990-1997 by Rob Swindell; PO Box 501, Yorba Linda, CA 92885 */
  4.  
  5. #include "scfg.h"
  6.  
  7. char *wday[]={"Sun","Mon","Tue","Wed","Thu","Fri","Sat"};
  8.  
  9. char *daystr(char days);
  10.  
  11.  
  12. void qhub_edit(int num);
  13. void phub_edit(int num);
  14. char *daystr(char days);
  15. void qhub_sub_edit(uint num);
  16.  
  17. /****************************************************************************/
  18. /* Returns the FidoNet address kept in str as ASCII.                        */
  19. /****************************************************************************/
  20. faddr_t atofaddr(char *str)
  21. {
  22.     char *p;
  23.     faddr_t addr;
  24.  
  25. addr.zone=addr.net=addr.node=addr.point=0;
  26. if((p=strchr(str,':'))!=NULL) {
  27.     addr.zone=atoi(str);
  28.     addr.net=atoi(p+1); }
  29. else {
  30.     if(total_faddrs)
  31.         addr.zone=faddr[0].zone;
  32.     else
  33.         addr.zone=1;
  34.     addr.net=atoi(str); }
  35. if(!addr.zone)              /* no such thing as zone 0 */
  36.     addr.zone=1;
  37. if((p=strchr(str,'/'))!=NULL)
  38.     addr.node=atoi(p+1);
  39. else {
  40.     if(total_faddrs)
  41.         addr.net=faddr[0].net;
  42.     else
  43.         addr.net=1;
  44.     addr.node=atoi(str); }
  45. if((p=strchr(str,'.'))!=NULL)
  46.     addr.point=atoi(p+1);
  47. return(addr);
  48. }
  49.  
  50. /****************************************************************************/
  51. /* Returns an ASCII string for FidoNet address 'addr'                       */
  52. /****************************************************************************/
  53. char *faddrtoa(faddr_t addr)
  54. {
  55.     static char str[25];
  56.     char point[25];
  57.  
  58. sprintf(str,"%u:%u/%u",addr.zone,addr.net,addr.node);
  59. if(addr.point) {
  60.     sprintf(point,".%u",addr.point);
  61.     strcat(str,point); }
  62. return(str);
  63. }
  64.  
  65.  
  66. uint getsub()
  67. {
  68.     static int grp_dflt,sub_dflt,grp_bar,sub_bar;
  69.     char str[81];
  70.     int i,j,k;
  71.     uint subnum[MAX_OPTS+1];
  72.  
  73. while(1) {
  74.     for(i=0;i<total_grps && i<MAX_OPTS;i++)
  75.         sprintf(opt[i],"%-25s",grp[i]->lname);
  76.     opt[i][0]=0;
  77.     i=ulist(WIN_SAV|WIN_RHT|WIN_BOT,0,0,45,&grp_dflt,&grp_bar
  78.         ,"Message Groups"
  79.         ,opt);
  80.     if(i==-1)
  81.         return(-1);
  82.     for(j=k=0;j<total_subs && k<MAX_OPTS;j++)
  83.         if(sub[j]->grp==i) {
  84.             sprintf(opt[k],"%-25s",sub[j]->lname);
  85.             subnum[k++]=j; }
  86.     opt[k][0]=0;
  87.     sprintf(str,"%s Sub-boards",grp[i]->sname);
  88.     j=ulist(WIN_RHT|WIN_BOT|WIN_SAV,0,0,45,&sub_dflt,&sub_bar,str,opt);
  89.     if(j==-1)
  90.         continue;
  91.     return(subnum[j]); }
  92.  
  93. }
  94.  
  95. void net_cfg()
  96. {
  97.     static    int net_dflt,qnet_dflt,pnet_dflt,fnet_dflt,inet_dflt
  98.             ,qhub_dflt,phub_dflt;
  99.     char    str[81],done,*p;
  100.     int     i,j,k,l,m,n;
  101.  
  102. while(1) {
  103.     i=0;
  104.     strcpy(opt[i++],"QWK Packet Networks");
  105.     strcpy(opt[i++],"FidoNet EchoMail and NetMail");
  106.     strcpy(opt[i++],"PostLink Networks");
  107.     strcpy(opt[i++],"Internet NetMail");
  108.     opt[i][0]=0;
  109.     SETHELP(WHERE);
  110. /*
  111. Configure Networks:
  112.  
  113. This is the network configuration menu. Select the type of network
  114. technology that you want to configure.
  115. */
  116.     i=ulist(WIN_ORG|WIN_ACT|WIN_CHE,0,0,0,&net_dflt,0,"Networks",opt);
  117.     if(i==0) {    /* QWK net stuff */
  118.         done=0;
  119.         while(!done) {
  120.             i=0;
  121.             strcpy(opt[i++],"Network Hubs...");
  122.             strcpy(opt[i++],"Default Tagline");
  123.             opt[i][0]=0;
  124.             SETHELP(WHERE);
  125. /*
  126. QWK Packet Networks:
  127.  
  128. From this menu you can configure the default tagline to use for
  129. outgoing messages on QWK networked sub-boards, or you can select
  130. Network Hubs... to add, delete, or configure QWK hubs that your system
  131. calls to exchange packets with.
  132. */
  133.             i=ulist(WIN_ACT|WIN_RHT|WIN_BOT|WIN_CHE,0,0,0,&qnet_dflt,0
  134.                 ,"QWK Packet Networks",opt);
  135.             savnum=0;
  136.             switch(i) {
  137.                 case -1:    /* ESC */
  138.                     done=1;
  139.                     break;
  140.                 case 1:
  141.                     SETHELP(WHERE);
  142. /*
  143. QWK Network Default Tagline:
  144.  
  145. This is the default tagline to use for outgoing messages on QWK
  146. networked sub-boards. This default can be overridden on a per sub-board
  147. basis with the sub-board configuration Network Options....
  148. */
  149.                     uinput(WIN_MID|WIN_SAV,0,0,nulstr
  150.                         ,qnet_tagline,63,K_MSG|K_EDIT);
  151.                     break;
  152.                 case 0:
  153.                     while(1) {
  154.                         for(i=0;i<total_qhubs && i<MAX_OPTS;i++)
  155.                             sprintf(opt[i],"%-8.8s",qhub[i]->id);
  156.                         opt[i][0]=0;
  157.                         i=WIN_ACT|WIN_RHT|WIN_SAV;
  158.                         if(total_qhubs<MAX_OPTS)
  159.                             i|=WIN_INS|WIN_INSACT|WIN_XTR;
  160.                         if(total_qhubs)
  161.                             i|=WIN_DEL;
  162.                         savnum=0;
  163.                         SETHELP(WHERE);
  164. /*
  165. QWK Network Hubs:
  166.  
  167. This is a list of QWK network hubs that your system calls to exchange
  168. packets with.
  169.  
  170. To add a hub, select the desired location with the arrow keys and hit
  171.  INS .
  172.  
  173. To delete a hub, select it and hit  DEL .
  174.  
  175. To configure a hub, select it and hit  ENTER .
  176. */
  177.                         i=ulist(i,0,0,0,&qhub_dflt,0
  178.                             ,"QWK Network Hubs",opt);
  179.                         if(i==-1)
  180.                             break;
  181.                         if((i&MSK_ON)==MSK_INS) {
  182.                             i&=MSK_OFF;
  183.                             if((qhub=(qhub_t **)REALLOC(qhub
  184.                                 ,sizeof(qhub_t *)*(total_qhubs+1)))==NULL) {
  185.                                 errormsg(WHERE,ERR_ALLOC,nulstr
  186.                                     ,sizeof(qhub_t *)*(total_qhubs+1));
  187.                                 total_qhubs=0;
  188.                                 bail(1);
  189.                                 continue; }
  190.  
  191.                             savnum=1;
  192.                             SETHELP(WHERE);
  193. /*
  194. QWK Network Hub System ID:
  195.  
  196. This is the QWK System ID of this hub. It is used for incoming and
  197. outgoing network packets and must be accurate.
  198. */
  199.                             if(uinput(WIN_MID|WIN_SAV,0,0
  200.                                 ,"System ID",str,8,K_UPPER)<1)
  201.                                 continue;
  202.  
  203.                             for(j=total_qhubs;j>i;j--)
  204.                                 qhub[j]=qhub[j-1];
  205.                             if((qhub[i]=(qhub_t *)MALLOC(sizeof(qhub_t)))
  206.                                 ==NULL) {
  207.                                 errormsg(WHERE,ERR_ALLOC,nulstr
  208.                                     ,sizeof(qhub_t));
  209.                                 continue; }
  210.                             memset(qhub[i],0,sizeof(qhub_t));
  211.                             strcpy(qhub[i]->id,str);
  212.                             strcpy(qhub[i]->pack,"%!pkzip %f %s");
  213.                             strcpy(qhub[i]->unpack,"%!pkunzip -o %f %g %s");
  214.                             strcpy(qhub[i]->call,"%!qnet");
  215.                             qhub[i]->node=1;
  216.                             qhub[i]->days=0xff; /* all days */
  217.                             total_qhubs++;
  218.                             changes=1;
  219.                             continue; }
  220.                         if((i&MSK_ON)==MSK_DEL) {
  221.                             i&=MSK_OFF;
  222.                             FREE(qhub[i]->mode);
  223.                             FREE(qhub[i]->conf);
  224.                             FREE(qhub[i]->sub);
  225.                             FREE(qhub[i]);
  226.                             total_qhubs--;
  227.                             while(i<total_qhubs) {
  228.                                 qhub[i]=qhub[i+1];
  229.                                 i++; }
  230.                             changes=1;
  231.                             continue; }
  232.                         qhub_edit(i); }
  233.                     break; } } }
  234.  
  235.     else if(i==1) {     /* FidoNet Stuff */
  236.         done=0;
  237.         while(!done) {
  238.             i=0;
  239.             sprintf(opt[i++],"%-27.27s%s"
  240.                 ,"System Addresses",total_faddrs ? faddrtoa(faddr[0])
  241.                     : nulstr);
  242.             sprintf(opt[i++],"%-27.27s%s"
  243.                 ,"Default Outbound Address"
  244.                 ,dflt_faddr.zone ? faddrtoa(dflt_faddr) : "No");
  245.             sprintf(opt[i++],"%-27.27s"
  246.                 ,"Default Origin Line");
  247.             sprintf(opt[i++],"%-27.27s%.40s"
  248.                 ,"NetMail Semaphore",netmail_sem);
  249.             sprintf(opt[i++],"%-27.27s%.40s"
  250.                 ,"EchoMail Semaphore",echomail_sem);
  251.             sprintf(opt[i++],"%-27.27s%.40s"
  252.                 ,"Inbound File Directory",fidofile_dir);
  253.             sprintf(opt[i++],"%-27.27s%.40s"
  254.                 ,"EchoMail Base Directory",echomail_dir);
  255.             sprintf(opt[i++],"%-27.27s%.40s"
  256.                 ,"NetMail Directory",netmail_dir);
  257.             sprintf(opt[i++],"%-27.27s%s"
  258.                 ,"Allow Sending of NetMail"
  259.                 ,netmail_misc&NMAIL_ALLOW ? "Yes":"No");
  260.             sprintf(opt[i++],"%-27.27s%s"
  261.                 ,"Allow File Attachments"
  262.                 ,netmail_misc&NMAIL_FILE ? "Yes":"No");
  263.             sprintf(opt[i++],"%-27.27s%s"
  264.                 ,"Send NetMail Using Alias"
  265.                 ,netmail_misc&NMAIL_ALIAS ? "Yes":"No");
  266.             sprintf(opt[i++],"%-27.27s%s"
  267.                 ,"NetMail Defaults to Crash"
  268.                 ,netmail_misc&NMAIL_CRASH ? "Yes":"No");
  269.             sprintf(opt[i++],"%-27.27s%s"
  270.                 ,"NetMail Defaults to Direct"
  271.                 ,netmail_misc&NMAIL_DIRECT ? "Yes":"No");
  272.             sprintf(opt[i++],"%-27.27s%s"
  273.                 ,"NetMail Defaults to Hold"
  274.                 ,netmail_misc&NMAIL_HOLD ? "Yes":"No");
  275.             sprintf(opt[i++],"%-27.27s%s"
  276.                 ,"Kill NetMail After Sent"
  277.                 ,netmail_misc&NMAIL_KILL ? "Yes":"No");
  278.             sprintf(opt[i++],"%-27.27s%lu"
  279.                 ,"Cost to Send NetMail",netmail_cost);
  280.             opt[i][0]=0;
  281.             SETHELP(WHERE);
  282. /*
  283. FidoNet EchoMail and NetMail:
  284.  
  285. This menu contains configuration options that pertain specifically to
  286. networking E-mail (NetMail) and sub-boards (EchoMail) through networks
  287. using FidoNet technology.
  288. */
  289.             i=ulist(WIN_ACT|WIN_MID|WIN_CHE,0,0,60,&fnet_dflt,0
  290.                 ,"FidoNet EchoMail and NetMail",opt);
  291.             savnum=0;
  292.             switch(i) {
  293.                 case -1:    /* ESC */
  294.                     done=1;
  295.                     break;
  296.                 case 0:
  297.                     SETHELP(WHERE);
  298. /*
  299. System FidoNet Addresses:
  300.  
  301. This is the FidoNet address of this system used to receive NetMail.
  302. The Main address is also used as the default address for sub-boards.
  303. Format: Zone:Net/Node[.Point]
  304. */
  305.                     k=l=0;
  306.                     while(1) {
  307.                         for(i=0;i<total_faddrs && i<MAX_OPTS;i++) {
  308.                             if(i==0)
  309.                                 strcpy(str,"Main");
  310.                             else
  311.                                 sprintf(str,"AKA %u",i);
  312.                             sprintf(opt[i],"%-8.8s %-16s"
  313.                                 ,str,faddrtoa(faddr[i])); }
  314.                         opt[i][0]=0;
  315.                         j=WIN_RHT|WIN_SAV|WIN_ACT|WIN_INSACT;
  316.                         if(total_faddrs<MAX_OPTS)
  317.                             j|=WIN_INS|WIN_XTR;
  318.                         if(total_faddrs)
  319.                             j|=WIN_DEL;
  320.                         i=ulist(j,0,0,0,&k,&l
  321.                             ,"System Addresses",opt);
  322.                         if(i==-1)
  323.                             break;
  324.                         if((i&MSK_ON)==MSK_INS) {
  325.                             i&=MSK_OFF;
  326.  
  327.                             if(!total_faddrs)
  328.                                 strcpy(str,"1:1/0");
  329.                             else
  330.                                 strcpy(str,faddrtoa(faddr[0]));
  331.                             if(!uinput(WIN_MID|WIN_SAV,0,0,"Address"
  332.                                 ,str,25,K_EDIT|K_UPPER))
  333.                                 continue;
  334.  
  335.                             if((faddr=(faddr_t *)REALLOC(faddr
  336.                                 ,sizeof(faddr_t)*(total_faddrs+1)))==NULL) {
  337.                                 errormsg(WHERE,ERR_ALLOC,nulstr
  338.                                     ,sizeof(faddr_t)*total_faddrs+1);
  339.                                 total_faddrs=0;
  340.                                 bail(1);
  341.                                 continue; }
  342.  
  343.                             for(j=total_faddrs;j>i;j--)
  344.                                 faddr[j]=faddr[j-1];
  345.  
  346.                             faddr[i]=atofaddr(str);
  347.                             total_faddrs++;
  348.                             changes=1;
  349.                             continue; }
  350.                         if((i&MSK_ON)==MSK_DEL) {
  351.                             i&=MSK_OFF;
  352.                             total_faddrs--;
  353.                             while(i<total_faddrs) {
  354.                                 faddr[i]=faddr[i+1];
  355.                                 i++; }
  356.                             changes=1;
  357.                             continue; }
  358.                         strcpy(str,faddrtoa(faddr[i]));
  359.                         uinput(WIN_MID|WIN_SAV,0,0,"Address"
  360.                             ,str,25,K_EDIT);
  361.                         faddr[i]=atofaddr(str); }
  362.                     break;
  363.                 case 1:
  364.                     i=0;
  365.                     strcpy(opt[0],"Yes");
  366.                     strcpy(opt[1],"No");
  367.                     opt[2][0]=0;
  368.                     SETHELP(WHERE);
  369. /*
  370. Use Default Outbound NetMail Address:
  371.  
  372. If you would like to have a default FidoNet address adding to outbound
  373. NetMail mail messages that do not have an address specified, select
  374. Yes.
  375. */
  376.                     i=ulist(WIN_MID|WIN_SAV,0,0,0,&i,0
  377.                         ,"Use Default Outbound NetMail Address",opt);
  378.                     if(i==1) {
  379.                         if(dflt_faddr.zone)
  380.                             changes=1;
  381.                         dflt_faddr.zone=0;
  382.                         break; }
  383.                     if(i==-1)
  384.                         break;
  385.                     if(!dflt_faddr.zone) {
  386.                         dflt_faddr.zone=1;
  387.                         changes=1; }
  388.                     strcpy(str,faddrtoa(dflt_faddr));
  389.                     SETHELP(WHERE);
  390. /*
  391. Default Outbound FidoNet NetMail Address:
  392.  
  393. If you would like to automatically add a FidoNet address to outbound
  394. NetMail that does not have an address specified, set this option
  395. to that address. This is useful for Fido/UUCP gateway mail.
  396. Format: Zone:Net/Node[.Point]
  397. */
  398.                     if(uinput(WIN_MID|WIN_SAV,0,0,"Outbound Address"
  399.                         ,str,25,K_EDIT)) {
  400.                         dflt_faddr=atofaddr(str);
  401.                         changes=1; }
  402.                     break;
  403.                 case 2:
  404.                     SETHELP(WHERE);
  405. /*
  406. Default Origin Line:
  407.  
  408. This is the default origin line used for sub-boards networked via
  409. EchoMail. This origin line can be overridden on a per sub-board basis
  410. with the sub-board configuration Network Options....
  411. */
  412.                     uinput(WIN_MID|WIN_SAV,0,0,"* Origin"
  413.                         ,origline,50,K_EDIT);
  414.                     break;
  415.                 case 3:
  416.                     SETHELP(WHERE);
  417. /*
  418. NetMail Semaphore File:
  419.  
  420. This is a filename that will be used as a semaphore (signal) to your
  421. FidoNet front-end that new NetMail has been created and the messages
  422. should be re-scanned.
  423. */
  424.                     uinput(WIN_MID|WIN_SAV,0,0,"NetMail Semaphore"
  425.                         ,netmail_sem,50,K_EDIT|K_UPPER);
  426.                     break;
  427.                 case 4:
  428.                     SETHELP(WHERE);
  429. /*
  430. EchoMail Semaphore File:
  431.  
  432. This is a filename that will be used as a semaphore (signal) to your
  433. FidoNet front-end that new EchoMail has been created and the messages
  434. should be re-scanned.
  435. */
  436.                     uinput(WIN_MID|WIN_SAV,0,0,"EchoMail Semaphore"
  437.                         ,echomail_sem,50,K_EDIT|K_UPPER);
  438.                     break;
  439.                 case 5:
  440.                     SETHELP(WHERE);
  441. /*
  442. Inbound File Directory:
  443.  
  444. This directory is where inbound files are placed. This directory is
  445. only used when an incoming message has a file attached.
  446. */
  447.                     uinput(WIN_MID|WIN_SAV,0,0,"Inbound Files"
  448.                         ,fidofile_dir,50,K_EDIT|K_UPPER);
  449.                     break;
  450.                 case 6:
  451.                     SETHELP(WHERE);
  452. /*
  453. EchoMail Base Directory:
  454.  
  455. This is an optional field used as a base directory for the location
  456. of EchoMail messages for sub-boards that do not have a specified
  457. EchoMail Storage Directory. If a sub-board does not have a specified
  458. storage directory for EchoMail, its messages will be imported from and
  459. exported to a sub-directory off of this base directory. The name of the
  460. sub-directory is the same as the internal code for the sub-directory.
  461.  
  462. If all EchoMail sub-boards have specified EchoMail storage directories,
  463. this option is not used at all.
  464. */
  465.                     uinput(WIN_MID|WIN_SAV,0,0,"EchoMail Base"
  466.                         ,echomail_dir,50,K_EDIT|K_UPPER);
  467.                     break;
  468.                 case 7:
  469.                     SETHELP(WHERE);
  470. /*
  471. NetMail Directory:
  472.  
  473. This is the directory where NetMail will be imported from and exported
  474. to.
  475. */
  476.                     uinput(WIN_MID|WIN_SAV,0,0,"NetMail"
  477.                         ,netmail_dir,50,K_EDIT|K_UPPER);
  478.                     break;
  479.                 case 8:
  480.                     i=0;
  481.                     strcpy(opt[0],"Yes");
  482.                     strcpy(opt[1],"No");
  483.                     opt[2][0]=0;
  484.                     SETHELP(WHERE);
  485. /*
  486. Allow Users to Send NetMail:
  487.  
  488. If you are on a FidoNet style network and want your users to be allowed
  489. to send NetMail, set this option to Yes.
  490. */
  491.                     i=ulist(WIN_MID|WIN_SAV,0,0,0,&i,0
  492.                         ,"Allow Users to Send NetMail",opt);
  493.                     if(!i && !(netmail_misc&NMAIL_ALLOW)) {
  494.                         changes=1;
  495.                         netmail_misc|=NMAIL_ALLOW; }
  496.                     else if(i==1 && netmail_misc&NMAIL_ALLOW) {
  497.                         changes=1;
  498.                         netmail_misc&=~NMAIL_ALLOW; }
  499.                     break;
  500.                 case 9:
  501.                     i=0;
  502.                     strcpy(opt[0],"Yes");
  503.                     strcpy(opt[1],"No");
  504.                     opt[2][0]=0;
  505.                     SETHELP(WHERE);
  506. /*
  507. Allow Users to Send NetMail File Attachments:
  508.  
  509. If you are on a FidoNet style network and want your users to be allowed
  510. to send NetMail file attachments, set this option to Yes.
  511. */
  512.                     i=ulist(WIN_MID|WIN_SAV,0,0,0,&i,0
  513.                         ,"Allow Users to Send NetMail File Attachments",opt);
  514.                     if(!i && !(netmail_misc&NMAIL_FILE)) {
  515.                         changes=1;
  516.                         netmail_misc|=NMAIL_FILE; }
  517.                     else if(i==1 && netmail_misc&NMAIL_FILE) {
  518.                         changes=1;
  519.                         netmail_misc&=~NMAIL_FILE; }
  520.                     break;
  521.                 case 10:
  522.                     i=1;
  523.                     strcpy(opt[0],"Yes");
  524.                     strcpy(opt[1],"No");
  525.                     opt[2][0]=0;
  526.                     SETHELP(WHERE);
  527. /*
  528. Use Aliases in NetMail:
  529.  
  530. If you allow aliases on your system and wish users to have their NetMail
  531. contain their alias as the From User, set this option to Yes. If you
  532. want all NetMail to be sent using users' real names, set this option to
  533. No.
  534. */
  535.                     i=ulist(WIN_MID|WIN_SAV,0,0,0,&i,0
  536.                         ,"Use Aliases in NetMail",opt);
  537.                     if(!i && !(netmail_misc&NMAIL_ALIAS)) {
  538.                         changes=1;
  539.                         netmail_misc|=NMAIL_ALIAS; }
  540.                     else if(i==1 && netmail_misc&NMAIL_ALIAS) {
  541.                         changes=1;
  542.                         netmail_misc&=~NMAIL_ALIAS; }
  543.                     break;
  544.                 case 11:
  545.                     i=1;
  546.                     strcpy(opt[0],"Yes");
  547.                     strcpy(opt[1],"No");
  548.                     opt[2][0]=0;
  549.                     SETHELP(WHERE);
  550. /*
  551. NetMail Defaults to Crash Status:
  552.  
  553. If you want all NetMail to default to crash (send immediately) status,
  554. set this option to Yes.
  555. */
  556.                     i=ulist(WIN_MID|WIN_SAV,0,0,0,&i,0
  557.                         ,"NetMail Defaults to Crash Status",opt);
  558.                     if(!i && !(netmail_misc&NMAIL_CRASH)) {
  559.                         changes=1;
  560.                         netmail_misc|=NMAIL_CRASH; }
  561.                     else if(i==1 && netmail_misc&NMAIL_CRASH) {
  562.                         changes=1;
  563.                         netmail_misc&=~NMAIL_CRASH; }
  564.                     break;
  565.                 case 12:
  566.                     i=1;
  567.                     strcpy(opt[0],"Yes");
  568.                     strcpy(opt[1],"No");
  569.                     opt[2][0]=0;
  570.                     SETHELP(WHERE);
  571. /*
  572. NetMail Defaults to Direct Status:
  573.  
  574. If you want all NetMail to default to direct (send directly) status,
  575. set this option to Yes.
  576. */
  577.                     i=ulist(WIN_MID|WIN_SAV,0,0,0,&i,0
  578.                         ,"NetMail Defaults to Direct Status",opt);
  579.                     if(!i && !(netmail_misc&NMAIL_DIRECT)) {
  580.                         changes=1;
  581.                         netmail_misc|=NMAIL_DIRECT; }
  582.                     else if(i==1 && netmail_misc&NMAIL_DIRECT) {
  583.                         changes=1;
  584.                         netmail_misc&=~NMAIL_DIRECT; }
  585.                     break;
  586.                 case 13:
  587.                     i=1;
  588.                     strcpy(opt[0],"Yes");
  589.                     strcpy(opt[1],"No");
  590.                     opt[2][0]=0;
  591.                     SETHELP(WHERE);
  592. /*
  593. NetMail Defaults to Hold Status:
  594.  
  595. If you want all NetMail to default to hold status, set this option to
  596. Yes.
  597. */
  598.                     i=ulist(WIN_MID|WIN_SAV,0,0,0,&i,0
  599.                         ,"NetMail Defaults to Hold Status",opt);
  600.                     if(!i && !(netmail_misc&NMAIL_HOLD)) {
  601.                         changes=1;
  602.                         netmail_misc|=NMAIL_HOLD; }
  603.                     else if(i==1 && netmail_misc&NMAIL_HOLD) {
  604.                         changes=1;
  605.                         netmail_misc&=~NMAIL_HOLD; }
  606.                     break;
  607.                 case 14:
  608.                     i=0;
  609.                     strcpy(opt[0],"Yes");
  610.                     strcpy(opt[1],"No");
  611.                     opt[2][0]=0;
  612.                     SETHELP(WHERE);
  613. /*
  614. Kill NetMail After it is Sent:
  615.  
  616. If you want NetMail messages to be deleted after they are successfully
  617. sent, set this option to Yes.
  618. */
  619.                     i=ulist(WIN_MID|WIN_SAV,0,0,0,&i,0
  620.                         ,"Kill NetMail After it is Sent",opt);
  621.                     if(!i && !(netmail_misc&NMAIL_KILL)) {
  622.                         changes=1;
  623.                         netmail_misc|=NMAIL_KILL; }
  624.                     else if(i==1 && netmail_misc&NMAIL_KILL) {
  625.                         changes=1;
  626.                         netmail_misc&=~NMAIL_KILL; }
  627.                     break;
  628.                 case 15:
  629.                     ultoa(netmail_cost,str,10);
  630.                     SETHELP(WHERE);
  631. /*
  632. Cost in Credits to Send NetMail:
  633.  
  634. This is the number of credits it will cost your users to send NetMail.
  635. If you want the sending of NetMail to be free, set this value to 0.
  636. */
  637.                     uinput(WIN_MID|WIN_SAV,0,0
  638.                         ,"Cost in Credits to Send NetMail"
  639.                         ,str,10,K_EDIT|K_NUMBER);
  640.                     netmail_cost=atol(str);
  641.                     break; } } }
  642.     else if(i==2) {
  643.         done=0;
  644.         while(!done) {
  645.             i=0;
  646.             strcpy(opt[i++],"Network Hubs...");
  647.             sprintf(opt[i++],"%-20.20s%-12s","Site Name",sys_psname);
  648.             sprintf(opt[i++],"%-20.20s%-lu","Site Number",sys_psnum);
  649.             opt[i][0]=0;
  650.             SETHELP(WHERE);
  651. /*
  652. PostLink Networks:
  653.  
  654. From this menu you can configure the default tagline to use for
  655. outgoing messages on QWK networked sub-boards, or you can select
  656. Network Hubs... to add, delete, or configure QWK hubs that your system
  657. calls to exchange packets with.
  658. */
  659.             i=ulist(WIN_ACT|WIN_RHT|WIN_BOT|WIN_CHE,0,0,0,&pnet_dflt,0
  660.                 ,"PostLink Networks",opt);
  661.             savnum=0;
  662.             switch(i) {
  663.                 case -1:    /* ESC */
  664.                     done=1;
  665.                     break;
  666.                 case 1:
  667.                     SETHELP(WHERE);
  668. /*
  669. PostLink Site Name:
  670.  
  671. If your system is networked via PostLink or PCRelay, this should be the
  672. Site Name for your BBS.
  673. */
  674.                     uinput(WIN_MID|WIN_SAV,0,0,"Site Name"
  675.                         ,sys_psname,12,K_UPPER|K_EDIT);
  676.                     break;
  677.                 case 2:
  678.                     SETHELP(WHERE);
  679. /*
  680. PostLink Site Number:
  681.  
  682. If your system is networked via PostLink or PCRelay, this should be the
  683. Site Number for your BBS.
  684. */
  685.                     ultoa(sys_psnum,str,10);
  686.                     uinput(WIN_MID|WIN_SAV,0,0,"Site Number"
  687.                         ,str,10,K_NUMBER|K_EDIT);
  688.                     sys_psnum=atol(str);
  689.                     break;
  690.                 case 0:
  691.                     while(1) {
  692.                         for(i=0;i<total_phubs && i<MAX_OPTS;i++)
  693.                             sprintf(opt[i],"%-10.10s",phub[i]->name);
  694.                         opt[i][0]=0;
  695.                         i=WIN_ACT|WIN_RHT|WIN_SAV;
  696.                         if(total_phubs<MAX_OPTS)
  697.                             i|=WIN_INS|WIN_INSACT|WIN_XTR;
  698.                         if(total_phubs)
  699.                             i|=WIN_DEL;
  700.                         savnum=0;
  701.                         SETHELP(WHERE);
  702. /*
  703. PostLink Network Hubs:
  704.  
  705. This is a list of PostLink and/or PCRelay network hubs that your system
  706. calls to exchange packets with.
  707.  
  708. To add a hub, select the desired location with the arrow keys and hit
  709.  INS .
  710.  
  711. To delete a hub, select it and hit  DEL .
  712.  
  713. To configure a hub, select it and hit  ENTER .
  714. */
  715.                         i=ulist(i,0,0,0,&phub_dflt,0
  716.                             ,"PostLink Hubs",opt);
  717.                         if(i==-1)
  718.                             break;
  719.                         if((i&MSK_ON)==MSK_INS) {
  720.                             i&=MSK_OFF;
  721.                             if((phub=(phub_t **)REALLOC(phub
  722.                                 ,sizeof(phub_t *)*(total_phubs+1)))==NULL) {
  723.                                 errormsg(WHERE,ERR_ALLOC,nulstr
  724.                                     ,sizeof(phub_t *)*(total_phubs+1));
  725.                                 total_phubs=0;
  726.                                 bail(1);
  727.                                 continue; }
  728.  
  729.                             savnum=1;
  730.                             SETHELP(WHERE);
  731. /*
  732. Network Hub Site Name:
  733.  
  734. This is the Site Name of this hub. It is used for only for reference.
  735. */
  736.                             if(uinput(WIN_MID|WIN_SAV,0,0
  737.                                 ,"Site Name",str,10,K_UPPER)<1)
  738.                                 continue;
  739.  
  740.                             for(j=total_phubs;j>i;j--)
  741.                                 phub[j]=phub[j-1];
  742.  
  743.                             if((phub[i]=(phub_t *)MALLOC(sizeof(phub_t)))
  744.                                 ==NULL) {
  745.                                 errormsg(WHERE,ERR_ALLOC,nulstr
  746.                                     ,sizeof(phub_t));
  747.                                 continue; }
  748.                             memset(phub[i],0,sizeof(phub_t));
  749.                             strcpy(phub[i]->name,str);
  750.                             strcpy(phub[i]->call,"%!pnet");
  751.                             phub[i]->node=1;
  752.                             phub[i]->days=0xff; /* all days */
  753.                             total_phubs++;
  754.                             changes=1;
  755.                             continue; }
  756.                         if((i&MSK_ON)==MSK_DEL) {
  757.                             i&=MSK_OFF;
  758.                             FREE(phub[i]);
  759.                             total_phubs--;
  760.                             while(i<total_phubs) {
  761.                                 phub[i]=phub[i+1];
  762.                                 i++; }
  763.                             changes=1;
  764.                             continue; }
  765.                         phub_edit(i); }
  766.                     break; } } }
  767.  
  768.     else if(i==3) {     /* Internet */
  769.         done=0;
  770.         while(!done) {
  771.             i=0;
  772.             sprintf(opt[i++],"%-27.27s%s"
  773.                 ,"System Address",sys_inetaddr);
  774.             sprintf(opt[i++],"%-27.27s%.40s"
  775.                 ,"NetMail Semaphore",inetmail_sem);
  776.             sprintf(opt[i++],"%-27.27s%s"
  777.                 ,"Allow Sending of NetMail"
  778.                 ,inetmail_misc&NMAIL_ALLOW ? "Yes":"No");
  779.             sprintf(opt[i++],"%-27.27s%s"
  780.                 ,"Allow File Attachments"
  781.                 ,inetmail_misc&NMAIL_FILE ? "Yes":"No");
  782.             sprintf(opt[i++],"%-27.27s%s"
  783.                 ,"Send NetMail Using Alias"
  784.                 ,inetmail_misc&NMAIL_ALIAS ? "Yes":"No");
  785.             sprintf(opt[i++],"%-27.27s%lu"
  786.                 ,"Cost to Send NetMail",inetmail_cost);
  787.             opt[i][0]=0;
  788.             SETHELP(WHERE);
  789. /*
  790. Internet NetMail:
  791.  
  792. This menu contains configuration options that pertain specifically to
  793. Internet E-mail (NetMail). To utilize these options, you must own
  794. a Synchronet compatible UUCP/Internet gateway (e.g. SyncUUCP).
  795. */
  796.             i=ulist(WIN_ACT|WIN_MID|WIN_CHE,0,0,60,&inet_dflt,0
  797.                 ,"Internet NetMail",opt);
  798.             savnum=0;
  799.             switch(i) {
  800.                 case -1:    /* ESC */
  801.                     done=1;
  802.                     break;
  803.                 case 0:
  804.                     SETHELP(WHERE);
  805. /*
  806. Sytem Internet Address:
  807.  
  808. If your system has an Internet mail feed, enter your system's Internet
  809. address here (e.g. joesbbs.com).
  810. */
  811.                     uinput(WIN_MID|WIN_SAV,0,0,""
  812.                         ,sys_inetaddr,60,K_EDIT);
  813.                     break;
  814.                 case 1:
  815.                     SETHELP(WHERE);
  816. /*
  817. Internet NetMail Semaphore File:
  818.  
  819. This is a filename that will be used as a semaphore (signal) to your
  820. Internet gateway (if supported) that new mail has been created and the
  821. message base should be re-scanned.
  822. */
  823.                     uinput(WIN_MID|WIN_SAV,0,0,"Semaphore File"
  824.                         ,inetmail_sem,50,K_EDIT|K_UPPER);
  825.                     break;
  826.  
  827.                 case 2:
  828.                     i=0;
  829.                     strcpy(opt[0],"Yes");
  830.                     strcpy(opt[1],"No");
  831.                     opt[2][0]=0;
  832.                     SETHELP(WHERE);
  833. /*
  834. Allow Users to Send Internet NetMail:
  835.  
  836. If your system has an Internet uplink and you want your users to be
  837. allowed to send Internet NetMail, set this option to Yes.
  838. */
  839.                     i=ulist(WIN_MID|WIN_SAV,0,0,0,&i,0
  840.                         ,"Allow Users to Send NetMail",opt);
  841.                     if(!i && !(inetmail_misc&NMAIL_ALLOW)) {
  842.                         changes=1;
  843.                         inetmail_misc|=NMAIL_ALLOW; }
  844.                     else if(i==1 && inetmail_misc&NMAIL_ALLOW) {
  845.                         changes=1;
  846.                         inetmail_misc&=~NMAIL_ALLOW; }
  847.                     break;
  848.  
  849.                 case 3:
  850.                     i=0;
  851.                     strcpy(opt[0],"Yes");
  852.                     strcpy(opt[1],"No");
  853.                     opt[2][0]=0;
  854.                     SETHELP(WHERE);
  855. /*
  856. Allow Users to Send Internet NetMail File Attachments:
  857.  
  858. If your system has an Internet uplink and you want your users to be
  859. allowed to send Internet NetMail file attachments, set this option to Yes.
  860. */
  861.                     i=ulist(WIN_MID|WIN_SAV,0,0,0,&i,0
  862.                         ,"Allow Users to Send NetMail File Attachments",opt);
  863.                     if(!i && !(inetmail_misc&NMAIL_FILE)) {
  864.                         changes=1;
  865.                         inetmail_misc|=NMAIL_FILE; }
  866.                     else if(i==1 && inetmail_misc&NMAIL_FILE) {
  867.                         changes=1;
  868.                         inetmail_misc&=~NMAIL_FILE; }
  869.                     break;
  870.                 case 4:
  871.                     i=1;
  872.                     strcpy(opt[0],"Yes");
  873.                     strcpy(opt[1],"No");
  874.                     opt[2][0]=0;
  875.                     SETHELP(WHERE);
  876. /*
  877. Use Aliases in NetMail:
  878.  
  879. If you allow aliases on your system and wish users to have their NetMail
  880. contain their alias as the From User, set this option to Yes. If you
  881. want all NetMail to be sent using users' real names, set this option to
  882. No.
  883. */
  884.                     i=ulist(WIN_MID|WIN_SAV,0,0,0,&i,0
  885.                         ,"Use Aliases in NetMail",opt);
  886.                     if(!i && !(inetmail_misc&NMAIL_ALIAS)) {
  887.                         changes=1;
  888.                         inetmail_misc|=NMAIL_ALIAS; }
  889.                     else if(i==1 && inetmail_misc&NMAIL_ALIAS) {
  890.                         changes=1;
  891.                         inetmail_misc&=~NMAIL_ALIAS; }
  892.                     break;
  893.                 case 5:
  894.                     ultoa(inetmail_cost,str,10);
  895.                     SETHELP(WHERE);
  896. /*
  897. Cost in Credits to Send NetMail:
  898.  
  899. This is the number of credits it will cost your users to send NetMail.
  900. If you want the sending of NetMail to be free, set this value to 0.
  901. */
  902.                     uinput(WIN_MID|WIN_SAV,0,0
  903.                         ,"Cost in Credits to Send NetMail"
  904.                         ,str,10,K_EDIT|K_NUMBER);
  905.                     inetmail_cost=atol(str);
  906.                     break; } } }
  907.  
  908.     else { /* ESC */
  909.         i=save_changes(WIN_MID|WIN_SAV);
  910.         if(i==-1)
  911.             continue;
  912.         if(!i)
  913.             write_msgs_cfg();
  914.         break; } }
  915. }
  916.  
  917. void qhub_edit(int num)
  918. {
  919.     static int qhub_dflt;
  920.     char *p,done=0,str[256];
  921.     int i,j,k,n;
  922.  
  923. while(!done) {
  924.     i=0;
  925.     sprintf(opt[i++],"%-27.27s%s","Hub System ID",qhub[num]->id);
  926.     sprintf(opt[i++],"%-27.27s%.40s","Pack Command Line",qhub[num]->pack);
  927.     sprintf(opt[i++],"%-27.27s%.40s","Unpack Command Line",qhub[num]->unpack);
  928.     sprintf(opt[i++],"%-27.27s%.40s","Call-out Command Line",qhub[num]->call);
  929.     sprintf(opt[i++],"%-27.27s%u","Call-out Node",qhub[num]->node);
  930.     sprintf(opt[i++],"%-27.27s%s","Call-out Days",daystr(qhub[num]->days));
  931.     if(qhub[num]->freq) {
  932.         sprintf(str,"%u times a day",1440/qhub[num]->freq);
  933.         sprintf(opt[i++],"%-27.27s%s","Call-out Frequency",str); }
  934.     else {
  935.         sprintf(str,"%2.2d:%2.2d",qhub[num]->time/60,qhub[num]->time%60);
  936.         sprintf(opt[i++],"%-27.27s%s","Call-out Time",str); }
  937.     strcpy(opt[i++],"Networked Sub-boards...");
  938.     opt[i][0]=0;
  939.     sprintf(str,"%s Network Hub",qhub[num]->id);
  940.     savnum=1;
  941.     SETHELP(WHERE);
  942. /*
  943. QWK Network Hub Configuration:
  944.  
  945. This menu allows you to configure options specific to this QWK network
  946. hub.
  947. */
  948.     switch(ulist(WIN_ACT|WIN_MID|WIN_SAV,0,0,0,&qhub_dflt,0
  949.         ,str,opt)) {
  950.         case -1:
  951.             done=1;
  952.             break;
  953.         case 0:
  954.             SETHELP(WHERE);
  955. /*
  956. QWK Network Hub System ID:
  957.  
  958. This is the QWK System ID of this hub. It is used for incoming and
  959. outgoing network packets and must be accurate.
  960. */
  961.             strcpy(str,qhub[num]->id);    /* save */
  962.             if(!uinput(WIN_MID|WIN_SAV,0,0,"QWK Network Hub System ID"
  963.                 ,qhub[num]->id,8,K_UPPER|K_EDIT))
  964.                 strcpy(qhub[num]->id,str);
  965.             break;
  966.         case 1:
  967.             SETHELP(WHERE);
  968. /*
  969. REP Packet Creation Command:
  970.  
  971. This is the command line to use to create (compress) REP packets for
  972. this QWK network hub.
  973. */
  974.             uinput(WIN_MID|WIN_SAV,0,0,"Packet Creation"
  975.                 ,qhub[num]->pack,50,K_EDIT);
  976.             break;
  977.         case 2:
  978.             SETHELP(WHERE);
  979. /*
  980. QWK Packet Extraction Command:
  981.  
  982. This is the command line to use to extract (decompress) QWK packets from
  983. this QWK network hub.
  984. */
  985.             uinput(WIN_MID|WIN_SAV,0,0,"Packet Extraction"
  986.                 ,qhub[num]->unpack,50,K_EDIT);
  987.             break;
  988.         case 3:
  989.             SETHELP(WHERE);
  990. /*
  991. QWK Network Hub Call-out Command Line:
  992.  
  993. This is the command line to use to initiate a call-out to this QWK
  994. network hub.
  995. */
  996.             uinput(WIN_MID|WIN_SAV,0,0,"Call-out Command"
  997.                 ,qhub[num]->call,50,K_EDIT);
  998.             break;
  999.         case 4:
  1000.             sprintf(str,"%u",qhub[num]->node);
  1001.             SETHELP(WHERE);
  1002. /*
  1003. Node to Perform Call-out:
  1004.  
  1005. This is the number of the node to perform the call-out for this QWK
  1006. network hub.
  1007. */
  1008.             uinput(WIN_MID|WIN_SAV,0,0
  1009.                 ,"Node to Perform Call-out",str,3,K_EDIT|K_NUMBER);
  1010.             qhub[num]->node=atoi(str);
  1011.             break;
  1012.         case 5:
  1013.             j=0;
  1014.             while(1) {
  1015.                 for(i=0;i<7;i++)
  1016.                     sprintf(opt[i],"%s        %s"
  1017.                         ,wday[i],(qhub[num]->days&(1<<i)) ? "Yes":"No");
  1018.                 opt[i][0]=0;
  1019.                 savnum=2;
  1020.                 SETHELP(WHERE);
  1021. /*
  1022. Days to Perform Call-out:
  1023.  
  1024. These are the days that a call-out will be performed for this QWK
  1025. network hub.
  1026. */
  1027.                 i=ulist(WIN_MID,0,0,0,&j,0
  1028.                     ,"Days to Perform Call-out",opt);
  1029.                 if(i==-1)
  1030.                     break;
  1031.                 qhub[num]->days^=(1<<i);
  1032.                 changes=1; }
  1033.             break;
  1034.         case 6:
  1035.             i=1;
  1036.             strcpy(opt[0],"Yes");
  1037.             strcpy(opt[1],"No");
  1038.             opt[2][0]=0;
  1039.             savnum=2;
  1040.             SETHELP(WHERE);
  1041. /*
  1042. Perform Call-out at a Specific Time:
  1043.  
  1044. If you want the system call this QWK network hub at a specific time,
  1045. set this option to Yes. If you want the system to call this network
  1046. hub more than once a day at predetermined intervals, set this option to
  1047. No.
  1048. */
  1049.             i=ulist(WIN_MID|WIN_SAV,0,0,0,&i,0
  1050.                 ,"Perform Call-out at a Specific Time",opt);
  1051.             if(i==0) {
  1052.                 sprintf(str,"%2.2d:%2.2d",qhub[num]->time/60
  1053.                     ,qhub[num]->time%60);
  1054.                 SETHELP(WHERE);
  1055. /*
  1056. Time to Perform Call-out:
  1057.  
  1058. This is the time (in 24 hour HH:MM format) to perform the call-out to
  1059. this QWK network hub.
  1060. */
  1061.                 if(uinput(WIN_MID|WIN_SAV,0,0
  1062.                     ,"Time to Perform Call-out (HH:MM)"
  1063.                     ,str,5,K_UPPER|K_EDIT)>0) {
  1064.                     qhub[num]->freq=0;
  1065.                     qhub[num]->time=atoi(str)*60;
  1066.                     if((p=strchr(str,':'))!=NULL)
  1067.                         qhub[num]->time+=atoi(p+1); } }
  1068.             else if(i==1) {
  1069.                 sprintf(str,"%u",qhub[num]->freq
  1070.                     && qhub[num]->freq<=1440 ? 1440/qhub[num]->freq : 0);
  1071.                 SETHELP(WHERE);
  1072. /*
  1073. Number of Call-outs Per Day:
  1074.  
  1075. This is the maximum number of times the system will perform a call-out
  1076. per day to this QWK network hub. This value is actually converted by
  1077. Synchronet into minutes between call-outs and when the BBS is idle
  1078. and this number of minutes since the last call-out is reached, it will
  1079. perform a call-out.
  1080. */
  1081.                 if(uinput(WIN_MID|WIN_SAV,0,0
  1082.                     ,"Number of Call-outs Per Day"
  1083.                     ,str,4,K_NUMBER|K_EDIT)>0) {
  1084.                     qhub[num]->time=0;
  1085.                     i=atoi(str);
  1086.                     if(i && i<=1440)
  1087.                         qhub[num]->freq=1440/i;
  1088.                     else
  1089.                         qhub[num]->freq=0; } }
  1090.             break;
  1091.         case 7:
  1092.             qhub_sub_edit(num);
  1093.             break; } }
  1094. }
  1095.  
  1096. void qhub_sub_edit(uint num)
  1097. {
  1098.     char str[256];
  1099.     int i,j,k,l,m,n,bar=0;
  1100.  
  1101. k=0;
  1102. while(1) {
  1103.     for(j=0;j<qhub[num]->subs;j++)
  1104.         sprintf(opt[j],"%-*.*s %-*.*s"
  1105.             ,LEN_GSNAME,LEN_GSNAME
  1106.             ,grp[sub[qhub[num]->sub[j]]->grp]->sname
  1107.             ,LEN_SSNAME,LEN_SSNAME
  1108.             ,sub[qhub[num]->sub[j]]->sname);
  1109.     opt[j][0]=0;
  1110.     savnum=2;
  1111.     j=WIN_BOT|WIN_SAV|WIN_ACT;
  1112.     if(qhub[num]->subs<MAX_OPTS)
  1113.         j|=WIN_INS|WIN_INSACT|WIN_XTR;
  1114.     if(qhub[num]->subs)
  1115.         j|=WIN_DEL;
  1116.     SETHELP(WHERE);
  1117. /*
  1118. QWK Networked Sub-boards:
  1119.  
  1120. This is a list of the sub-boards that are networked with this QWK
  1121. network hub.
  1122.  
  1123. To add a sub-board, select the desired location and hit  INS .
  1124.  
  1125. To remove a sub-board, select it and hit  DEL .
  1126.  
  1127. To configure a sub-board for this QWK network hub, select it and hit
  1128.  ENTER .
  1129. */
  1130.     j=ulist(j,0,0,0,&k,&bar
  1131.         ,"Networked Sub-boards",opt);
  1132.     if(j==-1)
  1133.         break;
  1134.     if((j&MSK_ON)==MSK_INS) {
  1135.         j&=MSK_OFF;
  1136.         savnum=3;
  1137.         if((l=getsub())==-1)
  1138.             continue;
  1139.         savnum=3;
  1140.         SETHELP(WHERE);
  1141. /*
  1142. Conference Number on Hub:
  1143.  
  1144. This is the number of the conference on the QWK network hub, that this
  1145. sub-board is networked with. On Synchronet systems, this number is
  1146. derived by multiplying the group number by 10 and adding the sub-board
  1147. number. For example, group 2, sub-board 3, is conference number 203.
  1148.  
  1149. It is important to understand that this is NOT the conference number of
  1150. this sub-board on your system. It is the number of the conference this
  1151. sub-board is networked with on this QWK network hub.
  1152. */
  1153.         if(uinput(WIN_MID|WIN_SAV,0,0
  1154.             ,"Conference Number on Hub"
  1155.             ,str,5,K_NUMBER)<1)
  1156.             continue;
  1157.         strcpy(opt[0],"Strip out");
  1158.         strcpy(opt[1],"Leave in");
  1159.         strcpy(opt[2],"Expand to ANSI");
  1160.         opt[3][0]=0;
  1161.         m=0;
  1162.         SETHELP(WHERE);
  1163. /*
  1164. Ctrl-A Codes:
  1165.  
  1166. You are being prompted for the method of handling Ctrl-A attribute codes
  1167. generated by Synchronet. If this QWK network hub is a Synchronet BBS,
  1168. set this option to Leave in. If the QWK network hub is not a Synchronet
  1169. BBS, but allows ANSI escape sequences in messages, set this option to
  1170. Expand to ANSI. If the QWK network hub is not a Synchronet BBS and does
  1171. not support ANSI escape sequences in messages (or you're not sure), set
  1172. this option to Strip out.
  1173. */
  1174.         if((m=ulist(WIN_MID|WIN_SAV,0,0,0,&m,0
  1175.             ,"Ctrl-A Codes",opt))==-1)
  1176.             continue;
  1177.         if((qhub[num]->sub=(ushort *)REALLOC(qhub[num]->sub
  1178.             ,sizeof(ushort *)*(qhub[num]->subs+1)))==NULL
  1179.         || (qhub[num]->conf=(ushort *)REALLOC(qhub[num]->conf
  1180.             ,sizeof(ushort *)*(qhub[num]->subs+1)))==NULL
  1181.         || (qhub[num]->mode=(uchar *)REALLOC(qhub[num]->mode
  1182.             ,sizeof(uchar *)*(qhub[num]->subs+1)))==NULL) {
  1183.             errormsg(WHERE,ERR_ALLOC,nulstr,qhub[num]->subs+1);
  1184.             continue; }
  1185.         if(qhub[num]->subs)               /* insert */
  1186.             for(n=qhub[num]->subs;n>j;n--) {
  1187.                 qhub[num]->sub[n]=qhub[num]->sub[n-1];
  1188.                 qhub[num]->conf[n]=qhub[num]->conf[n-1];
  1189.                 qhub[num]->mode[n]=qhub[num]->mode[n-1]; }
  1190.         if(!m)
  1191.             qhub[num]->mode[j]=A_STRIP;
  1192.         else if(m==1)
  1193.             qhub[num]->mode[j]=A_LEAVE;
  1194.         else
  1195.             qhub[num]->mode[j]=A_EXPAND;
  1196.         qhub[num]->sub[j]=l;
  1197.         qhub[num]->conf[j]=atoi(str);
  1198.         qhub[num]->subs++;
  1199.         changes=1;
  1200.         continue; }
  1201.     if((j&MSK_ON)==MSK_DEL) {
  1202.         j&=MSK_OFF;
  1203.         qhub[num]->subs--;
  1204.         while(j<qhub[num]->subs) {
  1205.             qhub[num]->sub[j]=qhub[num]->sub[j+1];
  1206.             qhub[num]->mode[j]=qhub[num]->mode[j+1];
  1207.             qhub[num]->conf[j]=qhub[num]->conf[j+1];
  1208.             j++; }
  1209.         changes=1;
  1210.         continue; }
  1211.     l=0;
  1212.     while(1) {
  1213.         n=0;
  1214.         sprintf(opt[n++],"%-22.22s%.*s %.*s"
  1215.             ,"Sub-board"
  1216.             ,LEN_GSNAME
  1217.             ,grp[sub[qhub[num]->sub[j]]->grp]->sname
  1218.             ,LEN_SSNAME
  1219.             ,sub[qhub[num]->sub[j]]->sname);
  1220.         sprintf(opt[n++],"%-22.22s%u"
  1221.             ,"Conference Number",qhub[num]->conf[j]);
  1222.         sprintf(opt[n++],"%-22.22s%s"
  1223.             ,"Ctrl-A Codes",qhub[num]->mode[j]==A_STRIP ?
  1224.             "Strip out" : qhub[num]->mode[j]==A_LEAVE ?
  1225.             "Leave in" : "Expand to ANSI");
  1226.         opt[n][0]=0;
  1227.         savnum=3;
  1228.         SETHELP(WHERE);
  1229. /*
  1230. QWK Netted Sub-board:
  1231.  
  1232. You are configuring the options for this sub-board for this QWK network
  1233. hub.
  1234. */
  1235.         l=ulist(WIN_MID|WIN_SAV|WIN_ACT,0,0,
  1236.             22+LEN_GSNAME+LEN_SSNAME,&l,0
  1237.             ,"Netted Sub-board",opt);
  1238.         if(l==-1)
  1239.             break;
  1240.         if(!l) {
  1241.             savnum=4;
  1242.             m=getsub();
  1243.             if(m!=-1) {
  1244.                 qhub[num]->sub[j]=m;
  1245.                 changes=1; } }
  1246.         else if(l==1) {
  1247.             savnum=4;
  1248.             SETHELP(WHERE);
  1249. /*
  1250. Conference Number on Hub:
  1251.  
  1252. This is the number of the conference on the QWK network hub, that this
  1253. sub-board is networked with. On Synchronet systems, this number is
  1254. derived by multiplying the group number by 10 and adding the sub-board
  1255. number. For example, group 2, sub-board 3, is conference number 203.
  1256.  
  1257. It is important to understand that this is NOT the conference number of
  1258. this sub-board on your system. It is the number of the conference this
  1259. sub-board is networked with on this QWK network hub.
  1260. */
  1261.             if(uinput(WIN_MID|WIN_SAV,0,0
  1262.                 ,"Conference Number on Hub"
  1263.                 ,str,5,K_NUMBER)>0)
  1264.                 qhub[num]->conf[j]=atoi(str); }
  1265.         else if(l==2) {
  1266.             strcpy(opt[0],"Strip out");
  1267.             strcpy(opt[1],"Leave in");
  1268.             strcpy(opt[2],"Expand to ANSI");
  1269.             opt[3][0]=0;
  1270.             m=0;
  1271.             savnum=4;
  1272.             SETHELP(WHERE);
  1273. /*
  1274. Ctrl-A Codes:
  1275.  
  1276. You are being prompted for the method of handling Ctrl-A attribute codes
  1277. generated by Synchronet. If this QWK network hub is a Synchronet BBS,
  1278. set this option to Leave in. If the QWK network hub is not a Synchronet
  1279. BBS, but allows ANSI escape sequences in messages, set this option to
  1280. Expand to ANSI. If the QWK network hub is not a Synchronet BBS and does
  1281. not support ANSI escape sequences in messages (or you're not sure), set
  1282. this option to Strip out.
  1283. */
  1284.             m=ulist(WIN_MID|WIN_SAV,0,0,0,&m,0
  1285.                 ,"Ctrl-A Codes",opt);
  1286.             changes=1;
  1287.             if(!m)
  1288.                 qhub[num]->mode[j]=A_STRIP;
  1289.             else if(m==1)
  1290.                 qhub[num]->mode[j]=A_LEAVE;
  1291.             else if(m==2)
  1292.                 qhub[num]->mode[j]=A_EXPAND; } } }
  1293. }
  1294.  
  1295. void phub_edit(int num)
  1296. {
  1297.     static int phub_dflt;
  1298.     char *p,done=0,str[256];
  1299.     int i,j,k,n;
  1300.  
  1301. while(!done) {
  1302.     i=0;
  1303.     sprintf(opt[i++],"%-27.27s%s","Hub Site Name",phub[num]->name);
  1304.     sprintf(opt[i++],"%-27.27s%.40s","Call-out Command Line",phub[num]->call);
  1305.     sprintf(opt[i++],"%-27.27s%u","Call-out Node",phub[num]->node);
  1306.     sprintf(opt[i++],"%-27.27s%s","Call-out Days",daystr(phub[num]->days));
  1307.     if(phub[num]->freq) {
  1308.         sprintf(str,"%u times a day",1440/phub[num]->freq);
  1309.         sprintf(opt[i++],"%-27.27s%s","Call-out Frequency",str); }
  1310.     else {
  1311.         sprintf(str,"%2.2d:%2.2d",phub[num]->time/60
  1312.             ,phub[num]->time%60);
  1313.         sprintf(opt[i++],"%-27.27s%s","Call-out Time",str); }
  1314.     opt[i][0]=0;
  1315.     sprintf(str,"%s Network Hub",phub[num]->name);
  1316.     savnum=1;
  1317.     SETHELP(WHERE);
  1318. /*
  1319. PostLink Network Hub Configuration:
  1320.  
  1321. This menu allows you to configure options specific to this network hub.
  1322. */
  1323.     switch(ulist(WIN_ACT|WIN_MID|WIN_SAV,0,0,0,&phub_dflt,0
  1324.         ,str,opt)) {
  1325.         case -1:
  1326.             done=1;
  1327.             break;
  1328.         case 0:
  1329.             SETHELP(WHERE);
  1330. /*
  1331. Network Hub Site Name:
  1332.  
  1333. This is the Site Name of this hub. It is used for only for reference.
  1334. */
  1335.             strcpy(str,phub[num]->name);    /* save */
  1336.             if(!uinput(WIN_MID|WIN_SAV,0,0,"Hub Site Name"
  1337.                 ,phub[num]->name,10,K_UPPER|K_EDIT))
  1338.                 strcpy(phub[num]->name,str);    /* restore */
  1339.             break;
  1340.         case 1:
  1341.             SETHELP(WHERE);
  1342. /*
  1343. Network Hub Call-out Command Line:
  1344.  
  1345. This is the command line to use to initiate a call-out to this network
  1346. hub.
  1347. */
  1348.             uinput(WIN_MID|WIN_SAV,0,0,"Call-out Command"
  1349.                 ,phub[num]->call,50,K_EDIT);
  1350.             break;
  1351.         case 2:
  1352.             sprintf(str,"%u",phub[num]->node);
  1353.             SETHELP(WHERE);
  1354. /*
  1355. Node to Perform Call-out:
  1356.  
  1357. This is the number of the node to perform the call-out for this network
  1358. hub.
  1359. */
  1360.             uinput(WIN_MID|WIN_SAV,0,0
  1361.                 ,"Node to Perform Call-out",str,3,K_EDIT|K_NUMBER);
  1362.             phub[num]->node=atoi(str);
  1363.             break;
  1364.         case 3:
  1365.             j=0;
  1366.             while(1) {
  1367.                 for(i=0;i<7;i++)
  1368.                     sprintf(opt[i],"%s        %s"
  1369.                         ,wday[i],(phub[num]->days&(1<<i)) ? "Yes":"No");
  1370.                 opt[i][0]=0;
  1371.                 savnum=2;
  1372.                 SETHELP(WHERE);
  1373. /*
  1374. Days to Perform Call-out:
  1375.  
  1376. These are the days that a call-out will be performed for this network
  1377. hub.
  1378. */
  1379.                 i=ulist(WIN_MID|WIN_SAV,0,0,0,&j,0
  1380.                     ,"Days to Perform Call-out",opt);
  1381.                 if(i==-1)
  1382.                     break;
  1383.                 phub[num]->days^=(1<<i);
  1384.                 changes=1; }
  1385.             break;
  1386.         case 4:
  1387.             i=1;
  1388.             strcpy(opt[0],"Yes");
  1389.             strcpy(opt[1],"No");
  1390.             opt[2][0]=0;
  1391.             savnum=2;
  1392.             SETHELP(WHERE);
  1393. /*
  1394. Perform Call-out at a Specific Time:
  1395.  
  1396. If you want the system call this network hub at a specific time, set
  1397. this option to Yes. If you want the system to call this hub more than
  1398. once a day at predetermined intervals, set this option to No.
  1399. */
  1400.             i=ulist(WIN_MID|WIN_SAV,0,0,0,&i,0
  1401.                 ,"Perform Call-out at a Specific Time",opt);
  1402.             if(i==0) {
  1403.                 sprintf(str,"%2.2d:%2.2d",phub[num]->time/60
  1404.                     ,phub[num]->time%60);
  1405.                 SETHELP(WHERE);
  1406. /*
  1407. Time to Perform Call-out:
  1408.  
  1409. This is the time (in 24 hour HH:MM format) to perform the call-out to
  1410. this network hub.
  1411. */
  1412.                 if(uinput(WIN_MID|WIN_SAV,0,0
  1413.                     ,"Time to Perform Call-out (HH:MM)"
  1414.                     ,str,5,K_UPPER|K_EDIT)>0) {
  1415.                     phub[num]->freq=0;
  1416.                     phub[num]->time=atoi(str)*60;
  1417.                     if((p=strchr(str,':'))!=NULL)
  1418.                         phub[num]->time+=atoi(p+1); } }
  1419.             else if(i==1) {
  1420.                 sprintf(str,"%u",phub[num]->freq
  1421.                     && phub[num]->freq<=1440 ? 1440/phub[num]->freq : 0);
  1422.                 SETHELP(WHERE);
  1423. /*
  1424. Number of Call-outs Per Day:
  1425.  
  1426. This is the maximum number of times the system will perform a call-out
  1427. per day to this network hub. This value is actually converted by
  1428. Synchronet into minutes between call-outs and when the BBS is idle
  1429. and this number of minutes since the last call-out is reached, it will
  1430. perform a call-out.
  1431. */
  1432.                 if(uinput(WIN_MID|WIN_SAV,0,0
  1433.                     ,"Number of Call-outs Per Day"
  1434.                     ,str,4,K_NUMBER|K_EDIT)>0) {
  1435.                     phub[num]->time=0;
  1436.                     i=atoi(str);
  1437.                     if(i && i<=1440)
  1438.                         phub[num]->freq=1440/i;
  1439.                     else
  1440.                         phub[num]->freq=0; } }
  1441.             break; } }
  1442. }
  1443.  
  1444. char *daystr(char days)
  1445. {
  1446.     static char str[256];
  1447.     int i;
  1448.  
  1449. str[0]=0;
  1450. for(i=0;i<7;i++) {
  1451.     if(days&(1<<i))
  1452.         strcat(str,wday[i]);
  1453.     else
  1454.         strcat(str,"   ");
  1455.     strcat(str," "); }
  1456. return(str);
  1457. }
  1458.