echocfg.c 69.9 KB
Newer Older
1
2
3
4
5
6
7
8
/* SBBSecho configuration utility 											*/

/* $Id$ */

/****************************************************************************
 * @format.tab-size 4		(Plain Text/Source Code File Header)			*
 * @format.use-tabs true	(see http://www.synchro.net/ptsc_hdr.html)		*
 *																			*
9
 * Copyright Rob Swindell - http://www.synchro.net/copyright.html			*
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
 *																			*
 * This program is free software; you can redistribute it and/or			*
 * modify it under the terms of the GNU General Public License				*
 * as published by the Free Software Foundation; either version 2			*
 * of the License, or (at your option) any later version.					*
 * See the GNU General Public License for more details: gpl.txt or			*
 * http://www.fsf.org/copyleft/gpl.html										*
 *																			*
 * Anonymous FTP access to the most recent released source is available at	*
 * ftp://vert.synchro.net, ftp://cvs.synchro.net and ftp://ftp.synchro.net	*
 *																			*
 * Anonymous CVS access to the development source and modification history	*
 * is available at cvs.synchro.net:/cvsroot/sbbs, example:					*
 * cvs -d :pserver:anonymous@cvs.synchro.net:/cvsroot/sbbs login			*
 *     (just hit return, no password is necessary)							*
 * cvs -d :pserver:anonymous@cvs.synchro.net:/cvsroot/sbbs checkout src		*
 *																			*
 * For Synchronet coding style and modification guidelines, see				*
 * http://www.synchro.net/source.html										*
 *																			*
 * You are encouraged to submit any modifications (preferably in Unix diff	*
 * format) via e-mail to mods@synchro.net									*
 *																			*
 * Note: If this box doesn't appear square, then you need to fix your tabs.	*
 ****************************************************************************/
35
36
37

/* Portions written by Allen Christiansen 1994-1996 						*/

38
#include <stdio.h>
39

40
#undef JAVASCRIPT
41

rswindell's avatar
rswindell committed
42
43
44
/* XPDEV Headers */
#include "gen_defs.h"

45
46
#define __COLORS
#include "ciolib.h"
47
48
#include "uifc.h"
#include "sbbs.h"
49
50
51
52
#include "sbbsecho.h"

char **opt;

rswindell's avatar
rswindell committed
53
sbbsecho_cfg_t cfg;
54
55
uifcapi_t uifc;

56
57
58
void bail(int code)
{

59
60
	if(uifc.bail!=NULL)
		uifc.bail();
61
62
63
	exit(code);
}

64
65
66
/* These correlate with the LOG_* definitions in syslog.h/gen_defs.h */
static char* logLevelStringList[] 
	= {"Emergency", "Alert", "Critical", "Error", "Warning", "Notice", "Informational", "Debugging", NULL};
67

rswindell's avatar
rswindell committed
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
void global_settings(void)
{
	static int global_opt;

	while(1) {
		int i = 0;
		char str[128];
		char duration[64];
		sprintf(opt[i++], "%-25s %s", "Mailer Type"
			,cfg.flo_mailer ? "Binkley/FLO":"ArcMail/Attach");
		sprintf(opt[i++], "%-25s %s", "Log Level", logLevelStringList[cfg.log_level]);
		sprintf(opt[i++], "%-25s %s", "Log Timestamp Format", cfg.logtime);
		sprintf(opt[i++], "%-25s %s", "Strict Packet Passwords", cfg.strict_packet_passwords ? "Enabled" : "Disabled");
		sprintf(opt[i++], "%-25s %s", "Use FTN Domain/Zone Map", cfg.use_ftn_domains ? "Enabled" : "Disabled");
		sprintf(opt[i++], "%-25s %s", "BSY Mutex File Timeout", duration_to_vstr(cfg.bsy_timeout, duration, sizeof(duration)));
		sprintf(opt[i++], "%-25s %s", "BSO Lock Attempt Delay", duration_to_vstr(cfg.bso_lock_delay, duration, sizeof(duration)));
		sprintf(opt[i++], "%-25s %u", "BSO Lock Attempt Limit", cfg.bso_lock_attempts);
		sprintf(opt[i++], "%-25s %u", "Config File Backups", cfg.cfgfile_backups);
		opt[i][0] = 0;
		uifc.helpbuf=
			"~ Global Settings ~\n"
			"\n"
			"`Mailer Type` should normally be set to `Binkley/FLO` to enable SBBSecho's\n"
			"    \"Binkley-Style Outbound\" operating mode (a.k.a. `BSO` or `FLO` mode).\n"
			"    If you are using an `Attach`, `ArcMail`, or `FrontDoor` style FidoNet\n"
			"    mailer, then set this setting to `ArcMail/Attach`, but know that most\n"
			"    modern FidoNet mailers are Binkley-Style and therefore that mode of\n"
			"    operation in SBBSecho is more widely tested and supported.\n"
			"\n"
			"`Log Level` should normally be set to `Informational` but if you're\n"
			"    experiencing problems with SBBSecho and would like more verbose log\n"
			"    output, set this to `Debugging`. If you want less verbose logging,\n"
			"    set to higher-severity levels to reduce the number of log messages.\n"
			"\n"
			"`Log Timestmap Format` defines the format of the date/time-stamps added\n"
			"    along with each log message to the log file (e.g. sbbsecho.log).\n"
			"    The timestamp format is defined using standard C `strftime` notation.\n"
			"    The default format is: `" DEFAULT_LOG_TIME_FMT "`\n"
			"    For SBBSecho v2 timestamp format, use `%m/%d/%y %H:%M:%S`\n"
			"\n"
			"`Strict Packet Passwords`, when enabled, requires that Packet Passwords\n"
			"    must match the password for the linked-node from which the packet\n"
			"    was received, even if that linked-node has no password configured.\n"
			"    If you wish to revert to the SBBSecho v2 behavior with less strict\n"
			"    enforcement of matching packet passwords, disable this option.\n"
			"    Default: Enabled\n"
			"\n"
			"`Use FTN Domain/Zone Map`, when enabled, uses the configuration file\n"
			"    `ctrl/ftn_domains.ini` to determine the mapping between FTN domains\n"
			"    and FTN zones and the relevant BSO outbound directory.\n"
			"    Default: Disabled\n"
			"\n"
			"`BSY Mutex File Timeout` determines the maximum age of an existing\n"
			"    mutex file (`*.bsy`) before SBBSecho will act as though the mutex\n"
			"    file was not present.  This setting applies to the global\n"
			"    `sbbsecho.bsy` file as well as the BSO lock (`*.bsy`) files for\n"
			"    individual nodes.\n"
			"    Default: 12 hours\n"
			"\n"
			"`BSO Lock Attempt Delay` determines the amount of time between BSO\n"
			"    node lock attempts (via `*.bsy` files in the relevant outbound\n"
			"    directory).\n"
			"    Default: 10 seconds\n"
			"\n"
			"`BSO Lock Attempt Limit` determines the maximum number of BSO node lock\n"
			"    attempts before SBBSecho will give-up and move on to another node\n"
			"    to process mail.  This value multiplied by the `BSO Lock Attempt\n"
			"    Delay` should be much less than the `BSY Mutex File Timeout` value.\n"
			"    Default: 60 attempts\n"
			"\n"
			"`Config File Backups` determines the number of automatic backups of your\n"
			"    SBBSecho configuration file (e.g. `sbbsecho.ini`) that will be\n"
			"    maintained by SBBSecho Config and SBBSecho AreaFix.\n"
			;

		int key = uifc.list(WIN_BOT|WIN_L2R|WIN_ACT|WIN_SAV, 0, 0, 0, &global_opt,0, "Global Settings", opt);

		switch(key) {

			case -1:
				return;

			case 0:
				cfg.flo_mailer = !cfg.flo_mailer;
				break;

			case 1:
	uifc.helpbuf=
	"~ Log Level ~\n"
	"\n"
	"Select the minimum severity of log entries to be logged to the log file.\n"
	"The default/normal setting is `Informational`.";
				int i = cfg.log_level;
				i = uifc.list(WIN_MID|WIN_SAV,0,0,0,&i,0,"Log Level",logLevelStringList);
				if(i>=0 && i<=LOG_DEBUG)
					cfg.log_level=i;
				break;

			case 2:
				uifc.input(WIN_MID|WIN_SAV,0,0
					,"Log Timestamp Format", cfg.logtime, sizeof(cfg.logtime)-1, K_EDIT);
				break;

			case 3:
				cfg.strict_packet_passwords = !cfg.strict_packet_passwords;
				break;

			case 4:
				cfg.use_ftn_domains = !cfg.use_ftn_domains;
				break;

			case 5:
				duration_to_vstr(cfg.bsy_timeout, duration, sizeof(duration));
				if(uifc.input(WIN_MID|WIN_SAV, 0, 0, "BSY Mutex File Timeout", duration, 10, K_EDIT) > 0)
					cfg.bsy_timeout = (ulong)parse_duration(duration);
				break;

			case 6:
				duration_to_vstr(cfg.bso_lock_delay, duration, sizeof(duration));
				if(uifc.input(WIN_MID|WIN_SAV, 0, 0, "Delay Between BSO Lock Attempts", duration, 10, K_EDIT) > 0)
					cfg.bso_lock_delay = (ulong)parse_duration(duration);
				break;

			case 7:
				sprintf(str, "%u", cfg.bso_lock_attempts);
				if(uifc.input(WIN_MID|WIN_SAV, 0, 0, "Maximum BSO Lock Attempts", str, 5, K_EDIT|K_NUMBER) > 0)
					cfg.bso_lock_attempts = atoi(str);
				break;

			case 8:
				sprintf(str, "%u", cfg.cfgfile_backups);
				if(uifc.input(WIN_MID|WIN_SAV, 0, 0, "Configuration File Backups", str, 5, K_EDIT|K_NUMBER) > 0)
					cfg.cfgfile_backups = atoi(str);
				break;
		}
	}
}

206
207
208
int main(int argc, char **argv)
{
	char str[256],*p;
rswindell's avatar
rswindell committed
209
	int i,j,k,x,dflt,nodeop=0,packop=0,listop=0;
210
211
212
	echolist_t savlistcfg;
	nodecfg_t savnodecfg;
	arcdef_t savarcdef;
213
	BOOL door_mode=FALSE;
214
	int		ciolib_mode=CIOLIB_MODE_AUTO;
rswindell's avatar
rswindell committed
215
216
217
	unsigned int u;
	char	sysop_aliases[256];
	sbbsecho_cfg_t orig_cfg;
218

219
220
221
222
	ZERO_VAR(savlistcfg);
	ZERO_VAR(savnodecfg);
	ZERO_VAR(savarcdef);

223
224
	fprintf(stderr,"\nSBBSecho Configuration  Version %u.%02u  Copyright %s "
		"Rob Swindell\n\n",SBBSECHO_VERSION_MAJOR, SBBSECHO_VERSION_MINOR, __DATE__+7);
225

rswindell's avatar
rswindell committed
226
	memset(&cfg,0,sizeof(cfg));
227
228
229
230
	str[0]=0;
	for(i=1;i<argc;i++) {
		if(argv[i][0]=='-')
			switch(toupper(argv[i][1])) {
231
                case 'D':
rswindell's avatar
rswindell committed
232
					printf("NOTICE: The -d option is deprecated, use -id instead\n");
233
234
235
236
237
238
239
240
241
					SLEEP(2000);
                    door_mode=TRUE;
                    break;
                case 'L':
                    uifc.scrn_len=atoi(argv[i]+2);
                    break;
                case 'E':
                    uifc.esc_delay=atoi(argv[i]+2);
                    break;
242
				case 'I':
243
244
245
246
247
248
249
250
					switch(toupper(argv[i][2])) {
						case 'A':
							ciolib_mode=CIOLIB_MODE_ANSI;
							break;
						case 'C':
							ciolib_mode=CIOLIB_MODE_CURSES;
							break;
						case 0:
rswindell's avatar
rswindell committed
251
							printf("NOTICE: The -i option is deprecated, use -if instead\n");
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
							SLEEP(2000);
						case 'F':
							ciolib_mode=CIOLIB_MODE_CURSES_IBM;
							break;
						case 'X':
							ciolib_mode=CIOLIB_MODE_X;
							break;
						case 'W':
							ciolib_mode=CIOLIB_MODE_CONIO;
							break;
						case 'D':
		                    door_mode=TRUE;
		                    break;
						default:
							goto USAGE;
					}
268
					break;
269
270
271
				case 'K':	/* Keyboard-only mode (no mouse support) */
					uifc.mode |= UIFC_NOMOUSE;
					break;
272
273
274
275
276
277
		        case 'M':   /* Monochrome mode */
        			uifc.mode|=UIFC_MONO;
                    break;
                case 'C':
        			uifc.mode|=UIFC_COLOR;
                    break;
278
279
                case 'V':
                    textmode(atoi(argv[i]+2));
280
                    break;
281
282
                default:
					USAGE:
rswindell's avatar
rswindell committed
283
                    printf("usage: echocfg [path/to/sbbsecho.ini] [options]"
284
                        "\n\noptions:\n\n"
rswindell's avatar
rswindell committed
285
286
287
288
289
						"-k  =  keyboard mode only (no mouse support)\n"
                        "-c  =  force color mode\n"
						"-m  =  force monochrome mode\n"
                        "-e# =  set escape delay to #msec\n"
						"-iX =  set interface mode to X (default=auto) where X is one of:\n"
290
#ifdef __unix__
rswindell's avatar
rswindell committed
291
292
293
						"       X = X11 mode\n"
						"       C = Curses mode\n"
						"       F = Curses mode with forced IBM charset\n"
294
#else
rswindell's avatar
rswindell committed
295
						"       W = Win32 native mode\n"
296
#endif
rswindell's avatar
rswindell committed
297
298
299
300
						"       A = ANSI mode\n"
						"       D = standard input/output/door mode\n"
                        "-v# =  set video mode to # (default=auto)\n"
                        "-l# =  set screen lines to # (default=auto-detect)\n"
301
302
                        );
        			exit(0);
303
304
		}
		else
305
			strcpy(str,argv[i]);
306
307
	}
	if(str[0]==0) {
308
309
310
311
		p=getenv("SBBSCTRL");
		if(!p) {
			p=getenv("SBBSNODE");
			if(!p) {
rswindell's avatar
rswindell committed
312
				goto USAGE;
313
314
				exit(1); 
			}
315
316
			strcpy(str,p);
			backslash(str);
rswindell's avatar
rswindell committed
317
			strcat(str,"../ctrl/sbbsecho.ini"); 
318
		}
319
320
321
		else {
			strcpy(str,p);
			backslash(str);
rswindell's avatar
rswindell committed
322
			strcat(str,"sbbsecho.ini"); 
323
324
		} 
	}
rswindell's avatar
rswindell committed
325
	SAFECOPY(cfg.cfgfile,str);
326

rswindell's avatar
rswindell committed
327
328
329
330
331
	if(!sbbsecho_read_ini(&cfg)) {
		fprintf(stderr, "ERROR %d (%s) reading %s\n", errno, strerror(errno), cfg.cfgfile);
		exit(1);
	}
	orig_cfg = cfg;
332

333
	// savnum=0;
rswindell's avatar
rswindell committed
334
	if((opt=(char **)malloc(sizeof(char *)*1000))==NULL) {
335
		puts("memory allocation error\n");
336
337
		exit(1); 
	}
rswindell's avatar
rswindell committed
338
339
	for(i=0;i<1000;i++)
		if((opt[i]=(char *)malloc(MAX_OPLN+1))==NULL) {
340
			puts("memory allocation error\n");
341
342
			exit(1); 
		}
343
	uifc.size=sizeof(uifc);
344
345
346
347
348
349
350
351
	if(!door_mode) {
		i=initciolib(ciolib_mode);
		if(i!=0) {
    		printf("ciolib library init returned error %d\n",i);
    		exit(1);
		}
    	i=uifcini32(&uifc);  /* curses/conio/X/ANSI */
	}
352
	else
353
    	i=uifcinix(&uifc);  /* stdio */
354
355
356
357
358
359

	if(i!=0) {
		printf("uifc library init returned error %d\n",i);
		exit(1);
	}

rswindell's avatar
rswindell committed
360
361
	uifc.timedisplay = NULL;
	sprintf(str,"SBBSecho Config v%u.%02u",SBBSECHO_VERSION_MAJOR, SBBSECHO_VERSION_MINOR);
362
	uifc.scrn(str);
rswindell's avatar
rswindell committed
363
364
365
366
	p=cfg.cfgfile;
	if(strlen(p) + strlen(str) + 4 > uifc.scrn_width)
		p=getfname(cfg.cfgfile);
	uifc.printf(uifc.scrn_width-(strlen(p)+1),1,uifc.bclr|(uifc.cclr<<4),p);
367

rswindell's avatar
rswindell committed
368
369
370
371
372
373
374
	/* Remember current menu item selections using these vars: */
	int netmail_opt = 0;
	int echomail_opt = 0;
	int path_opt = 0;
	int node_opt = 0;
	int archive_opt = 0;
	int echolist_opt = 0;
375
376
	dflt=0;
	while(1) {
rswindell's avatar
rswindell committed
377
378
		if(memcmp(&cfg, &orig_cfg, sizeof(cfg)) != 0)
			uifc.changes = TRUE;
379
		uifc.helpbuf=
rswindell's avatar
rswindell committed
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
	"~ SBBSecho Configuration ~\n\n"
	"This program allows you to easily configure the Synchronet BBS\n"
	"FidoNet-style EchoMail program known as `SBBSecho`.  Alternatively, you\n"
	"may edit the SBBSecho configuration file (e.g. `ctrl/sbbsecho.ini`) using\n"
	"an ASCII/plain-text editor.\n"
	"\n"
	"For detailed documentation, see `http://wiki.synchro.net/util:sbbsecho`\n"
	"\n"
	"The `Global Settings` sub-menu is where SBBSecho configuration settings\n"
	"are located which are neither NetMail nor EchoMail specific, but more\n"
	"general to the operation of SBBSecho.\n"
	"\n"
	"The `Linked Nodes` sub-menu is where you configure your FidoNet-style\n"
	"links: other FidoNet-style nodes/systems you regularly connect with\n"
	"to exchange mail/files.\n"
	"\n"
	"The `Archive Types` sub-menu is where you configure your archive\n"
	"programs (a.k.a. \"packers\") used for the packing and unpacking of\n"
	"EchoMail bundle files (usually in 'zip' format).\n"
	"\n"
	"The `NetMail Settings` sub-menu is where you configure settings specific\n"
	"to NetMail (private one-on-one networked mail).\n"
	"\n"
	"The `EchoMail Settings` sub-menu is where you configure settings specific\n"
	"to EchoMail (public group discussions in topical message areas, echoes).\n"
	"\n"
	"The `Paths and Filenames` sub-menu is where you configure your system's\n"
	"directory and file paths used by SBBSecho.\n"
	"\n"
	"The `EchoLists` sub-menu is for configuring additional (optional)\n"
	"lists of FidoNet-style message areas (echoes) in `BACKBONE.NA` file\n"
	"format.  These lists, if configured, are used in addition to your main\n"
rswindell's avatar
rswindell committed
412
	"`Area File` (e.g. areas.bbs) for advanced AreaFix/AreaMgr operations."
rswindell's avatar
rswindell committed
413
	;
414
		i=0;
rswindell's avatar
rswindell committed
415
		sprintf(opt[i++],"Global Settings...");
rswindell's avatar
rswindell committed
416
417
		sprintf(opt[i++],"Linked Nodes...");
		sprintf(opt[i++],"Archive Types...");
418
419
		sprintf(opt[i++],"NetMail Settings...");
		sprintf(opt[i++],"EchoMail Settings...");
rswindell's avatar
rswindell committed
420
		sprintf(opt[i++],"Paths and Filenames...");
rswindell's avatar
rswindell committed
421
		sprintf(opt[i++],"EchoLists...");
rswindell's avatar
rswindell committed
422
423
		if(uifc.changes)
			snprintf(opt[i++],MAX_OPLN-1,"Save Changes to %s", getfname(cfg.cfgfile));
rswindell's avatar
rswindell committed
424
		opt[i][0]=0;
rswindell's avatar
rswindell committed
425
		switch(uifc.list(WIN_ORG|WIN_MID|WIN_ACT|WIN_ESC,0,0,0,&dflt,0
rswindell's avatar
rswindell committed
426
			,"Configure SBBSecho",opt)) {
427

428
			case 0:
rswindell's avatar
rswindell committed
429
				global_settings();
430
				break;
431

432
433
434
			case 1:
				i=0;
				while(1) {
rswindell's avatar
rswindell committed
435
					uifc.helpbuf=
rswindell's avatar
rswindell committed
436
437
438
439
440
	"~ Linked Nodes ~\n\n"
	"From this menu you can configure the settings for your linked\n"
	"FidoNet-style nodes (uplinks and downlinks).\n"
	"\n"
	"A single node configuration can represent one node or a collection\n"
rswindell's avatar
rswindell committed
441
442
443
	"of nodes, by using the `ALL` wildcard word."
	;

444
					for(u=0;u<cfg.nodecfgs;u++)
rswindell's avatar
rswindell committed
445
446
447
						snprintf(opt[u], MAX_OPLN-1, "%-23s %s"
							,faddrtoa(&cfg.nodecfg[u].addr)
							,cfg.nodecfg[u].comment);
448
					opt[u][0]=0;
449
450
451
452
					int mode = WIN_SAV | WIN_INS | WIN_DEL | WIN_ACT | WIN_GET 
						| WIN_INSACT | WIN_DELACT | WIN_XTR;
					if (savnodecfg.addr.zone)
						mode |= WIN_PUT;
rswindell's avatar
rswindell committed
453
					i=uifc.list(mode,0,0,0,&node_opt,0,"Linked Nodes",opt);
454
455
					if(i==-1)
						break;
456
457
458
					int msk = i&MSK_ON;
					i &= MSK_OFF;
					if (msk == MSK_INS) {
459
460
						str[0]=0;
	uifc.helpbuf=
rswindell's avatar
rswindell committed
461
462
463
464
	"~ Address ~\n\n"
	"This is the FidoNet style address of the node you wish to add (3D or 4D).\n"
	"The `ALL` wildcard may be usd for portions of the address.\n"
	;
rswindell's avatar
rswindell committed
465
						if(uifc.input(WIN_MID|WIN_SAV,0,0
466
467
468
							,"Node Address (ALL wildcard allowed)",str
							,25,K_EDIT)<1)
							continue;
deuce's avatar
deuce committed
469
						if((cfg.nodecfg=(nodecfg_t *)realloc(cfg.nodecfg
470
471
							,sizeof(nodecfg_t)*(cfg.nodecfgs+1)))==NULL) {
							printf("\nMemory Allocation Error\n");
472
473
							exit(1); 
						}
474
475
476
477
478
						for(j=cfg.nodecfgs;j>i;j--)
							memcpy(&cfg.nodecfg[j],&cfg.nodecfg[j-1]
								,sizeof(nodecfg_t));
						cfg.nodecfgs++;
						memset(&cfg.nodecfg[i],0,sizeof(nodecfg_t));
rswindell's avatar
rswindell committed
479
480
						cfg.nodecfg[i].addr=atofaddr(str);
						uifc.changes=TRUE;
481
482
						continue; 
					}
483

484
					if (msk == MSK_DEL || msk == MSK_CUT) {
485
486
						if(msk == MSK_CUT)
							memcpy(&savnodecfg, &cfg.nodecfg[i], sizeof(nodecfg_t));
487
488
489
						cfg.nodecfgs--;
						if(cfg.nodecfgs<=0) {
							cfg.nodecfgs=0;
490
491
							continue; 
						}
492
493
						for(u=i;u<cfg.nodecfgs;u++)
							memcpy(&cfg.nodecfg[u],&cfg.nodecfg[u+1]
494
								,sizeof(nodecfg_t));
deuce's avatar
deuce committed
495
						if((cfg.nodecfg=(nodecfg_t *)realloc(cfg.nodecfg
496
497
							,sizeof(nodecfg_t)*(cfg.nodecfgs)))==NULL) {
							printf("\nMemory Allocation Error\n");
498
499
							exit(1); 
						}
rswindell's avatar
rswindell committed
500
						uifc.changes=TRUE;
501
502
						continue; 
					}
503
					if (msk == MSK_GET) {
504
						memcpy(&savnodecfg,&cfg.nodecfg[i],sizeof(nodecfg_t));
505
506
						continue; 
					}
507
					if (msk == MSK_PUT) {
508
						memcpy(&cfg.nodecfg[i],&savnodecfg,sizeof(nodecfg_t));
rswindell's avatar
rswindell committed
509
						uifc.changes=TRUE;
510
511
						continue; 
					}
512
513
					while(1) {
	uifc.helpbuf=
rswindell's avatar
rswindell committed
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
	"~ Linked Node Settings ~\n"
	"\n"
	"`Address` is the FidoNet-style address in the Zone:Net/Node (3D) or\n"
	"    Zone:Net/Node.Point (4D) format. The wildcard word '`ALL`' may be used\n"
	"    in place of one of the fields to create a node configuration which\n"
	"    will apply to *all* nodes matching that address pattern.\n"
	"    e.g. '`1:ALL`' matches all nodes within FidoNet Zone 1.\n"
	"\n"
	"`Comment` is a note to yourself about this node. Setting this to the\n"
	"    user or sysop name corresponding with the configured node can be\n"
	"    a helpful reminder to yourself later.\n"
	"\n"
	"`Archive Type` is the name of an archive type corresponding with one of\n"
	"    your configured archive types or '`None`'.  This archive type will\n"
	"    be used when creating EchoMail bundles or if `None`, raw/uncompressed\n"
	"    EchoMail packets will be sent to this node.\n"
	"    This setting may be managed by the node using AreaFix requests.\n"
	"\n"
	"`Packet Type` is the type of outbound packet generated for this node.\n"
	"    Incoming packet types are automatically detected from among the list\n"
	"    of supported packet types (`2`, `2.2`, `2e`, and `2+`).\n"
	"    The default outbound packet type is `2+`.\n"
	"\n"
	"`Packet Password` is an optional password that may be added to outbound\n"
	"    packets for this node.  Incoming packet passwords are compared with\n"
	"    this password value.  If this password is blank/empty and `Strict\n"
	"    Packet Passwords` are enabled, then incoming packets from this node\n"
	"    must also have no password.  Packet passwords are case insensitive.\n"
	"    This setting may be managed by the node using AreaFix requests.\n"
	"\n"
	"`TIC File Password` is an optional password that may be configured here\n"
	"    (and in your `sbbsecho.ini` file) for use by `ticket.js` when creating\n"
	"    or authenticating `.TIC` files.\n"
	"    This setting may be managed by the node using AreaFix requests.\n"
	"\n"
	"`AreaFix Password` is an optional password used to enable AreaFix\n"
	"    NetMail requests (Remote Area Management) from this node.\n"
	"    AreaFix Passwords are case insensitive.\n"
	"    This setting may be managed by the node using AreaFix requests.\n"
	"\n"
	"`AreaFix Keys` is a list of keys which enable AreaFix access to one or\n"
	"    more additional EchoLists.\n"
	"\n"
	"`Status` is the default mode for sending mail to this node: `Normal`, `Hold`\n"
	"    (wait for pickup) or `Crash` (immediate).\n"
	"\n"
	"`Direct` determines whether to connect to this node directly (whenever\n"
	"    possible) when sending mail to this node.\n"
	"\n"
	"`Passive` is used to temporarily disable (pause) the packing and sending\n"
	"    of EchoMail for this node.  The opposite of Passive is `Active`.\n"
	"    This setting may be managed by the node using AreaFix requests.\n"
	"\n"
	"`Send Notify List` is used to flag nodes that you want notified via\n"
	"    NetMail of their current AreaFix settings whenever SBBSecho is run\n"
	"    with the '`G`' option.\n"
	"\n"
	"`Uplink for Message Groups` is an optional list of Message Groups (short\n"
	"    names) for which this node is a hub/uplink for your system.  This\n"
	"    setting is used in combination with the `Auto Add Sub-boards` feature\n"
	"    to auto-link hubs with the newly added areas in your Area File.\n"
	"\n"
	"`Route To` is only used in Binkley-Style Outbound (BSO/FLO) operating\n"
	"    mode and is used to set the FTN address to route mail for this node.\n"
	"\n"
	"`Inbox Directory` is only used in BSO operating mode and is an optional\n"
	"    alternate directory to search for incoming files from this node\n"
	"    (e.g. used in combination with BinkD's ibox setting).\n"
	"\n"
	"`Outbox Directory` is only used in BSO operating mode and is an optional\n"
	"    alternate directory to place outbound files for this node (e.g. used\n"
	"    in combination with BinkD's obox setting).\n"
rswindell's avatar
rswindell committed
586
	;
587
						j=0;
rswindell's avatar
rswindell committed
588
589
590
591
592
593
594
595
596
597
						snprintf(opt[j++],MAX_OPLN-1,"%-30.30s %s","Address"
							,faddrtoa(&cfg.nodecfg[i].addr));
						snprintf(opt[j++],MAX_OPLN-1,"%-30.30s %s","Comment"
							,cfg.nodecfg[i].comment);
						snprintf(opt[j++],MAX_OPLN-1,"%-30.30s %s","Archive Type"
							,cfg.nodecfg[i].archive ==  SBBSECHO_ARCHIVE_NONE ?
							"None":cfg.nodecfg[i].archive->name);
						snprintf(opt[j++],MAX_OPLN-1,"%-30.30s %s","Packet Type"
							,pktTypeStringList[cfg.nodecfg[i].pkt_type]);
						snprintf(opt[j++],MAX_OPLN-1,"%-30.30s %s","Packet Password"
598
							,cfg.nodecfg[i].pktpwd);
599
600
						snprintf(opt[j++],MAX_OPLN-1,"%-30.30s %s","TIC File Password"
							,cfg.nodecfg[i].ticpwd);
rswindell's avatar
rswindell committed
601
						snprintf(opt[j++],MAX_OPLN-1,"%-30.30s %s","AreaFix Password"
602
							,cfg.nodecfg[i].password);
rswindell's avatar
rswindell committed
603
						snprintf(opt[j++],MAX_OPLN-1,"%-30.30s %s","AreaFix Keys"
rswindell's avatar
rswindell committed
604
605
606
607
608
609
610
611
612
							,strListCombine(cfg.nodecfg[i].keys,str,sizeof(str),","));
						snprintf(opt[j++],MAX_OPLN-1,"%-30.30s %s","Status"
							,mailStatusStringList[cfg.nodecfg[i].status]);
						snprintf(opt[j++],MAX_OPLN-1,"%-30.30s %s","Direct"
							,cfg.nodecfg[i].direct ? "Yes":"No");
						snprintf(opt[j++],MAX_OPLN-1,"%-30.30s %s","Passive"
							,cfg.nodecfg[i].passive ? "Yes":"No");
						snprintf(opt[j++],MAX_OPLN-1,"%-30.30s %s","Send Notify List"
							,cfg.nodecfg[i].send_notify ? "Yes" : "No");
rswindell's avatar
rswindell committed
613
614
						snprintf(opt[j++],MAX_OPLN-1,"%-30.30s %s","Uplink for Message Groups"
							,strListCombine(cfg.nodecfg[i].grphub,str,sizeof(str),","));
rswindell's avatar
rswindell committed
615
616
						if(cfg.flo_mailer) {
							snprintf(opt[j++],MAX_OPLN-1,"%-30.30s %s","Route To"
617
								,cfg.nodecfg[i].route.zone
rswindell's avatar
rswindell committed
618
								? faddrtoa(&cfg.nodecfg[i].route) : "Disabled");
619
620
621
622
							if(!faddr_contains_wildcard(&cfg.nodecfg[i].addr)) {
								snprintf(opt[j++],MAX_OPLN-1,"%-30.30s %s", "Inbox Directory", cfg.nodecfg[i].inbox);
								snprintf(opt[j++],MAX_OPLN-1,"%-30.30s %s", "Outbox Directory", cfg.nodecfg[i].outbox);
							}
rswindell's avatar
rswindell committed
623
						}
624
						opt[j][0]=0;
rswindell's avatar
rswindell committed
625
626
						SAFEPRINTF(str, "Linked Node - %s"
							,cfg.nodecfg[i].comment[0] ? cfg.nodecfg[i].comment : faddrtoa(&cfg.nodecfg[i].addr));
rswindell's avatar
rswindell committed
627
						k=uifc.list(WIN_MID|WIN_ACT|WIN_SAV,0,0,0,&nodeop,0,str,opt);
628
629
630
631
632
						if(k==-1)
							break;
						switch(k) {
							case 0:
	uifc.helpbuf=
rswindell's avatar
rswindell committed
633
634
	"~ Address ~\n\n"
	"This is the FidoNet style address of this linked node.\n";
rswindell's avatar
rswindell committed
635
636
								strcpy(str,faddrtoa(&cfg.nodecfg[i].addr));
								if(uifc.input(WIN_MID|WIN_SAV,0,0
637
									,"Node Address (ALL wildcard allowed)",str
rswindell's avatar
rswindell committed
638
639
									,25,K_EDIT|K_UPPER)>0)
									cfg.nodecfg[i].addr=atofaddr(str);
640
641
642
								break;
							case 1:
	uifc.helpbuf=
rswindell's avatar
rswindell committed
643
644
645
	"~ Comment ~\n\n"
	"This is an optional comment for the node (e.g. the sysop's name).\n"
	"This is used for informational purposes only.\n";
rswindell's avatar
rswindell committed
646
647
648
649
650
651
652
								uifc.input(WIN_MID|WIN_SAV,0,0
									,"Comment"
									,cfg.nodecfg[i].comment,sizeof(cfg.nodecfg[i].comment)-1
									,K_EDIT);
								break;
							case 2:
	uifc.helpbuf=
rswindell's avatar
rswindell committed
653
654
655
	"~ Archive Type ~\n\n"
	"This is the archive type that will be used for compressing packets\n"
	"into archive bundles for this node.\n";
rswindell's avatar
rswindell committed
656
657
658
659
								int cur=cfg.arcdefs;
								for(u=0;u<cfg.arcdefs;u++) {
									if(cfg.nodecfg[i].archive == &cfg.arcdef[u])
										cur=u;
660
									strcpy(opt[u],cfg.arcdef[u].name);
rswindell's avatar
rswindell committed
661
								}
662
663
								strcpy(opt[u++],"None");
								opt[u][0]=0;
rswindell's avatar
rswindell committed
664
								k=uifc.list(WIN_RHT|WIN_SAV,0,0,0,&cur,0
665
666
667
									,"Archive Type",opt);
								if(k==-1)
									break;
668
								if((unsigned)k>=cfg.arcdefs)
rswindell's avatar
rswindell committed
669
									cfg.nodecfg[i].archive = SBBSECHO_ARCHIVE_NONE;
670
								else
rswindell's avatar
rswindell committed
671
672
									cfg.nodecfg[i].archive = &cfg.arcdef[k];
								uifc.changes=TRUE;
673
								break;
rswindell's avatar
rswindell committed
674
							case 3:
675
	uifc.helpbuf=
rswindell's avatar
rswindell committed
676
677
678
679
680
681
682
683
	"~ Packet Type ~\n\n"
	"This is the packet header type that will be used in mail packets\n"
	"created for this node.  SBBSecho defaults to creating `Type-2+` packets.\n"
	"\n"
	"`Type-2  ` packets are defined in FTS-0001.16 (Stone Age)\n"
	"`Type-2e ` packets are defined in FSC-0039.04 (Sometimes called 2+)\n"
	"`Type-2+ ` packets are defined in FSC-0048.02 (4D address support)\n"
	"`Type-2.2` packets are defined in FSC-0045.01 (5D address support)\n"
rswindell's avatar
rswindell committed
684
	;
685
686
								j=cfg.nodecfg[i].pkt_type;
								k=uifc.list(WIN_RHT|WIN_SAV,0,0,0,&j,0,"Packet Type"
rswindell's avatar
rswindell committed
687
									,pktTypeStringList);
688
689
690
								if(k==-1)
									break;
								cfg.nodecfg[i].pkt_type=k;
rswindell's avatar
rswindell committed
691
								uifc.changes=TRUE;
692
								break;
rswindell's avatar
rswindell committed
693
							case 4:
694
	uifc.helpbuf=
rswindell's avatar
rswindell committed
695
696
697
	"~ Packet Password ~\n\n"
	"This is an optional password that SBBSecho will place into packets\n"
	"destined for this node.\n";
698
699
								uifc.input(WIN_MID|WIN_SAV,0,0
									,"Packet Password (optional)"
rswindell's avatar
rswindell committed
700
701
									,cfg.nodecfg[i].pktpwd,sizeof(cfg.nodecfg[i].pktpwd)-1
									,K_EDIT|K_UPPER);
702
								break;
rswindell's avatar
rswindell committed
703
							case 5:
704
	uifc.helpbuf=
rswindell's avatar
rswindell committed
705
706
707
	"~ TIC File Password ~\n\n"
	"This is an optional password that ticket.js will use for creating\n"
	"and authenticating `.TIC` files to/from this node.\n";
708
709
710
711
712
713
714
								uifc.input(WIN_MID|WIN_SAV,0,0
									,"TIC File Password (optional)"
									,cfg.nodecfg[i].ticpwd,sizeof(cfg.nodecfg[i].ticpwd)-1
									,K_EDIT|K_UPPER);
								break;
							case 6:
	uifc.helpbuf=
rswindell's avatar
rswindell committed
715
716
717
	"~ AreaFix Password ~\n\n"
	"This is the password that will be used by this node when doing remote\n"
	"AreaManager / AreaFix functions.\n";
718
								uifc.input(WIN_MID|WIN_SAV,0,0
rswindell's avatar
rswindell committed
719
									,"AreaFix Password"
rswindell's avatar
rswindell committed
720
721
									,cfg.nodecfg[i].password,sizeof(cfg.nodecfg[i].password)-1
									,K_EDIT|K_UPPER);
722
								break;
723
							case 7:
724
	uifc.helpbuf=
rswindell's avatar
rswindell committed
725
726
727
	"~ AreaFix Keys ~\n\n"
	"These are a named-keys to be given to this node allowing access to one or\n"
	"more of the configured `EchoLists`\n";
728
								while(1) {
rswindell's avatar
rswindell committed
729
730
									for(j=0; cfg.nodecfg[i].keys!=NULL && cfg.nodecfg[i].keys[j]!=NULL ;j++)
										strcpy(opt[j],cfg.nodecfg[i].keys[j]);
731
732
733
									opt[j][0]=0;
									k=uifc.list(WIN_SAV|WIN_INS|WIN_DEL|WIN_ACT|
										WIN_XTR|WIN_INSACT|WIN_DELACT|WIN_RHT
rswindell's avatar
rswindell committed
734
										,0,0,0,&k,0,"AreaFix Keys",opt);
735
736
737
738
739
									if(k==-1)
										break;
									if((k&MSK_ON)==MSK_INS) {
										k&=MSK_OFF;
										if(uifc.input(WIN_MID|WIN_SAV,0,0
rswindell's avatar
rswindell committed
740
											,"AreaFix Key",str,SBBSECHO_MAX_KEY_LEN
rswindell's avatar
rswindell committed
741
											,K_UPPER)<1)
742
											continue;
rswindell's avatar
rswindell committed
743
744
										strListInsert(&cfg.nodecfg[i].keys, str, k);
										uifc.changes=TRUE;
745
746
										continue; 
									}
747
748
749

									if((k&MSK_ON)==MSK_DEL) {
										k&=MSK_OFF;
rswindell's avatar
rswindell committed
750
751
										strListRemove(&cfg.nodecfg[i].keys, k);
										uifc.changes=TRUE;
752
753
										continue; 
									}
rswindell's avatar
rswindell committed
754
									SAFECOPY(str,cfg.nodecfg[i].keys[k]);
rswindell's avatar
rswindell committed
755
									uifc.input(WIN_MID|WIN_SAV,0,0,"AreaFix Key"
rswindell's avatar
rswindell committed
756
757
758
										,str,SBBSECHO_MAX_KEY_LEN,K_EDIT|K_UPPER);
									strListReplace(cfg.nodecfg[i].keys, k, str);
									uifc.changes=TRUE;
759
760
									continue; 
								}
761
								break;
762
							case 8:
rswindell's avatar
rswindell committed
763
	uifc.helpbuf=
rswindell's avatar
rswindell committed
764
765
	"~ Mail Status ~\n\n"
	"Set the mail status for this node: `Normal`, `Hold`, or `Crash`.\n";
rswindell's avatar
rswindell committed
766
767
768
769
770
771
772
773
774
								j=cfg.nodecfg[i].status;
								k=uifc.list(WIN_RHT|WIN_SAV,0,0,0,&j,0,"Mail Status"
									,mailStatusStringList);
								if(k==-1)
									break;
								if(cfg.nodecfg[i].status!=k) {
									cfg.nodecfg[i].status=k;
									uifc.changes=TRUE;
								}
775
								break;
776
							case 9:
rswindell's avatar
rswindell committed
777
778
779
780
781
782
								k = !cfg.nodecfg[i].direct;
								switch(uifc.list(WIN_MID|WIN_SAV,0,0,0,&k,0
									,"Direct Delivery",uifcYesNoOpts)) {
									case 0:	cfg.nodecfg[i].direct = true;	uifc.changes=TRUE; break;
									case 1:	cfg.nodecfg[i].direct = false;	uifc.changes=TRUE; break;
								}
783
								break;
784
							case 10:
rswindell's avatar
rswindell committed
785
786
787
788
789
790
								k = !cfg.nodecfg[i].passive;
								switch(uifc.list(WIN_MID|WIN_SAV,0,0,0,&k,0
									,"Passive Node",uifcYesNoOpts)) {
									case 0:	cfg.nodecfg[i].passive = true;	uifc.changes=TRUE; break;
									case 1:	cfg.nodecfg[i].passive = false;	uifc.changes=TRUE; break;
								}
791
								break;
792
							case 11:
rswindell's avatar
rswindell committed
793
794
795
796
797
798
799
								k = !cfg.nodecfg[i].send_notify;
								switch(uifc.list(WIN_MID|WIN_SAV,0,0,0,&k,0
									,"Send AreaFix Notifications",uifcYesNoOpts)) {
									case 0:	cfg.nodecfg[i].send_notify = true;	uifc.changes=TRUE; break;
									case 1:	cfg.nodecfg[i].send_notify = false;	uifc.changes=TRUE; break;
								}
								break;
800
							case 12:
801
	uifc.helpbuf=
rswindell's avatar
rswindell committed
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
	"~ Uplink for Message Groups ~\n\n"
	"These are Message Group short names (as configured in SCFG) for which\n"
	"this linked-node is your system's uplink (hub).\n"
	"\n"
	"Use of this setting allows your hub to be automatically linked with new\n"
	"areas when new Sub-boards (within a listed group) are auto-added to the\n"
	"Area File."
	;
								while(1) {
									for(j=0; cfg.nodecfg[i].grphub!=NULL && cfg.nodecfg[i].grphub[j]!=NULL ;j++)
										strcpy(opt[j],cfg.nodecfg[i].grphub[j]);
									opt[j][0]=0;
									k=uifc.list(WIN_SAV|WIN_INS|WIN_DEL|WIN_ACT|
										WIN_XTR|WIN_INSACT|WIN_DELACT|WIN_RHT
										,0,0,0,&k,0,"Uplink for Message Groups",opt);
									if(k==-1)
										break;
									if((k&MSK_ON)==MSK_INS) {
										k&=MSK_OFF;
										if(uifc.input(WIN_MID|WIN_SAV,0,0
											,"Message Group (short name)",str,LEN_GSNAME
											,/* kmode: */0) < 1)
											continue;
										strListInsert(&cfg.nodecfg[i].grphub, str, k);
										uifc.changes=TRUE;
										continue; 
									}

									if((k&MSK_ON)==MSK_DEL) {
										k&=MSK_OFF;
										strListRemove(&cfg.nodecfg[i].grphub, k);
										uifc.changes=TRUE;
										continue; 
									}
									SAFECOPY(str,cfg.nodecfg[i].grphub[k]);
									uifc.input(WIN_MID|WIN_SAV,0,0,"Message Group (short name)"
										,str,LEN_GSNAME,K_EDIT|K_UPPER);
									strListReplace(cfg.nodecfg[i].grphub, k, str);
									uifc.changes=TRUE;
									continue; 
								}
								break;
							case 13:
	uifc.helpbuf=
	"~ Route To ~\n\n"
	"When using a BSO/FLO type mailer, this is the Fido address to route mail\n"
	"for this node(s) to.\n"
	"\n"
	"This option is normally only used with wildcard type node entries\n"
	"(e.g. `ALL`, or `1:ALL`, `2:ALL`, etc.) and is used to route non-direct\n"
	"NetMail packets to your uplink node (hub).\n";
rswindell's avatar
rswindell committed
853
854
								strcpy(str,faddrtoa(&cfg.nodecfg[i].route));
								if(uifc.input(WIN_MID|WIN_SAV,0,0
855
									,"Node Address to Route To",str
rswindell's avatar
rswindell committed
856
									,25,K_EDIT) >= 0) {
857
858
									if(str[0])
										cfg.nodecfg[i].route=atofaddr(str);
859
860
									else
										cfg.nodecfg[i].route.zone=0;
rswindell's avatar
rswindell committed
861
862
863
									uifc.changes=TRUE;
								}
								break;
rswindell's avatar
rswindell committed
864
							case 14:
rswindell's avatar
rswindell committed
865
866
867
868
								uifc.input(WIN_MID|WIN_SAV,0,0,"Inbound FileBox Directory"
									,cfg.nodecfg[i].inbox, sizeof(cfg.nodecfg[i].inbox)-1
									,K_EDIT);
								break;
rswindell's avatar
rswindell committed
869
							case 15:
rswindell's avatar
rswindell committed
870
871
872
								uifc.input(WIN_MID|WIN_SAV,0,0,"Outbound FileBox Directory"
									,cfg.nodecfg[i].outbox, sizeof(cfg.nodecfg[i].outbox)-1
									,K_EDIT);
873
								break;
874
875
876
						} 
					} 
				}
877
878
				break;

rswindell's avatar
rswindell committed
879
			case 5:	/* Paths and Filenames... */
880
				j=0;
881
				while(1) {
882
					i=0;
883
					snprintf(opt[i++],MAX_OPLN-1,"%-30.30s %s","Non-secure Inbound Directory"
rswindell's avatar
rswindell committed
884
						,cfg.inbound[0] ? cfg.inbound : DEFAULT_INBOUND);
rswindell's avatar
rswindell committed
885
					snprintf(opt[i++],MAX_OPLN-1,"%-30.30s %s","Secure Inbound Directory"
rswindell's avatar
rswindell committed
886
						,cfg.secure_inbound[0] ? cfg.secure_inbound : DEFAULT_SECURE_INBOUND);
rswindell's avatar
rswindell committed
887
					snprintf(opt[i++],MAX_OPLN-1,"%-30.30s %s","Outbound Directory"
rswindell's avatar
rswindell committed
888
						,cfg.outbound[0] ? cfg.outbound : DEFAULT_OUTBOUND);
rswindell's avatar
rswindell committed
889
					snprintf(opt[i++],MAX_OPLN-1,"%-30.30s %s","Area File"
rswindell's avatar
rswindell committed
890
						,cfg.areafile[0] ? cfg.areafile : DEFAULT_AREA_FILE);
rswindell's avatar
rswindell committed
891
					snprintf(opt[i++],MAX_OPLN-1,"%-30.30s %s","Bad Area File"
rswindell's avatar
rswindell committed
892
						,cfg.badareafile[0] ? cfg.badareafile : DEFAULT_BAD_AREA_FILE);
rswindell's avatar
rswindell committed
893
					snprintf(opt[i++],MAX_OPLN-1,"%-30.30s %s","Log File"
rswindell's avatar
rswindell committed
894
895
896
						,cfg.logfile[0] ? cfg.logfile : DEFAULT_LOG_FILE);
					snprintf(opt[i++],MAX_OPLN-1,"%-30.30s %s","Echo Statistics File"
						,cfg.echostats[0] ? cfg.echostats : DEFAULT_ECHOSTATS_FILE);
897
					snprintf(opt[i++],MAX_OPLN-1,"%-30.30s %s","Temporary File Directory"
rswindell's avatar
rswindell committed
898
899
900
						,cfg.temp_dir[0] ? cfg.temp_dir	: DEFAULT_TEMP_DIR);
					snprintf(opt[i++],MAX_OPLN-1,"%-30.30s %s","Outgoing Semaphore File"
						,cfg.outgoing_sem);
rswindell's avatar
rswindell committed
901
					opt[i][0]=0;
902
					uifc.helpbuf=
rswindell's avatar
rswindell committed
903
904
905
906
						"~ Paths and Filenames ~\n\n"
						"From this menu you can configure the paths and filenames that SBBSecho\n"
						"will use during its operation (e.g. importing and exporting messages).\n";
					j=uifc.list(WIN_BOT|WIN_L2R|WIN_ACT|WIN_SAV,0,0,0,&path_opt,0
907
908
						,"Paths and Filenames",opt);
					if(j==-1)
909
						break;
910
					switch(j) {
911
						case 0:
912
	uifc.helpbuf=
rswindell's avatar
rswindell committed
913
914
915
916
917
918
	"~ Non-secure Inbound Directory ~\n\n"
	"This is the path where your FTN mailer stores, and where SBBSecho will\n"
	"look for, incoming files (potentially including message bundles and\n"
	"packets) from unauthenticated (non-secure) mailer sessions.\n"
	"\n"
	"Default value is `" DEFAULT_INBOUND "`."
rswindell's avatar
rswindell committed
919
	;
rswindell's avatar
rswindell committed
920
							uifc.input(WIN_L2R|WIN_SAV,0,0,"Non-secure Inbound Directory"
rswindell's avatar
rswindell committed
921
922
								,cfg.inbound,sizeof(cfg.inbound)-1
								,K_EDIT);
923
							break;
924

925
						case 1:
926
	uifc.helpbuf=
rswindell's avatar
rswindell committed
927
928
929
930
931
932
933
934
	"~ Secure Inbound Directory ~\n\n"
	"This is the path where your FTN mailer stores, and where SBBSecho will\n"
	"look for, incoming message bundles and packets for `Secure` (password\n"
	"protected) sessions.\n"
	"\n"
	"Default value is `" DEFAULT_SECURE_INBOUND "`."
	;
							uifc.input(WIN_L2R|WIN_SAV,0,0,"Secure Inbound Directory"
rswindell's avatar
rswindell committed
935
936
								,cfg.secure_inbound,sizeof(cfg.secure_inbound)-1
								,K_EDIT);
937
							break;
938

939
						case 2:
940
	uifc.helpbuf=
rswindell's avatar
rswindell committed
941
942
943
944
945
	"~ Outbound Directory ~\n\n"
	"This is the path where your FTN mailer will look for, and where SBBSecho\n"
	"will place, outgoing message bundles and packets.\n"
	"\n"
	"In Binkley-Style Outbound mode, this serves as the base directory\n"
rswindell's avatar
rswindell committed
946
	"name for special foreign zone and point destination nodes as well."
rswindell's avatar
rswindell committed
947
948
	"\n"
	"Default value is `" DEFAULT_OUTBOUND "`."
rswindell's avatar
rswindell committed
949
	;
rswindell's avatar
rswindell committed
950
							uifc.input(WIN_L2R|WIN_SAV,0,0,"Outbound Directory"
rswindell's avatar
rswindell committed
951
952
								,cfg.outbound,sizeof(cfg.outbound)-1
								,K_EDIT);
953
							break;
954

955
						case 3:
956
	uifc.helpbuf=
rswindell's avatar
rswindell committed
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
	"~ Area File ~\n\n"
	"This is the path of the file SBBSecho will use as your primary\n"
	"list of FidoNet-style message areas (default is `data/areas.bbs`).\n"
	"\n"
	"Each line in the file defines an FTN message area (echo) of the format:\n"
	"\n"
	"   <`code`> <`tag`> [[`link`] [`link`] [...]]\n"
	"\n"
	"Each field is separated by one or more white-space characters:\n"
	"\n"
	"   `<code>` is the Synchronet `internal code` for the local sub-board\n"
	"   `<tag>`  is the network's agreed-upon `echo tag` for the message area\n"
	"   `[link]` is an `FTN address` to send and receive messages for this area\n"
	"          (there may be many linked nodes for each area)\n"
	"          (often your FTN uplink/hub may be the only linked node)\n"
	"\n"
	"Example Area Line:\n"
	"\n"
	"   `FIDO_BBS_CARN    BBS_CARNIVAL                        1:218/700`\n"
	"\n"
	"Notes:\n"
	"\n"
	" `*` Only the `<code>` and `<tag>` fields are required\n"
	" `*` The `<code>` and `<tag>` fields are case in-sensitive\n"
	" `*` The `[link]` fields must be 2D, 3D, or 4D FidoNet-style node addresses\n"
	" `*` The '`<`' and '`>`', '`[`' and '`]`' characters are not part of the syntax\n"
	" `*` Lines beginning with a semicolon (`;`) are ignored (i.e. comments)\n"
	" `*` Leading white-space characters are ignored\n"
	" `*` Blank lines are ignored\n"
	" `*` A `<tag>` value of `*` indicates a `bad echo` (unknown) area\n"
	" `*` A `<code>` value of `P` indicates a pass-through message area\n"
	" `*` This file may be import/exported to/from your `Message Areas` in `SCFG`\n"
	" `*` This file may be remotely modified by authorized nodes using `AreaFix`\n"
	"\n"
	"Default value is `" DEFAULT_AREA_FILE "`."
rswindell's avatar
rswindell committed
992
	;
rswindell's avatar
rswindell committed
993
							uifc.input(WIN_L2R|WIN_SAV,0,0,"Area File"
rswindell's avatar
rswindell committed
994
995
								,cfg.areafile,sizeof(cfg.areafile)-1
								,K_EDIT);
996
							break;
997

998
						case 4:
999
	uifc.helpbuf=
rswindell's avatar
rswindell committed
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
	"~ Bad Area File ~\n\n"
	"This is the path of the file SBBSecho will use to record the names\n"
	"(echo tags) and descriptions of FTN message areas (echoes) that your\n"
	"system has received EchoMail for, but does not carry locally. The\n"
	"default path/filename is `" DEFAULT_BAD_AREA_FILE "`.\n"
	"\n"
	"Notes:\n"
	"\n"
	" `*` The descriptions of the areas will only be included if the\n"
	"   corresponding echo tags can be located in one of your configured\n"
	"   `EchoLists`.\n"
	"\n"
	" `*` The format of the file is the same as `BACKBONE.NA` and suitable for\n"
	"   importing into a Synchronet Message Group using `SCFG`.\n"
	"\n"
	" `*` SBBSecho will automatically sort and maintain this list, removing\n"
	"   areas if they are added to your configuration (`SCFG->Message Areas`)\n"
	"   and your `Area File`.\n"
rswindell's avatar
rswindell committed
1018
	;
rswindell's avatar
rswindell committed
1019
							uifc.input(WIN_L2R|WIN_SAV,0,0,"Bad Area File"
rswindell's avatar
rswindell committed
1020
1021
1022
1023
1024
1025
								,cfg.badareafile,sizeof(cfg.badareafile)-1
								,K_EDIT);
							break;

						case 5:
	uifc.helpbuf=
rswindell's avatar
rswindell committed
1026
1027
1028
	"~ Log File ~\n\n"
	"This is the path of the file SBBSecho will use to log information each\n"
	"time it is run (default is `" DEFAULT_LOG_FILE "`)."
1029
	;
rswindell's avatar
rswindell committed
1030
							uifc.input(WIN_L2R|WIN_SAV,0,0,"Log File"
rswindell's avatar
rswindell committed
1031
1032
								,cfg.logfile,sizeof(cfg.logfile)-1
								,K_EDIT);
1033
							break; 
rswindell's avatar
rswindell committed
1034
1035

						case 6:
1036
	uifc.helpbuf=
rswindell's avatar
rswindell committed
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
	"~ EchoStats File ~\n\n"
	"This is the path of the file SBBSecho will use to track statistics for\n"
	"EchoMail message areas (default is `" DEFAULT_ECHOSTATS_FILE "`)."
	;
							uifc.input(WIN_L2R|WIN_SAV,0,0,"EchoStats File"
								,cfg.echostats,sizeof(cfg.echostats)-1
								,K_EDIT);
							break; 

						case 7:
	uifc.helpbuf=
	"~ Temporary File Directory ~\n\n"
	"This is the directory where SBBSecho will store temporary files that\n"
	"it creates and uses during its run-time (default is `" DEFAULT_TEMP_DIR "`)."
1051
	;
rswindell's avatar
rswindell committed
1052
							uifc.input(WIN_L2R|WIN_SAV,0,0,"Temp Dir"
1053
1054
1055
								,cfg.temp_dir,sizeof(cfg.temp_dir)-1
								,K_EDIT);
							break; 
rswindell's avatar
rswindell committed
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066

						case 8:
	uifc.helpbuf=
	"~ Outgoing Semaphore File ~\n\n"
	"This is an optional file to create/touch whenever there are new outbound\n"
	"files created or updated by SBBSecho."
	;
							uifc.input(WIN_L2R|WIN_SAV,0,0,"Outgoing Sem File"
								,cfg.outgoing_sem,sizeof(cfg.outgoing_sem)-1
								,K_EDIT);
							break; 
1067
1068
					} 
				}
1069
				break;
rswindell's avatar
rswindell committed
1070

rswindell's avatar
rswindell committed
1071
			case 3:	/* NetMail Settings */
1072
1073
				j=0;
				while(1) {
rswindell's avatar
rswindell committed
1074
					uifc.helpbuf=
rswindell's avatar
rswindell committed
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
	"~ NetMail Settings ~\n"
	"\n"
	"`Sysop Aliases` is a comma-separated list of names by which the sysop\n"
	"    (user #1) may receive NetMail messages, in addition to the alias\n"
	"    and real name associated with their BBS user account.\n"
	"    This setting defaults to just '`SYSOP`'.\n"
	"\n"
    "`Default Recipient` is the name of the user account you wish to receive\n"
	"    inbound NetMail messages that have been addressed to an unrecognized\n"
	"    user name or alias.\n"
	"\n"
	"`Fuzzy Zone Operation` when set to `Yes`, if SBBSecho receives an inbound\n"
	"    netmail with no international zone information, it will compare the\n"
	"    net/node of the destination to the net/node information in your AKAs\n"
	"    and assume the zone of a matching AKA.\n"
	"    This setting defaults to `No`.\n"
	"\n"
	"`Kill/Ignore Empty NetMail Messages` will instruct SBBSecho to simply\n"
	"    discard (not import or export) NetMail messages without any body.\n"
	"    This setting defaults to `Yes`.\n"
	"\n"
	"`Delete Processed NetMail Messages` will instruct SBBSecho to delete\n"
	"    NetMail messages/files after they have been sent or imported.\n"
	"    When set to `No`, SBBSecho will mark them as Sent or Received instead.\n"
	"    This setting defaults to `Yes`.\n"
	"\n"
	"`Ignore NetMail Destination Address` will instruct SBBSecho to treat\n"
	"    all NetMail as though it is destined for one of your systems's FTN\n"
	"    addresses (AKAs) and potentially import it.\n"
	"    This setting defaults to `No`.\n"
	"\n"
	"`Ignore Netmail 'Sent' Attribute` will instruct SBBSecho to export\n"
	"    NetMail messages even when their 'Sent' attribute flag is set.\n"
	"    This setting `should not` be set to `Yes` when `Delete NetMail` is\n"
	"    disabled.\n"
	"    This setting defaults to `No`.\n"
	"\n"
	"`Ignore Netmail 'Received' Attribute` will instruct SBBSecho to import\n"
	"    NetMail messages even when their 'Received' attribute flag is set.\n"
	"    This setting defaults to `No`.\n"
	"\n"
	"`Ignore NetMail 'Local' Attribute` will instruct SBBSecho to import\n"
	"    NetMail messages even when their 'Local' attribute flag is set.\n"
	"    This setting defaults to `No`.\n"
	"\n"
	"`Maximum Age of Imported NetMail` allows you to optionally set an age\n"
	"    limit of NetMail messages that may be imported.\n"
	"    This setting defaults to `None` (no maximum age).\n"
rswindell's avatar
rswindell committed
1123
;
1124
					i=0;
rswindell's avatar
rswindell committed
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
					strListCombine(cfg.sysop_alias_list, sysop_aliases, sizeof(sysop_aliases)-1, ",");
					snprintf(opt[i++],MAX_OPLN-1,"%-40.40s%s", "Sysop Aliases",sysop_aliases);
					snprintf(opt[i++],MAX_OPLN-1,"%-40.40s%s", "Default Recipient"
						,cfg.default_recipient);
					snprintf(opt[i++],MAX_OPLN-1,"%-40.40s%-3.3s","Fuzzy Zone Operation"
						,cfg.fuzzy_zone ? "Yes":"No");
					snprintf(opt[i++],MAX_OPLN-1,"%-40.40s%-3.3s","Kill/Ignore Empty NetMail "
						"Messages",cfg.kill_empty_netmail ? "Yes":"No");
					snprintf(opt[i++],MAX_OPLN-1,"%-40.40s%-3.3s","Delete Processed NetMail"
						,cfg.delete_netmail ? "Yes":"No");
					snprintf(opt[i++],MAX_OPLN-1,"%-40.40s%-3.3s","Ignore NetMail Destination Address"
						,cfg.ignore_netmail_dest_addr ? "Yes" : "No");
1137
1138
					snprintf(opt[i++],MAX_OPLN-1,"%-40.40s%-3.3s","Ignore NetMail 'Sent' Attribute"
						,cfg.ignore_netmail_sent_attr ? "Yes" : "No");
rswindell's avatar
rswindell committed
1139
1140
1141
1142
1143
					snprintf(opt[i++],MAX_OPLN-1,"%-40.40s%-3.3s","Ignore NetMail 'Received' Attribute"
						,cfg.ignore_netmail_recv_attr ? "Yes" : "No");
					snprintf(opt[i++],MAX_OPLN-1,"%-40.40s%-3.3s","Ignore NetMail 'Local' Attribute"
						,cfg.ignore_netmail_local_attr ? "Yes" : "No");
					if(cfg.max_netmail_age)
rswindell's avatar
rswindell committed
1144
						duration_to_vstr(cfg.max_netmail_age, str, sizeof(str));
rswindell's avatar
rswindell committed
1145
1146
1147
					else
						strcpy(str, "None");
					snprintf(opt[i++],MAX_OPLN-1,"%-40.40s%s","Maximum Age of Imported NetMail"	, str);
rswindell's avatar
rswindell committed
1148
					opt[i][0]=0;
rswindell's avatar
rswindell committed
1149
					j=uifc.list(WIN_ACT|WIN_SAV,0,0,0,&netmail_opt,0,"NetMail Settings",opt);
1150
1151
1152
1153
					if(j==-1)
						break;
					switch(j) {
						case 0:
rswindell's avatar
rswindell committed
1154
							uifc.helpbuf=
rswindell's avatar
rswindell committed
1155
1156
1157
1158
1159
							"~ Sysop Aliases ~\n\n"
							"This is a comma-separated list of additional `To` names that the sysop\n"
							"(user #1) can receive netmail by. When specifying multiple aliases,\n"
							"they must be separated by a single comma and no extra white-space\n"
							"(e.g. \"SYSOP,COORDINATOR\"). The default value is just `SYSOP`.\n";
rswindell's avatar
rswindell committed
1160
1161
1162
1163
1164
1165
							if(uifc.input(WIN_MID|WIN_BOT|WIN_SAV,0,0,"Sysop Aliases (comma separated)"
								,sysop_aliases
								,sizeof(sysop_aliases)-1,K_EDIT|K_UPPER) >= 0) {
								strListFree(&cfg.sysop_alias_list);
								cfg.sysop_alias_list = strListSplit(NULL, sysop_aliases, ",");
							}
1166
1167
							break;
						case 1:
rswindell's avatar
rswindell committed
1168
1169
1170
							uifc.input(WIN_MID|WIN_SAV,0,0,"Default Recipient"
								,cfg.default_recipient, sizeof(cfg.default_recipient)-1
								,K_EDIT|K_UPPER);
1171
1172
							break;
						case 2:
rswindell's avatar
rswindell committed
1173
1174
1175
1176
1177
1178
							k = !cfg.fuzzy_zone;
							switch(uifc.list(WIN_MID|WIN_SAV,0,0,0,&k,0
								,"Fuzzy Zone Operation",uifcYesNoOpts)) {
								case 0:	cfg.fuzzy_zone = true;	break;
								case 1:	cfg.fuzzy_zone = false;	break;
							}
1179
1180
							break;
						case 3:
rswindell's avatar
rswindell committed
1181
1182
1183
1184
1185
1186
							k = !cfg.kill_empty_netmail;
							switch(uifc.list(WIN_MID|WIN_SAV,0,0,0,&k,0
								,"Delete Empty NetMail",uifcYesNoOpts)) {
								case 0:	cfg.kill_empty_netmail = true;	break;
								case 1:	cfg.kill_empty_netmail = false;	break;
							}
1187
1188
							break;
						case 4:
rswindell's avatar
rswindell committed
1189
1190
1191
1192
1193
1194
							k = !cfg.delete_netmail;
							switch(uifc.list(WIN_MID|WIN_SAV,0,0,0,&k,0
								,"Delete Processed NetMail",uifcYesNoOpts)) {
								case 0:	cfg.delete_netmail = true;	break;
								case 1:	cfg.delete_netmail = false;	break;
							}
1195
1196
							break;
						case 5:
rswindell's avatar
rswindell committed
1197
1198
1199
1200
1201
1202
							k = !cfg.ignore_netmail_dest_addr;
							switch(uifc.list(WIN_MID|WIN_SAV,0,0,0,&k,0
								,"Ignore NetMail Destination Address",uifcYesNoOpts)) {
								case 0:	cfg.ignore_netmail_dest_addr = true;	break;
								case 1:	cfg.ignore_netmail_dest_addr = false;	break;
							}
1203
1204
							break;
						case 6:
1205
1206
1207
1208
1209
1210
1211
1212
							k = !cfg.ignore_netmail_sent_attr;
							switch(uifc.list(WIN_MID|WIN_SAV,0,0,0,&k,0
								,"Ignore NetMail 'Sent' Attribute",uifcYesNoOpts)) {
								case 0:	cfg.ignore_netmail_sent_attr = true;	break;
								case 1:	cfg.ignore_netmail_sent_attr = false;	break;
							}
							break;
						case 7:
rswindell's avatar
rswindell committed
1213
1214
1215