--- sbbs/sbbs2/scfg/scfgnet.c 2018/04/24 16:37:52 1.1 +++ sbbs/sbbs2/scfg/scfgnet.c 2018/04/24 16:39:21 1.1.1.2 @@ -1,1457 +1,1457 @@ -#line 2 "SCFGNET.C" - -/* Developed 1990-1997 by Rob Swindell; PO Box 501, Yorba Linda, CA 92885 */ - -#include "scfg.h" - -char *wday[]={"Sun","Mon","Tue","Wed","Thu","Fri","Sat"}; - -char *daystr(char days); - - -void qhub_edit(int num); -void phub_edit(int num); -char *daystr(char days); -void qhub_sub_edit(uint num); - -/****************************************************************************/ -/* Returns the FidoNet address kept in str as ASCII. */ -/****************************************************************************/ -faddr_t atofaddr(char *str) -{ - char *p; - faddr_t addr; - -addr.zone=addr.net=addr.node=addr.point=0; -if((p=strchr(str,':'))!=NULL) { - addr.zone=atoi(str); - addr.net=atoi(p+1); } -else { - if(total_faddrs) - addr.zone=faddr[0].zone; - else - addr.zone=1; - addr.net=atoi(str); } -if(!addr.zone) /* no such thing as zone 0 */ - addr.zone=1; -if((p=strchr(str,'/'))!=NULL) - addr.node=atoi(p+1); -else { - if(total_faddrs) - addr.net=faddr[0].net; - else - addr.net=1; - addr.node=atoi(str); } -if((p=strchr(str,'.'))!=NULL) - addr.point=atoi(p+1); -return(addr); -} - -/****************************************************************************/ -/* Returns an ASCII string for FidoNet address 'addr' */ -/****************************************************************************/ -char *faddrtoa(faddr_t addr) -{ - static char str[25]; - char point[25]; - -sprintf(str,"%u:%u/%u",addr.zone,addr.net,addr.node); -if(addr.point) { - sprintf(point,".%u",addr.point); - strcat(str,point); } -return(str); -} - - -uint getsub() -{ - static int grp_dflt,sub_dflt,grp_bar,sub_bar; - char str[81]; - int i,j,k; - uint subnum[MAX_OPTS+1]; - -while(1) { - for(i=0;ilname); - opt[i][0]=0; - i=ulist(WIN_SAV|WIN_RHT|WIN_BOT,0,0,45,&grp_dflt,&grp_bar - ,"Message Groups" - ,opt); - if(i==-1) - return(-1); - for(j=k=0;jgrp==i) { - sprintf(opt[k],"%-25s",sub[j]->lname); - subnum[k++]=j; } - opt[k][0]=0; - sprintf(str,"%s Sub-boards",grp[i]->sname); - j=ulist(WIN_RHT|WIN_BOT|WIN_SAV,0,0,45,&sub_dflt,&sub_bar,str,opt); - if(j==-1) - continue; - return(subnum[j]); } - -} - -void net_cfg() -{ - static int net_dflt,qnet_dflt,pnet_dflt,fnet_dflt,inet_dflt - ,qhub_dflt,phub_dflt; - char str[81],done,*p; - int i,j,k,l,m,n; - -while(1) { - i=0; - strcpy(opt[i++],"QWK Packet Networks"); - strcpy(opt[i++],"FidoNet EchoMail and NetMail"); - strcpy(opt[i++],"PostLink Networks"); - strcpy(opt[i++],"Internet NetMail"); - opt[i][0]=0; - SETHELP(WHERE); -/* -Configure Networks: - -This is the network configuration menu. Select the type of network -technology that you want to configure. -*/ - i=ulist(WIN_ORG|WIN_ACT|WIN_CHE,0,0,0,&net_dflt,0,"Networks",opt); - if(i==0) { /* QWK net stuff */ - done=0; - while(!done) { - i=0; - strcpy(opt[i++],"Network Hubs..."); - strcpy(opt[i++],"Default Tagline"); - opt[i][0]=0; - SETHELP(WHERE); -/* -QWK Packet Networks: - -From this menu you can configure the default tagline to use for -outgoing messages on QWK networked sub-boards, or you can select -Network Hubs... to add, delete, or configure QWK hubs that your system -calls to exchange packets with. -*/ - i=ulist(WIN_ACT|WIN_RHT|WIN_BOT|WIN_CHE,0,0,0,&qnet_dflt,0 - ,"QWK Packet Networks",opt); - savnum=0; - switch(i) { - case -1: /* ESC */ - done=1; - break; - case 1: - SETHELP(WHERE); -/* -QWK Network Default Tagline: - -This is the default tagline to use for outgoing messages on QWK -networked sub-boards. This default can be overridden on a per sub-board -basis with the sub-board configuration Network Options.... -*/ - uinput(WIN_MID|WIN_SAV,0,0,nulstr - ,qnet_tagline,63,K_MSG|K_EDIT); - break; - case 0: - while(1) { - for(i=0;iid); - opt[i][0]=0; - i=WIN_ACT|WIN_RHT|WIN_SAV; - if(total_qhubsi;j--) - qhub[j]=qhub[j-1]; - if((qhub[i]=(qhub_t *)MALLOC(sizeof(qhub_t))) - ==NULL) { - errormsg(WHERE,ERR_ALLOC,nulstr - ,sizeof(qhub_t)); - continue; } - memset(qhub[i],0,sizeof(qhub_t)); - strcpy(qhub[i]->id,str); - strcpy(qhub[i]->pack,"%!pkzip %f %s"); - strcpy(qhub[i]->unpack,"%!pkunzip -o %f %g %s"); - strcpy(qhub[i]->call,"%!qnet"); - qhub[i]->node=1; - qhub[i]->days=0xff; /* all days */ - total_qhubs++; - changes=1; - continue; } - if((i&MSK_ON)==MSK_DEL) { - i&=MSK_OFF; - FREE(qhub[i]->mode); - FREE(qhub[i]->conf); - FREE(qhub[i]->sub); - FREE(qhub[i]); - total_qhubs--; - while(ii;j--) - faddr[j]=faddr[j-1]; - - faddr[i]=atofaddr(str); - total_faddrs++; - changes=1; - continue; } - if((i&MSK_ON)==MSK_DEL) { - i&=MSK_OFF; - total_faddrs--; - while(iname); - opt[i][0]=0; - i=WIN_ACT|WIN_RHT|WIN_SAV; - if(total_phubsi;j--) - phub[j]=phub[j-1]; - - if((phub[i]=(phub_t *)MALLOC(sizeof(phub_t))) - ==NULL) { - errormsg(WHERE,ERR_ALLOC,nulstr - ,sizeof(phub_t)); - continue; } - memset(phub[i],0,sizeof(phub_t)); - strcpy(phub[i]->name,str); - strcpy(phub[i]->call,"%!pnet"); - phub[i]->node=1; - phub[i]->days=0xff; /* all days */ - total_phubs++; - changes=1; - continue; } - if((i&MSK_ON)==MSK_DEL) { - i&=MSK_OFF; - FREE(phub[i]); - total_phubs--; - while(iid); - sprintf(opt[i++],"%-27.27s%.40s","Pack Command Line",qhub[num]->pack); - sprintf(opt[i++],"%-27.27s%.40s","Unpack Command Line",qhub[num]->unpack); - sprintf(opt[i++],"%-27.27s%.40s","Call-out Command Line",qhub[num]->call); - sprintf(opt[i++],"%-27.27s%u","Call-out Node",qhub[num]->node); - sprintf(opt[i++],"%-27.27s%s","Call-out Days",daystr(qhub[num]->days)); - if(qhub[num]->freq) { - sprintf(str,"%u times a day",1440/qhub[num]->freq); - sprintf(opt[i++],"%-27.27s%s","Call-out Frequency",str); } - else { - sprintf(str,"%2.2d:%2.2d",qhub[num]->time/60,qhub[num]->time%60); - sprintf(opt[i++],"%-27.27s%s","Call-out Time",str); } - strcpy(opt[i++],"Networked Sub-boards..."); - opt[i][0]=0; - sprintf(str,"%s Network Hub",qhub[num]->id); - savnum=1; - SETHELP(WHERE); -/* -QWK Network Hub Configuration: - -This menu allows you to configure options specific to this QWK network -hub. -*/ - switch(ulist(WIN_ACT|WIN_MID|WIN_SAV,0,0,0,&qhub_dflt,0 - ,str,opt)) { - case -1: - done=1; - break; - case 0: - SETHELP(WHERE); -/* -QWK Network Hub System ID: - -This is the QWK System ID of this hub. It is used for incoming and -outgoing network packets and must be accurate. -*/ - strcpy(str,qhub[num]->id); /* save */ - if(!uinput(WIN_MID|WIN_SAV,0,0,"QWK Network Hub System ID" - ,qhub[num]->id,8,K_UPPER|K_EDIT)) - strcpy(qhub[num]->id,str); - break; - case 1: - SETHELP(WHERE); -/* -REP Packet Creation Command: - -This is the command line to use to create (compress) REP packets for -this QWK network hub. -*/ - uinput(WIN_MID|WIN_SAV,0,0,"Packet Creation" - ,qhub[num]->pack,50,K_EDIT); - break; - case 2: - SETHELP(WHERE); -/* -QWK Packet Extraction Command: - -This is the command line to use to extract (decompress) QWK packets from -this QWK network hub. -*/ - uinput(WIN_MID|WIN_SAV,0,0,"Packet Extraction" - ,qhub[num]->unpack,50,K_EDIT); - break; - case 3: - SETHELP(WHERE); -/* -QWK Network Hub Call-out Command Line: - -This is the command line to use to initiate a call-out to this QWK -network hub. -*/ - uinput(WIN_MID|WIN_SAV,0,0,"Call-out Command" - ,qhub[num]->call,50,K_EDIT); - break; - case 4: - sprintf(str,"%u",qhub[num]->node); - SETHELP(WHERE); -/* -Node to Perform Call-out: - -This is the number of the node to perform the call-out for this QWK -network hub. -*/ - uinput(WIN_MID|WIN_SAV,0,0 - ,"Node to Perform Call-out",str,3,K_EDIT|K_NUMBER); - qhub[num]->node=atoi(str); - break; - case 5: - j=0; - while(1) { - for(i=0;i<7;i++) - sprintf(opt[i],"%s %s" - ,wday[i],(qhub[num]->days&(1<days^=(1<time/60 - ,qhub[num]->time%60); - SETHELP(WHERE); -/* -Time to Perform Call-out: - -This is the time (in 24 hour HH:MM format) to perform the call-out to -this QWK network hub. -*/ - if(uinput(WIN_MID|WIN_SAV,0,0 - ,"Time to Perform Call-out (HH:MM)" - ,str,5,K_UPPER|K_EDIT)>0) { - qhub[num]->freq=0; - qhub[num]->time=atoi(str)*60; - if((p=strchr(str,':'))!=NULL) - qhub[num]->time+=atoi(p+1); } } - else if(i==1) { - sprintf(str,"%u",qhub[num]->freq - && qhub[num]->freq<=1440 ? 1440/qhub[num]->freq : 0); - SETHELP(WHERE); -/* -Number of Call-outs Per Day: - -This is the maximum number of times the system will perform a call-out -per day to this QWK network hub. This value is actually converted by -Synchronet into minutes between call-outs and when the BBS is idle -and this number of minutes since the last call-out is reached, it will -perform a call-out. -*/ - if(uinput(WIN_MID|WIN_SAV,0,0 - ,"Number of Call-outs Per Day" - ,str,4,K_NUMBER|K_EDIT)>0) { - qhub[num]->time=0; - i=atoi(str); - if(i && i<=1440) - qhub[num]->freq=1440/i; - else - qhub[num]->freq=0; } } - break; - case 7: - qhub_sub_edit(num); - break; } } -} - -void qhub_sub_edit(uint num) -{ - char str[256]; - int i,j,k,l,m,n,bar=0; - -k=0; -while(1) { - for(j=0;jsubs;j++) - sprintf(opt[j],"%-*.*s %-*.*s" - ,LEN_GSNAME,LEN_GSNAME - ,grp[sub[qhub[num]->sub[j]]->grp]->sname - ,LEN_SSNAME,LEN_SSNAME - ,sub[qhub[num]->sub[j]]->sname); - opt[j][0]=0; - savnum=2; - j=WIN_BOT|WIN_SAV|WIN_ACT; - if(qhub[num]->subssubs) - j|=WIN_DEL; - SETHELP(WHERE); -/* -QWK Networked Sub-boards: - -This is a list of the sub-boards that are networked with this QWK -network hub. - -To add a sub-board, select the desired location and hit  INS . - -To remove a sub-board, select it and hit  DEL . - -To configure a sub-board for this QWK network hub, select it and hit - ENTER . -*/ - j=ulist(j,0,0,0,&k,&bar - ,"Networked Sub-boards",opt); - if(j==-1) - break; - if((j&MSK_ON)==MSK_INS) { - j&=MSK_OFF; - savnum=3; - if((l=getsub())==-1) - continue; - savnum=3; - SETHELP(WHERE); -/* -Conference Number on Hub: - -This is the number of the conference on the QWK network hub, that this -sub-board is networked with. On Synchronet systems, this number is -derived by multiplying the group number by 10 and adding the sub-board -number. For example, group 2, sub-board 3, is conference number 203. - -It is important to understand that this is NOT the conference number of -this sub-board on your system. It is the number of the conference this -sub-board is networked with on this QWK network hub. -*/ - if(uinput(WIN_MID|WIN_SAV,0,0 - ,"Conference Number on Hub" - ,str,5,K_NUMBER)<1) - continue; - strcpy(opt[0],"Strip out"); - strcpy(opt[1],"Leave in"); - strcpy(opt[2],"Expand to ANSI"); - opt[3][0]=0; - m=0; - SETHELP(WHERE); -/* -Ctrl-A Codes: - -You are being prompted for the method of handling Ctrl-A attribute codes -generated by Synchronet. If this QWK network hub is a Synchronet BBS, -set this option to Leave in. If the QWK network hub is not a Synchronet -BBS, but allows ANSI escape sequences in messages, set this option to -Expand to ANSI. If the QWK network hub is not a Synchronet BBS and does -not support ANSI escape sequences in messages (or you're not sure), set -this option to Strip out. -*/ - if((m=ulist(WIN_MID|WIN_SAV,0,0,0,&m,0 - ,"Ctrl-A Codes",opt))==-1) - continue; - if((qhub[num]->sub=(ushort *)REALLOC(qhub[num]->sub - ,sizeof(ushort *)*(qhub[num]->subs+1)))==NULL - || (qhub[num]->conf=(ushort *)REALLOC(qhub[num]->conf - ,sizeof(ushort *)*(qhub[num]->subs+1)))==NULL - || (qhub[num]->mode=(uchar *)REALLOC(qhub[num]->mode - ,sizeof(uchar *)*(qhub[num]->subs+1)))==NULL) { - errormsg(WHERE,ERR_ALLOC,nulstr,qhub[num]->subs+1); - continue; } - if(qhub[num]->subs) /* insert */ - for(n=qhub[num]->subs;n>j;n--) { - qhub[num]->sub[n]=qhub[num]->sub[n-1]; - qhub[num]->conf[n]=qhub[num]->conf[n-1]; - qhub[num]->mode[n]=qhub[num]->mode[n-1]; } - if(!m) - qhub[num]->mode[j]=A_STRIP; - else if(m==1) - qhub[num]->mode[j]=A_LEAVE; - else - qhub[num]->mode[j]=A_EXPAND; - qhub[num]->sub[j]=l; - qhub[num]->conf[j]=atoi(str); - qhub[num]->subs++; - changes=1; - continue; } - if((j&MSK_ON)==MSK_DEL) { - j&=MSK_OFF; - qhub[num]->subs--; - while(jsubs) { - qhub[num]->sub[j]=qhub[num]->sub[j+1]; - qhub[num]->mode[j]=qhub[num]->mode[j+1]; - qhub[num]->conf[j]=qhub[num]->conf[j+1]; - j++; } - changes=1; - continue; } - l=0; - while(1) { - n=0; - sprintf(opt[n++],"%-22.22s%.*s %.*s" - ,"Sub-board" - ,LEN_GSNAME - ,grp[sub[qhub[num]->sub[j]]->grp]->sname - ,LEN_SSNAME - ,sub[qhub[num]->sub[j]]->sname); - sprintf(opt[n++],"%-22.22s%u" - ,"Conference Number",qhub[num]->conf[j]); - sprintf(opt[n++],"%-22.22s%s" - ,"Ctrl-A Codes",qhub[num]->mode[j]==A_STRIP ? - "Strip out" : qhub[num]->mode[j]==A_LEAVE ? - "Leave in" : "Expand to ANSI"); - opt[n][0]=0; - savnum=3; - SETHELP(WHERE); -/* -QWK Netted Sub-board: - -You are configuring the options for this sub-board for this QWK network -hub. -*/ - l=ulist(WIN_MID|WIN_SAV|WIN_ACT,0,0, - 22+LEN_GSNAME+LEN_SSNAME,&l,0 - ,"Netted Sub-board",opt); - if(l==-1) - break; - if(!l) { - savnum=4; - m=getsub(); - if(m!=-1) { - qhub[num]->sub[j]=m; - changes=1; } } - else if(l==1) { - savnum=4; - SETHELP(WHERE); -/* -Conference Number on Hub: - -This is the number of the conference on the QWK network hub, that this -sub-board is networked with. On Synchronet systems, this number is -derived by multiplying the group number by 10 and adding the sub-board -number. For example, group 2, sub-board 3, is conference number 203. - -It is important to understand that this is NOT the conference number of -this sub-board on your system. It is the number of the conference this -sub-board is networked with on this QWK network hub. -*/ - if(uinput(WIN_MID|WIN_SAV,0,0 - ,"Conference Number on Hub" - ,str,5,K_NUMBER)>0) - qhub[num]->conf[j]=atoi(str); } - else if(l==2) { - strcpy(opt[0],"Strip out"); - strcpy(opt[1],"Leave in"); - strcpy(opt[2],"Expand to ANSI"); - opt[3][0]=0; - m=0; - savnum=4; - SETHELP(WHERE); -/* -Ctrl-A Codes: - -You are being prompted for the method of handling Ctrl-A attribute codes -generated by Synchronet. If this QWK network hub is a Synchronet BBS, -set this option to Leave in. If the QWK network hub is not a Synchronet -BBS, but allows ANSI escape sequences in messages, set this option to -Expand to ANSI. If the QWK network hub is not a Synchronet BBS and does -not support ANSI escape sequences in messages (or you're not sure), set -this option to Strip out. -*/ - m=ulist(WIN_MID|WIN_SAV,0,0,0,&m,0 - ,"Ctrl-A Codes",opt); - changes=1; - if(!m) - qhub[num]->mode[j]=A_STRIP; - else if(m==1) - qhub[num]->mode[j]=A_LEAVE; - else if(m==2) - qhub[num]->mode[j]=A_EXPAND; } } } -} - -void phub_edit(int num) -{ - static int phub_dflt; - char *p,done=0,str[256]; - int i,j,k,n; - -while(!done) { - i=0; - sprintf(opt[i++],"%-27.27s%s","Hub Site Name",phub[num]->name); - sprintf(opt[i++],"%-27.27s%.40s","Call-out Command Line",phub[num]->call); - sprintf(opt[i++],"%-27.27s%u","Call-out Node",phub[num]->node); - sprintf(opt[i++],"%-27.27s%s","Call-out Days",daystr(phub[num]->days)); - if(phub[num]->freq) { - sprintf(str,"%u times a day",1440/phub[num]->freq); - sprintf(opt[i++],"%-27.27s%s","Call-out Frequency",str); } - else { - sprintf(str,"%2.2d:%2.2d",phub[num]->time/60 - ,phub[num]->time%60); - sprintf(opt[i++],"%-27.27s%s","Call-out Time",str); } - opt[i][0]=0; - sprintf(str,"%s Network Hub",phub[num]->name); - savnum=1; - SETHELP(WHERE); -/* -PostLink Network Hub Configuration: - -This menu allows you to configure options specific to this network hub. -*/ - switch(ulist(WIN_ACT|WIN_MID|WIN_SAV,0,0,0,&phub_dflt,0 - ,str,opt)) { - case -1: - done=1; - break; - case 0: - SETHELP(WHERE); -/* -Network Hub Site Name: - -This is the Site Name of this hub. It is used for only for reference. -*/ - strcpy(str,phub[num]->name); /* save */ - if(!uinput(WIN_MID|WIN_SAV,0,0,"Hub Site Name" - ,phub[num]->name,10,K_UPPER|K_EDIT)) - strcpy(phub[num]->name,str); /* restore */ - break; - case 1: - SETHELP(WHERE); -/* -Network Hub Call-out Command Line: - -This is the command line to use to initiate a call-out to this network -hub. -*/ - uinput(WIN_MID|WIN_SAV,0,0,"Call-out Command" - ,phub[num]->call,50,K_EDIT); - break; - case 2: - sprintf(str,"%u",phub[num]->node); - SETHELP(WHERE); -/* -Node to Perform Call-out: - -This is the number of the node to perform the call-out for this network -hub. -*/ - uinput(WIN_MID|WIN_SAV,0,0 - ,"Node to Perform Call-out",str,3,K_EDIT|K_NUMBER); - phub[num]->node=atoi(str); - break; - case 3: - j=0; - while(1) { - for(i=0;i<7;i++) - sprintf(opt[i],"%s %s" - ,wday[i],(phub[num]->days&(1<days^=(1<time/60 - ,phub[num]->time%60); - SETHELP(WHERE); -/* -Time to Perform Call-out: - -This is the time (in 24 hour HH:MM format) to perform the call-out to -this network hub. -*/ - if(uinput(WIN_MID|WIN_SAV,0,0 - ,"Time to Perform Call-out (HH:MM)" - ,str,5,K_UPPER|K_EDIT)>0) { - phub[num]->freq=0; - phub[num]->time=atoi(str)*60; - if((p=strchr(str,':'))!=NULL) - phub[num]->time+=atoi(p+1); } } - else if(i==1) { - sprintf(str,"%u",phub[num]->freq - && phub[num]->freq<=1440 ? 1440/phub[num]->freq : 0); - SETHELP(WHERE); -/* -Number of Call-outs Per Day: - -This is the maximum number of times the system will perform a call-out -per day to this network hub. This value is actually converted by -Synchronet into minutes between call-outs and when the BBS is idle -and this number of minutes since the last call-out is reached, it will -perform a call-out. -*/ - if(uinput(WIN_MID|WIN_SAV,0,0 - ,"Number of Call-outs Per Day" - ,str,4,K_NUMBER|K_EDIT)>0) { - phub[num]->time=0; - i=atoi(str); - if(i && i<=1440) - phub[num]->freq=1440/i; - else - phub[num]->freq=0; } } - break; } } -} - -char *daystr(char days) -{ - static char str[256]; - int i; - -str[0]=0; -for(i=0;i<7;i++) { - if(days&(1<lname); + opt[i][0]=0; + i=ulist(WIN_SAV|WIN_RHT|WIN_BOT,0,0,45,&grp_dflt,&grp_bar + ,"Message Groups" + ,opt); + if(i==-1) + return(-1); + for(j=k=0;jgrp==i) { + sprintf(opt[k],"%-25s",sub[j]->lname); + subnum[k++]=j; } + opt[k][0]=0; + sprintf(str,"%s Sub-boards",grp[i]->sname); + j=ulist(WIN_RHT|WIN_BOT|WIN_SAV,0,0,45,&sub_dflt,&sub_bar,str,opt); + if(j==-1) + continue; + return(subnum[j]); } + +} + +void net_cfg() +{ + static int net_dflt,qnet_dflt,pnet_dflt,fnet_dflt,inet_dflt + ,qhub_dflt,phub_dflt; + char str[81],done,*p; + int i,j,k,l,m,n; + +while(1) { + i=0; + strcpy(opt[i++],"QWK Packet Networks"); + strcpy(opt[i++],"FidoNet EchoMail and NetMail"); + strcpy(opt[i++],"PostLink Networks"); + strcpy(opt[i++],"Internet NetMail"); + opt[i][0]=0; + SETHELP(WHERE); +/* +Configure Networks: + +This is the network configuration menu. Select the type of network +technology that you want to configure. +*/ + i=ulist(WIN_ORG|WIN_ACT|WIN_CHE,0,0,0,&net_dflt,0,"Networks",opt); + if(i==0) { /* QWK net stuff */ + done=0; + while(!done) { + i=0; + strcpy(opt[i++],"Network Hubs..."); + strcpy(opt[i++],"Default Tagline"); + opt[i][0]=0; + SETHELP(WHERE); +/* +QWK Packet Networks: + +From this menu you can configure the default tagline to use for +outgoing messages on QWK networked sub-boards, or you can select +Network Hubs... to add, delete, or configure QWK hubs that your system +calls to exchange packets with. +*/ + i=ulist(WIN_ACT|WIN_RHT|WIN_BOT|WIN_CHE,0,0,0,&qnet_dflt,0 + ,"QWK Packet Networks",opt); + savnum=0; + switch(i) { + case -1: /* ESC */ + done=1; + break; + case 1: + SETHELP(WHERE); +/* +QWK Network Default Tagline: + +This is the default tagline to use for outgoing messages on QWK +networked sub-boards. This default can be overridden on a per sub-board +basis with the sub-board configuration Network Options.... +*/ + uinput(WIN_MID|WIN_SAV,0,0,nulstr + ,qnet_tagline,63,K_MSG|K_EDIT); + break; + case 0: + while(1) { + for(i=0;iid); + opt[i][0]=0; + i=WIN_ACT|WIN_RHT|WIN_SAV; + if(total_qhubsi;j--) + qhub[j]=qhub[j-1]; + if((qhub[i]=(qhub_t *)MALLOC(sizeof(qhub_t))) + ==NULL) { + errormsg(WHERE,ERR_ALLOC,nulstr + ,sizeof(qhub_t)); + continue; } + memset(qhub[i],0,sizeof(qhub_t)); + strcpy(qhub[i]->id,str); + strcpy(qhub[i]->pack,"%!pkzip %f %s"); + strcpy(qhub[i]->unpack,"%!pkunzip -o %f %g %s"); + strcpy(qhub[i]->call,"%!qnet"); + qhub[i]->node=1; + qhub[i]->days=0xff; /* all days */ + total_qhubs++; + changes=1; + continue; } + if((i&MSK_ON)==MSK_DEL) { + i&=MSK_OFF; + FREE(qhub[i]->mode); + FREE(qhub[i]->conf); + FREE(qhub[i]->sub); + FREE(qhub[i]); + total_qhubs--; + while(ii;j--) + faddr[j]=faddr[j-1]; + + faddr[i]=atofaddr(str); + total_faddrs++; + changes=1; + continue; } + if((i&MSK_ON)==MSK_DEL) { + i&=MSK_OFF; + total_faddrs--; + while(iname); + opt[i][0]=0; + i=WIN_ACT|WIN_RHT|WIN_SAV; + if(total_phubsi;j--) + phub[j]=phub[j-1]; + + if((phub[i]=(phub_t *)MALLOC(sizeof(phub_t))) + ==NULL) { + errormsg(WHERE,ERR_ALLOC,nulstr + ,sizeof(phub_t)); + continue; } + memset(phub[i],0,sizeof(phub_t)); + strcpy(phub[i]->name,str); + strcpy(phub[i]->call,"%!pnet"); + phub[i]->node=1; + phub[i]->days=0xff; /* all days */ + total_phubs++; + changes=1; + continue; } + if((i&MSK_ON)==MSK_DEL) { + i&=MSK_OFF; + FREE(phub[i]); + total_phubs--; + while(iid); + sprintf(opt[i++],"%-27.27s%.40s","Pack Command Line",qhub[num]->pack); + sprintf(opt[i++],"%-27.27s%.40s","Unpack Command Line",qhub[num]->unpack); + sprintf(opt[i++],"%-27.27s%.40s","Call-out Command Line",qhub[num]->call); + sprintf(opt[i++],"%-27.27s%u","Call-out Node",qhub[num]->node); + sprintf(opt[i++],"%-27.27s%s","Call-out Days",daystr(qhub[num]->days)); + if(qhub[num]->freq) { + sprintf(str,"%u times a day",1440/qhub[num]->freq); + sprintf(opt[i++],"%-27.27s%s","Call-out Frequency",str); } + else { + sprintf(str,"%2.2d:%2.2d",qhub[num]->time/60,qhub[num]->time%60); + sprintf(opt[i++],"%-27.27s%s","Call-out Time",str); } + strcpy(opt[i++],"Networked Sub-boards..."); + opt[i][0]=0; + sprintf(str,"%s Network Hub",qhub[num]->id); + savnum=1; + SETHELP(WHERE); +/* +QWK Network Hub Configuration: + +This menu allows you to configure options specific to this QWK network +hub. +*/ + switch(ulist(WIN_ACT|WIN_MID|WIN_SAV,0,0,0,&qhub_dflt,0 + ,str,opt)) { + case -1: + done=1; + break; + case 0: + SETHELP(WHERE); +/* +QWK Network Hub System ID: + +This is the QWK System ID of this hub. It is used for incoming and +outgoing network packets and must be accurate. +*/ + strcpy(str,qhub[num]->id); /* save */ + if(!uinput(WIN_MID|WIN_SAV,0,0,"QWK Network Hub System ID" + ,qhub[num]->id,8,K_UPPER|K_EDIT)) + strcpy(qhub[num]->id,str); + break; + case 1: + SETHELP(WHERE); +/* +REP Packet Creation Command: + +This is the command line to use to create (compress) REP packets for +this QWK network hub. +*/ + uinput(WIN_MID|WIN_SAV,0,0,"Packet Creation" + ,qhub[num]->pack,50,K_EDIT); + break; + case 2: + SETHELP(WHERE); +/* +QWK Packet Extraction Command: + +This is the command line to use to extract (decompress) QWK packets from +this QWK network hub. +*/ + uinput(WIN_MID|WIN_SAV,0,0,"Packet Extraction" + ,qhub[num]->unpack,50,K_EDIT); + break; + case 3: + SETHELP(WHERE); +/* +QWK Network Hub Call-out Command Line: + +This is the command line to use to initiate a call-out to this QWK +network hub. +*/ + uinput(WIN_MID|WIN_SAV,0,0,"Call-out Command" + ,qhub[num]->call,50,K_EDIT); + break; + case 4: + sprintf(str,"%u",qhub[num]->node); + SETHELP(WHERE); +/* +Node to Perform Call-out: + +This is the number of the node to perform the call-out for this QWK +network hub. +*/ + uinput(WIN_MID|WIN_SAV,0,0 + ,"Node to Perform Call-out",str,3,K_EDIT|K_NUMBER); + qhub[num]->node=atoi(str); + break; + case 5: + j=0; + while(1) { + for(i=0;i<7;i++) + sprintf(opt[i],"%s %s" + ,wday[i],(qhub[num]->days&(1<days^=(1<time/60 + ,qhub[num]->time%60); + SETHELP(WHERE); +/* +Time to Perform Call-out: + +This is the time (in 24 hour HH:MM format) to perform the call-out to +this QWK network hub. +*/ + if(uinput(WIN_MID|WIN_SAV,0,0 + ,"Time to Perform Call-out (HH:MM)" + ,str,5,K_UPPER|K_EDIT)>0) { + qhub[num]->freq=0; + qhub[num]->time=atoi(str)*60; + if((p=strchr(str,':'))!=NULL) + qhub[num]->time+=atoi(p+1); } } + else if(i==1) { + sprintf(str,"%u",qhub[num]->freq + && qhub[num]->freq<=1440 ? 1440/qhub[num]->freq : 0); + SETHELP(WHERE); +/* +Number of Call-outs Per Day: + +This is the maximum number of times the system will perform a call-out +per day to this QWK network hub. This value is actually converted by +Synchronet into minutes between call-outs and when the BBS is idle +and this number of minutes since the last call-out is reached, it will +perform a call-out. +*/ + if(uinput(WIN_MID|WIN_SAV,0,0 + ,"Number of Call-outs Per Day" + ,str,4,K_NUMBER|K_EDIT)>0) { + qhub[num]->time=0; + i=atoi(str); + if(i && i<=1440) + qhub[num]->freq=1440/i; + else + qhub[num]->freq=0; } } + break; + case 7: + qhub_sub_edit(num); + break; } } +} + +void qhub_sub_edit(uint num) +{ + char str[256]; + int i,j,k,l,m,n,bar=0; + +k=0; +while(1) { + for(j=0;jsubs;j++) + sprintf(opt[j],"%-*.*s %-*.*s" + ,LEN_GSNAME,LEN_GSNAME + ,grp[sub[qhub[num]->sub[j]]->grp]->sname + ,LEN_SSNAME,LEN_SSNAME + ,sub[qhub[num]->sub[j]]->sname); + opt[j][0]=0; + savnum=2; + j=WIN_BOT|WIN_SAV|WIN_ACT; + if(qhub[num]->subssubs) + j|=WIN_DEL; + SETHELP(WHERE); +/* +QWK Networked Sub-boards: + +This is a list of the sub-boards that are networked with this QWK +network hub. + +To add a sub-board, select the desired location and hit  INS . + +To remove a sub-board, select it and hit  DEL . + +To configure a sub-board for this QWK network hub, select it and hit + ENTER . +*/ + j=ulist(j,0,0,0,&k,&bar + ,"Networked Sub-boards",opt); + if(j==-1) + break; + if((j&MSK_ON)==MSK_INS) { + j&=MSK_OFF; + savnum=3; + if((l=getsub())==-1) + continue; + savnum=3; + SETHELP(WHERE); +/* +Conference Number on Hub: + +This is the number of the conference on the QWK network hub, that this +sub-board is networked with. On Synchronet systems, this number is +derived by multiplying the group number by 10 and adding the sub-board +number. For example, group 2, sub-board 3, is conference number 203. + +It is important to understand that this is NOT the conference number of +this sub-board on your system. It is the number of the conference this +sub-board is networked with on this QWK network hub. +*/ + if(uinput(WIN_MID|WIN_SAV,0,0 + ,"Conference Number on Hub" + ,str,5,K_NUMBER)<1) + continue; + strcpy(opt[0],"Strip out"); + strcpy(opt[1],"Leave in"); + strcpy(opt[2],"Expand to ANSI"); + opt[3][0]=0; + m=0; + SETHELP(WHERE); +/* +Ctrl-A Codes: + +You are being prompted for the method of handling Ctrl-A attribute codes +generated by Synchronet. If this QWK network hub is a Synchronet BBS, +set this option to Leave in. If the QWK network hub is not a Synchronet +BBS, but allows ANSI escape sequences in messages, set this option to +Expand to ANSI. If the QWK network hub is not a Synchronet BBS and does +not support ANSI escape sequences in messages (or you're not sure), set +this option to Strip out. +*/ + if((m=ulist(WIN_MID|WIN_SAV,0,0,0,&m,0 + ,"Ctrl-A Codes",opt))==-1) + continue; + if((qhub[num]->sub=(ushort *)REALLOC(qhub[num]->sub + ,sizeof(ushort *)*(qhub[num]->subs+1)))==NULL + || (qhub[num]->conf=(ushort *)REALLOC(qhub[num]->conf + ,sizeof(ushort *)*(qhub[num]->subs+1)))==NULL + || (qhub[num]->mode=(uchar *)REALLOC(qhub[num]->mode + ,sizeof(uchar *)*(qhub[num]->subs+1)))==NULL) { + errormsg(WHERE,ERR_ALLOC,nulstr,qhub[num]->subs+1); + continue; } + if(qhub[num]->subs) /* insert */ + for(n=qhub[num]->subs;n>j;n--) { + qhub[num]->sub[n]=qhub[num]->sub[n-1]; + qhub[num]->conf[n]=qhub[num]->conf[n-1]; + qhub[num]->mode[n]=qhub[num]->mode[n-1]; } + if(!m) + qhub[num]->mode[j]=A_STRIP; + else if(m==1) + qhub[num]->mode[j]=A_LEAVE; + else + qhub[num]->mode[j]=A_EXPAND; + qhub[num]->sub[j]=l; + qhub[num]->conf[j]=atoi(str); + qhub[num]->subs++; + changes=1; + continue; } + if((j&MSK_ON)==MSK_DEL) { + j&=MSK_OFF; + qhub[num]->subs--; + while(jsubs) { + qhub[num]->sub[j]=qhub[num]->sub[j+1]; + qhub[num]->mode[j]=qhub[num]->mode[j+1]; + qhub[num]->conf[j]=qhub[num]->conf[j+1]; + j++; } + changes=1; + continue; } + l=0; + while(1) { + n=0; + sprintf(opt[n++],"%-22.22s%.*s %.*s" + ,"Sub-board" + ,LEN_GSNAME + ,grp[sub[qhub[num]->sub[j]]->grp]->sname + ,LEN_SSNAME + ,sub[qhub[num]->sub[j]]->sname); + sprintf(opt[n++],"%-22.22s%u" + ,"Conference Number",qhub[num]->conf[j]); + sprintf(opt[n++],"%-22.22s%s" + ,"Ctrl-A Codes",qhub[num]->mode[j]==A_STRIP ? + "Strip out" : qhub[num]->mode[j]==A_LEAVE ? + "Leave in" : "Expand to ANSI"); + opt[n][0]=0; + savnum=3; + SETHELP(WHERE); +/* +QWK Netted Sub-board: + +You are configuring the options for this sub-board for this QWK network +hub. +*/ + l=ulist(WIN_MID|WIN_SAV|WIN_ACT,0,0, + 22+LEN_GSNAME+LEN_SSNAME,&l,0 + ,"Netted Sub-board",opt); + if(l==-1) + break; + if(!l) { + savnum=4; + m=getsub(); + if(m!=-1) { + qhub[num]->sub[j]=m; + changes=1; } } + else if(l==1) { + savnum=4; + SETHELP(WHERE); +/* +Conference Number on Hub: + +This is the number of the conference on the QWK network hub, that this +sub-board is networked with. On Synchronet systems, this number is +derived by multiplying the group number by 10 and adding the sub-board +number. For example, group 2, sub-board 3, is conference number 203. + +It is important to understand that this is NOT the conference number of +this sub-board on your system. It is the number of the conference this +sub-board is networked with on this QWK network hub. +*/ + if(uinput(WIN_MID|WIN_SAV,0,0 + ,"Conference Number on Hub" + ,str,5,K_NUMBER)>0) + qhub[num]->conf[j]=atoi(str); } + else if(l==2) { + strcpy(opt[0],"Strip out"); + strcpy(opt[1],"Leave in"); + strcpy(opt[2],"Expand to ANSI"); + opt[3][0]=0; + m=0; + savnum=4; + SETHELP(WHERE); +/* +Ctrl-A Codes: + +You are being prompted for the method of handling Ctrl-A attribute codes +generated by Synchronet. If this QWK network hub is a Synchronet BBS, +set this option to Leave in. If the QWK network hub is not a Synchronet +BBS, but allows ANSI escape sequences in messages, set this option to +Expand to ANSI. If the QWK network hub is not a Synchronet BBS and does +not support ANSI escape sequences in messages (or you're not sure), set +this option to Strip out. +*/ + m=ulist(WIN_MID|WIN_SAV,0,0,0,&m,0 + ,"Ctrl-A Codes",opt); + changes=1; + if(!m) + qhub[num]->mode[j]=A_STRIP; + else if(m==1) + qhub[num]->mode[j]=A_LEAVE; + else if(m==2) + qhub[num]->mode[j]=A_EXPAND; } } } +} + +void phub_edit(int num) +{ + static int phub_dflt; + char *p,done=0,str[256]; + int i,j,k,n; + +while(!done) { + i=0; + sprintf(opt[i++],"%-27.27s%s","Hub Site Name",phub[num]->name); + sprintf(opt[i++],"%-27.27s%.40s","Call-out Command Line",phub[num]->call); + sprintf(opt[i++],"%-27.27s%u","Call-out Node",phub[num]->node); + sprintf(opt[i++],"%-27.27s%s","Call-out Days",daystr(phub[num]->days)); + if(phub[num]->freq) { + sprintf(str,"%u times a day",1440/phub[num]->freq); + sprintf(opt[i++],"%-27.27s%s","Call-out Frequency",str); } + else { + sprintf(str,"%2.2d:%2.2d",phub[num]->time/60 + ,phub[num]->time%60); + sprintf(opt[i++],"%-27.27s%s","Call-out Time",str); } + opt[i][0]=0; + sprintf(str,"%s Network Hub",phub[num]->name); + savnum=1; + SETHELP(WHERE); +/* +PostLink Network Hub Configuration: + +This menu allows you to configure options specific to this network hub. +*/ + switch(ulist(WIN_ACT|WIN_MID|WIN_SAV,0,0,0,&phub_dflt,0 + ,str,opt)) { + case -1: + done=1; + break; + case 0: + SETHELP(WHERE); +/* +Network Hub Site Name: + +This is the Site Name of this hub. It is used for only for reference. +*/ + strcpy(str,phub[num]->name); /* save */ + if(!uinput(WIN_MID|WIN_SAV,0,0,"Hub Site Name" + ,phub[num]->name,10,K_UPPER|K_EDIT)) + strcpy(phub[num]->name,str); /* restore */ + break; + case 1: + SETHELP(WHERE); +/* +Network Hub Call-out Command Line: + +This is the command line to use to initiate a call-out to this network +hub. +*/ + uinput(WIN_MID|WIN_SAV,0,0,"Call-out Command" + ,phub[num]->call,50,K_EDIT); + break; + case 2: + sprintf(str,"%u",phub[num]->node); + SETHELP(WHERE); +/* +Node to Perform Call-out: + +This is the number of the node to perform the call-out for this network +hub. +*/ + uinput(WIN_MID|WIN_SAV,0,0 + ,"Node to Perform Call-out",str,3,K_EDIT|K_NUMBER); + phub[num]->node=atoi(str); + break; + case 3: + j=0; + while(1) { + for(i=0;i<7;i++) + sprintf(opt[i],"%s %s" + ,wday[i],(phub[num]->days&(1<days^=(1<time/60 + ,phub[num]->time%60); + SETHELP(WHERE); +/* +Time to Perform Call-out: + +This is the time (in 24 hour HH:MM format) to perform the call-out to +this network hub. +*/ + if(uinput(WIN_MID|WIN_SAV,0,0 + ,"Time to Perform Call-out (HH:MM)" + ,str,5,K_UPPER|K_EDIT)>0) { + phub[num]->freq=0; + phub[num]->time=atoi(str)*60; + if((p=strchr(str,':'))!=NULL) + phub[num]->time+=atoi(p+1); } } + else if(i==1) { + sprintf(str,"%u",phub[num]->freq + && phub[num]->freq<=1440 ? 1440/phub[num]->freq : 0); + SETHELP(WHERE); +/* +Number of Call-outs Per Day: + +This is the maximum number of times the system will perform a call-out +per day to this network hub. This value is actually converted by +Synchronet into minutes between call-outs and when the BBS is idle +and this number of minutes since the last call-out is reached, it will +perform a call-out. +*/ + if(uinput(WIN_MID|WIN_SAV,0,0 + ,"Number of Call-outs Per Day" + ,str,4,K_NUMBER|K_EDIT)>0) { + phub[num]->time=0; + i=atoi(str); + if(i && i<=1440) + phub[num]->freq=1440/i; + else + phub[num]->freq=0; } } + break; } } +} + +char *daystr(char days) +{ + static char str[256]; + int i; + +str[0]=0; +for(i=0;i<7;i++) { + if(days&(1<