Skip to content
Snippets Groups Projects
echocfg.c 89.1 KiB
Newer Older
rswindell's avatar
rswindell committed
							continue;
						for(u=i;u<cfg.arcdefs;u++)
							memcpy(&cfg.arcdef[u],&cfg.arcdef[u+1]
								,sizeof(arcdef_t));
rswindell's avatar
rswindell committed
						continue;
						memcpy(&savarcdef,&cfg.arcdef[i],sizeof(arcdef_t));
rswindell's avatar
rswindell committed
						continue;
					if (msk == MSK_PASTE) {
						if(!new_arcdef(i))
							continue;
						memcpy(&cfg.arcdef[i],&savarcdef,sizeof(arcdef_t));
rswindell's avatar
rswindell committed
						continue;
rswindell's avatar
rswindell committed
						uifc.helpbuf=
	"Archive Type and Program configuration";
rswindell's avatar
rswindell committed
						snprintf(opt[j++],MAX_OPLN-1,"%-30.30s %s","Archive Type"
							,cfg.arcdef[i].name);
rswindell's avatar
rswindell committed
						snprintf(opt[j++],MAX_OPLN-1,"%-30.30s %s","Signature"
							,cfg.arcdef[i].hexid);
rswindell's avatar
rswindell committed
						snprintf(opt[j++],MAX_OPLN-1,"%-30.30s %u","Signature Offset"
							,cfg.arcdef[i].byteloc);
rswindell's avatar
rswindell committed
						snprintf(opt[j++],MAX_OPLN-1,"%-30.30s %s","Pack Command Line"
							,cfg.arcdef[i].pack);
rswindell's avatar
rswindell committed
						snprintf(opt[j++],MAX_OPLN-1,"%-30.30s %s","Unpack Command Line"
							,cfg.arcdef[i].unpack);
						opt[j][0]=0;
rswindell's avatar
rswindell committed
						SAFEPRINTF(str,"Archive Type - %s", cfg.arcdef[i].name);
rswindell's avatar
rswindell committed
						k=uifc.list(WIN_ACT|WIN_SAV|WIN_RHT|WIN_BOT,0,0,0,&packop,0,str,opt);
						if(k==-1)
							break;
						switch(k) {
							case 0:
rswindell's avatar
rswindell committed
								uifc.helpbuf=
rswindell's avatar
rswindell committed
								"~ Archive Type ~\n\n"
								"This is the identifying name of the archive file type. Usually this name\n"
								"corresponds with the common file extension or suffix denoting this type\n"
rswindell's avatar
rswindell committed
								"of archive file (e.g. `zip`, `arc`, etc.)."
								;
								uifc.input(WIN_MID|WIN_SAV,0,0
rswindell's avatar
rswindell committed
									,"Archive Type"
									,cfg.arcdef[i].name,sizeof(cfg.arcdef[i].name)-1
									,K_EDIT|K_UPPER);
								break;
							case 1:
rswindell's avatar
rswindell committed
								uifc.helpbuf=
rswindell's avatar
rswindell committed
								"~ Archive Signature ~\n\n"
								"This is the identifying signature of the archive file format (in\n"
								"hexadecimal notation).  This signature is used in combination with the\n"
								"Archive `Signature Offset` for the automatic detection of proper archive\n"
rswindell's avatar
rswindell committed
								"program to extract (unarchive) inbound EchoMail bundle files."
								;
								uifc.input(WIN_MID|WIN_SAV,0,0
rswindell's avatar
rswindell committed
									,"Archive Signature"
									,cfg.arcdef[i].hexid,sizeof(cfg.arcdef[i].hexid)-1
									,K_EDIT|K_UPPER);
								break;
							case 2:
rswindell's avatar
rswindell committed
								uifc.helpbuf=
rswindell's avatar
rswindell committed
								"~ Archive Signature Offset ~\n\n"
								"This is the byte-offset of the identifying signature of the archive file\n"
								"format.  This offset is used in combination with the Archive `Signature`\n"
								"for the automatic detection of proper archive program to extract\n"
rswindell's avatar
rswindell committed
								"(unarchive) inbound EchoMail bundle files."
								;
								sprintf(str,"%u",cfg.arcdef[i].byteloc);
rswindell's avatar
rswindell committed
								if(uifc.input(WIN_MID|WIN_SAV,0,0
									,"Archive Signature Offset",str,5
									,K_NUMBER|K_EDIT) > 0)
									cfg.arcdef[i].byteloc=atoi(str);
rswindell's avatar
rswindell committed
								uifc.helpbuf=
rswindell's avatar
rswindell committed
								"~ Pack Command Line ~\n\n"
								"This is the command-line to execute to create an archive file of the\n"
								"selected type.  The following command-line specifiers may be used for\n"
								"dynamic variable replacement:\n"
								"\n"
								"  `%f`  The path/filename of the archive file to be created\n"
								"  `%s`  The path/filename of the file(s) to be added to the archive\n"
								"  `%!`  The Synchronet `exec` directory\n"
								"  `%@`  The Synchronet `exec` directory only for non-Unix systems\n"
								"  `%.`  Blank for Unix systems, '`.exe`' otherwise\n"
								"  `%?`  The current platform description (e.g. 'linux', 'win32')\n"
								"  `%j`  The Synchronet `data` directory\n"
								"  `%k`  The Synchronet `ctrl` directory\n"
								"  `%o`  The configured system operator name\n"
								"  `%q`  The configured system QWK-ID\n"
								"  `%g`  The configured temporary file directory\n"
rswindell's avatar
rswindell committed
								;
								uifc.input(WIN_MID|WIN_SAV,0,0
rswindell's avatar
rswindell committed
									,"Pack Command Line"
									,cfg.arcdef[i].pack,sizeof(cfg.arcdef[i].pack)-1
rswindell's avatar
rswindell committed
								uifc.helpbuf=
rswindell's avatar
rswindell committed
								"~ Unpack Command Line ~\n\n"
								"This is the command-line to execute to extract an archive file of the\n"
								"selected type.  The following command-line specifiers may be used for\n"
								"dynamic variable replacement:\n"
								"\n"
								"  `%f`  The path/filename of the archive file to be extracted\n"
rswindell's avatar
rswindell committed
								"  `%s`  The destination directory for files extracted from the archive\n"
rswindell's avatar
rswindell committed
								"  `%!`  The Synchronet `exec` directory\n"
								"  `%@`  The Synchronet `exec` directory only for non-Unix systems\n"
								"  `%.`  Blank for Unix systems, '`.exe`' otherwise\n"
								"  `%?`  The current platform description (e.g. 'linux', 'win32')\n"
								"  `%j`  The Synchronet `data` directory\n"
								"  `%k`  The Synchronet `ctrl` directory\n"
								"  `%o`  The configured system operator name\n"
								"  `%q`  The configured system QWK-ID\n"
								"  `%g`  The configured temporary file directory\n"
rswindell's avatar
rswindell committed
								;
								uifc.input(WIN_MID|WIN_SAV,0,0
rswindell's avatar
rswindell committed
									,"Unpack Command Line"
									,cfg.arcdef[i].unpack,sizeof(cfg.arcdef[i].unpack)-1
rswindell's avatar
rswindell committed

rswindell's avatar
rswindell committed
			case 6:
				uifc.helpbuf=
					"~ Domains ~\n\n"
					"The `Domains` sub-menu is where FidoNet-style domains (the '@domain'\n"
					"of 5D FTN address) are mapped to zone numbers, DNS suffixes, NodeLists\n"
					"and BSO root directories for use by the BinkIT mailer.\n"
				;
				i=0;
				while(1) {
					for(u=0; u < cfg.domain_count; u++)
						snprintf(opt[u], MAX_OPLN-1, "%-*s  %s"
							,FIDO_DOMAIN_LEN, cfg.domain_list[u].name, cfg.domain_list[u].dns_suffix);
					opt[u][0]=0;
rswindell's avatar
rswindell committed
					int mode = WIN_SAV | WIN_INS | WIN_DEL | WIN_ACT
						| WIN_INSACT | WIN_DELACT | WIN_XTR;
					if(cfg.domain_count)
						mode |= WIN_COPY | WIN_CUT;
					if(savedomain.name[0])
						mode |= WIN_PASTE | WIN_PASTEXTR;
					i=uifc.list(mode,0,0,0,&domain_opt,0,"Domains",opt);
					if(i==-1)
						break;
					int msk = i&MSK_ON;
					i &= MSK_OFF;
					if (msk == MSK_INS) {
						str[0]=0;
						if(uifc.input(WIN_MID|WIN_SAV,0,0
							,"FTN Domain Name", str, FIDO_DOMAIN_LEN, K_EDIT)<1)
							continue;
						if(!new_domain(i)) {
							printf("\nMemory Allocation Error\n");
rswindell's avatar
rswindell committed
							exit(1);
rswindell's avatar
rswindell committed
						continue;
					}

					if (msk == MSK_DEL || msk == MSK_CUT) {
						if(msk == MSK_CUT)
							memcpy(&savedomain, &cfg.domain_list[i], sizeof(savedomain));
						cfg.domain_count--;
						if(cfg.domain_count <= 0) {
							cfg.domain_count = 0;
rswindell's avatar
rswindell committed
							continue;
						}
						for(u=i; u < cfg.domain_count; u++)
							memcpy(&cfg.domain_list[u], &cfg.domain_list[u+1], sizeof(struct fido_domain));
rswindell's avatar
rswindell committed
						continue;
					}
					if (msk == MSK_COPY) {
						memcpy(&savedomain, &cfg.domain_list[i], sizeof(savedomain));
rswindell's avatar
rswindell committed
						continue;
					}
					if (msk == MSK_PASTE) {
						if(!new_domain(i))
							continue;
						memcpy(&cfg.domain_list[i], &savedomain, sizeof(savedomain));
rswindell's avatar
rswindell committed
						continue;
					}
					if (msk != 0)
						continue;
					while(1) {
						j=0;
						snprintf(opt[j++],MAX_OPLN-1,"%-30.30s %s","Name"
							,cfg.domain_list[i].name);
						snprintf(opt[j++],MAX_OPLN-1,"%-30.30s %s","Zones"
							,int_list(cfg.domain_list[i].zone_list, cfg.domain_list[i].zone_count));
						snprintf(opt[j++],MAX_OPLN-1,"%-30.30s %s","DNS Suffix"
							,cfg.domain_list[i].dns_suffix);
						snprintf(opt[j++],MAX_OPLN-1,"%-30.30s %s","Outbound Root"
							,cfg.domain_list[i].root);
						snprintf(opt[j++],MAX_OPLN-1,"%-30.30s %s","NodeList"
							,cfg.domain_list[i].nodelist);
						opt[j][0]=0;
						SAFEPRINTF(str, "Domain - %s", cfg.domain_list[i].name);
						k=uifc.list(WIN_ACT|WIN_SAV|WIN_RHT|WIN_BOT,0,0,0,&listop,0,str,opt);
						if(k==-1)
							break;
						switch(k) {
							case 0:
								uifc.input(WIN_MID|WIN_SAV,0,0
									,"Domain Name"
									,cfg.domain_list[i].name,sizeof(cfg.domain_list[i].name)-1
									,K_EDIT);
								break;
							case 1:
								SAFECOPY(str, int_list(cfg.domain_list[i].zone_list, cfg.domain_list[i].zone_count));
								if(uifc.input(WIN_MID|WIN_SAV, 0, 0
									,"Zone List (comma-separated)"
									,str, 40, K_EDIT) >= 0) {
									FREE_AND_NULL(cfg.domain_list[i].zone_list);
									cfg.domain_list[i].zone_list = parseIntList(str, ",", &cfg.domain_list[i].zone_count);
									uifc.changes = TRUE;
								}
								break;
							case 2:
								uifc.input(WIN_MID|WIN_SAV,0,0
									,"DNS Suffix"
									,cfg.domain_list[i].dns_suffix,sizeof(cfg.domain_list[i].dns_suffix)-1
									,K_EDIT);
								break;
							case 3:
								uifc.input(WIN_MID|WIN_SAV,0,0
									,"Outbound Root Directory"
									,cfg.domain_list[i].root,sizeof(cfg.domain_list[i].root)-1
									,K_EDIT);
								break;
							case 4:
								uifc.input(WIN_MID|WIN_SAV,0,0
									,"NodeList"
									,cfg.domain_list[i].nodelist,sizeof(cfg.domain_list[i].nodelist)-1
									,K_EDIT);
								break;
rswindell's avatar
rswindell committed
	"~ EchoLists ~\n\n"
	"This feature allows you to specify lists of echoes, in `BACKBONE.NA`\n"
	"format, which are utilized in `addition` to your Area File (e.g. \n"
	"`areas.bbs`) for advanced AreaFix (Area Management) operations.\n";
					for(u=0;u<cfg.listcfgs;u++)
rswindell's avatar
rswindell committed
						snprintf(opt[u],MAX_OPLN-1,"%s",cfg.listcfg[u].listpath);
rswindell's avatar
rswindell committed
					int mode = WIN_SAV | WIN_INS | WIN_DEL | WIN_ACT
						| WIN_INSACT | WIN_DELACT | WIN_XTR;
					if(cfg.listcfgs)
						mode |= WIN_COPY | WIN_CUT;
rswindell's avatar
rswindell committed
					i=uifc.list(mode,0,0,0,&echolist_opt,0,"EchoLists",opt);
					int msk = i&MSK_ON;
					i &= MSK_OFF;
					if (msk == MSK_INS) {
						str[0]=0;
	uifc.helpbuf=
rswindell's avatar
rswindell committed
	"~ EchoList ~\n\n"
	"This is the path and filename of the echolist file you wish\n"
	"to add.\n";
						if(uifc.input(WIN_MID|WIN_SAV,0,0
rswindell's avatar
rswindell committed
							,"EchoList Path/Name",str,50,K_EDIT)<1)
							printf("\nMemory Allocation Error\n");
rswindell's avatar
rswindell committed
							exit(1);
						SAFECOPY(cfg.listcfg[i].listpath,str);
rswindell's avatar
rswindell committed
						continue;
					if (msk == MSK_DEL || msk == MSK_CUT) {
						if(msk == MSK_CUT)
							memcpy(&savlistcfg, &cfg.listcfg[i], sizeof(echolist_t));
						cfg.listcfgs--;
						if(cfg.listcfgs<=0) {
							cfg.listcfgs=0;
rswindell's avatar
rswindell committed
							continue;
						for(u=i;u<cfg.listcfgs;u++)
							memcpy(&cfg.listcfg[u],&cfg.listcfg[u+1]
								,sizeof(echolist_t));
rswindell's avatar
rswindell committed
						continue;
						memcpy(&savlistcfg,&cfg.listcfg[i],sizeof(echolist_t));
rswindell's avatar
rswindell committed
						continue;
					if (msk == MSK_PASTE) {
						if(!new_list(i))
							continue;
						memcpy(&cfg.listcfg[i],&savlistcfg,sizeof(echolist_t));
rswindell's avatar
rswindell committed
						continue;
rswindell's avatar
rswindell committed
						uifc.helpbuf=
rswindell's avatar
rswindell committed
						"Configuring an EchoList"
rswindell's avatar
rswindell committed
						;
						snprintf(opt[j++],MAX_OPLN-1,"%-30.30s %s","EchoList Path/Name"
							,cfg.listcfg[i].listpath);
rswindell's avatar
rswindell committed
						snprintf(opt[j++],MAX_OPLN-1,"%-30.30s %s","Required Key"
							,strListCombine(cfg.listcfg[i].keys, str, sizeof(str), ","));
rswindell's avatar
rswindell committed
						snprintf(opt[j++],MAX_OPLN-1,"%-30.30s %s","Hub Address"
							,(cfg.listcfg[i].hub.zone) ?
							 faddrtoa(&cfg.listcfg[i].hub) : "None");
rswindell's avatar
rswindell committed
						snprintf(opt[j++],MAX_OPLN-1,"%-30.30s %s","Forward AreaMgr Requests"
rswindell's avatar
rswindell committed
							,cfg.listcfg[i].forward ? "Yes" : "No");
rswindell's avatar
rswindell committed
						if(cfg.listcfg[i].forward) {
							snprintf(opt[j++],MAX_OPLN-1,"%-30.30s %s","AreaMgr Name"
								,cfg.listcfg[i].areamgr);
							snprintf(opt[j++],MAX_OPLN-1,"%-30.30s %s","AreaMgr Password"
								,cfg.listcfg[i].password);
						}
rswindell's avatar
rswindell committed
						SAFEPRINTF(str, "EchoList - %s", getfname(cfg.listcfg[i].listpath));
						k=uifc.list(WIN_ACT|WIN_SAV|WIN_RHT|WIN_BOT,0,0,0,&listop,0,str,opt);
rswindell's avatar
rswindell committed
								uifc.input(WIN_MID|WIN_SAV,0,0
									,"EchoList Path/Name"
									,cfg.listcfg[i].listpath,sizeof(cfg.listcfg[i].listpath)-1
									,K_EDIT);
								uifc.helpbuf=
rswindell's avatar
rswindell committed
								"~ Required Key ~\n\n"
								"These keys determine which linked nodes have access to the selected\n"
								"echolist file via AreaFix requests (e.g. query, add, remove).\n"
								"\n"
								"A linked node need only have one of the required keys to have access\n"
								"the echolist."
								;
rswindell's avatar
rswindell committed
									for(u=0; cfg.listcfg[i].keys!=NULL && cfg.listcfg[i].keys[u] != NULL;u++)
										strcpy(opt[u],cfg.listcfg[i].keys[u]);
									x=uifc.list(WIN_SAV|WIN_INS|WIN_DEL|WIN_ACT|
										WIN_XTR|WIN_INSACT|WIN_DELACT|WIN_RHT
rswindell's avatar
rswindell committed
										,0,0,0,&x,0,"Required Key (any one of)",opt);
									if(x==-1)
										break;
									if((x&MSK_ON)==MSK_INS) {
										x&=MSK_OFF;
										str[0]=0;
										if(uifc.input(WIN_MID|WIN_SAV,0,0
rswindell's avatar
rswindell committed
											,"EchoList Key",str,SBBSECHO_MAX_KEY_LEN
											,K_EDIT|K_UPPER)<1)
											continue;
rswindell's avatar
rswindell committed
										strListInsert(&cfg.listcfg[i].keys,str,x);
rswindell's avatar
rswindell committed
										continue;
									if((x&MSK_ON)==MSK_DEL) {
										x&=MSK_OFF;
rswindell's avatar
rswindell committed
										strListRemove(&cfg.listcfg[i].keys,x);
rswindell's avatar
rswindell committed
										continue;
rswindell's avatar
rswindell committed
									SAFECOPY(str,cfg.listcfg[i].keys[x]);
rswindell's avatar
rswindell committed
										uifc.input(WIN_MID|WIN_SAV,0,0,"EchoList Keys"
rswindell's avatar
rswindell committed
											,str,SBBSECHO_MAX_KEY_LEN,K_EDIT|K_UPPER);
										strListReplace(cfg.listcfg[i].keys,x,str);
rswindell's avatar
rswindell committed
										continue;
rswindell's avatar
rswindell committed
							case 2:
								if(cfg.listcfg[i].hub.zone)
									SAFECOPY(str,faddrtoa(&cfg.listcfg[i].hub));
rswindell's avatar
rswindell committed
								else
									str[0]=0;
								uifc.input(WIN_MID|WIN_SAV,0,0
									,"Hub Address",str
									,25,K_EDIT);
								if(str[0])
									cfg.listcfg[i].hub=atofaddr(str);
								else
									memset(&cfg.listcfg[i].hub,0
										,sizeof(faddr_t));
								break;
							case 3:
								cfg.listcfg[i].forward = !cfg.listcfg[i].forward;
								break;
							case 4:
								uifc.input(WIN_MID|WIN_SAV,0,0
									,"Name to use when forwarding AreaMgr requests"
									,cfg.listcfg[i].areamgr,sizeof(cfg.listcfg[i].areamgr)-1
									,K_EDIT);
								break;
							case 5:
								uifc.input(WIN_MID|WIN_SAV,0,0
									,"Password to use when forwarding AreaMgr requests"
									,cfg.listcfg[i].password,sizeof(cfg.listcfg[i].password)-1
									,K_EDIT|K_UPPER);
								break;
rswindell's avatar
rswindell committed
				if(!sbbsecho_write_ini(&cfg))
					uifc.msg("Error saving configuration file");
				else {
					orig_cfg = cfg;
					uifc.changes = FALSE;
rswindell's avatar
rswindell committed
				break;
			case -1:
				if(uifc.changes) {
		uifc.helpbuf=
rswindell's avatar
rswindell committed
		"~ Save Configuration File ~\n\n"
		"Select `Yes` to save the config file, `No` to quit without saving,\n"
		"or hit ~ ESC ~ to go back to the menu.\n\n";
rswindell's avatar
rswindell committed
					i=0;
					i=uifc.list(WIN_MID,0,0,0,&i,0,"Save Config File",uifcYesNoOpts);
rswindell's avatar
rswindell committed
					if(i==-1) break;
					if(i == 0) {
						if(!sbbsecho_write_ini(&cfg))
							uifc.msg("Error saving configuration file");
					}
				uifc.bail();
				exit(0);