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

/* $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
/* These correlate with the LOG_* definitions in syslog.h/gen_defs.h */
rswindell's avatar
rswindell committed
65
static char* logLevelStringList[]
66
	= {"Emergency", "Alert", "Critical", "Error", "Warning", "Notice", "Informational", "Debugging", NULL};
67

rswindell's avatar
rswindell committed
68
69
70
71
72
73
74
75
void global_settings(void)
{
	static int global_opt;

	while(1) {
		int i = 0;
		char str[128];
		char duration[64];
76
		sprintf(opt[i++], "%-30s %s", "Mailer Type"
rswindell's avatar
rswindell committed
77
			,cfg.flo_mailer ? "Binkley/FLO":"ArcMail/Attach");
78
79
80
81
82
		sprintf(opt[i++], "%-30s %s", "Log Level", logLevelStringList[cfg.log_level]);
		sprintf(opt[i++], "%-30s %s", "Log Timestamp Format", cfg.logtime);
		sprintf(opt[i++], "%-30s %s", "Strict Packet Passwords", cfg.strict_packet_passwords ? "Enabled" : "Disabled");
		sprintf(opt[i++], "%-30s %u", "Config File Backups", cfg.cfgfile_backups);
		sprintf(opt[i++], "%-30s %s bytes", "Minimum Free Disk Space"
83
			, byte_count_to_str(cfg.min_free_diskspace, str, sizeof(str)));
84

85
		snprintf(opt[i++],MAX_OPLN-1,"%-30s %-3.3s","Strip Incoming Soft CRs "
86
			,cfg.strip_soft_cr ? "Yes":"No");
87
		snprintf(opt[i++],MAX_OPLN-1,"%-30s %-3.3s","Strip Outgoing Line Feeds "
88
			,cfg.strip_lf ? "Yes":"No");
89
90
		snprintf(opt[i++],MAX_OPLN-1,"%-30s %-3.3s","Auto-detect UTF-8 Messages "
			,cfg.auto_utf8 ? "Yes":"No");
91
92
		snprintf(opt[i++],MAX_OPLN-1,"%-30s %-3.3s","Use Outboxes for Mail Files "
			,cfg.use_outboxes ? "Yes":"No");
93

94
		sprintf(opt[i++], "%-30s %s", "BSY Mutex File Timeout", duration_to_vstr(cfg.bsy_timeout, duration, sizeof(duration)));
95
		if(cfg.flo_mailer) {
96
97
98
99
100
101
			sprintf(opt[i++], "%-30s %s", "BSO Lock Attempt Delay", duration_to_vstr(cfg.bso_lock_delay, duration, sizeof(duration)));
			sprintf(opt[i++], "%-30s %lu", "BSO Lock Attempt Limit", cfg.bso_lock_attempts);
			sprintf(opt[i++], "%-30s %s", "BinkP Capabilities", cfg.binkp_caps);
			sprintf(opt[i++], "%-30s %s", "BinkP Sysop Name", cfg.binkp_sysop);
			sprintf(opt[i++], "%-30s %s", "BinkP Authentication", cfg.binkp_plainAuthOnly ? "Plain Only" : "Plain or CRAM-MD5");
			sprintf(opt[i++], "%-30s %s", "BinkP Encryption", !cfg.binkp_plainTextOnly && !cfg.binkp_plainAuthOnly ? "Supported" : "Unsupported");
102
		}
rswindell's avatar
rswindell committed
103
104
105
106
107
108
109
110
111
		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"
112
			"    operation in SBBSecho is much more widely tested and supported.\n"
rswindell's avatar
rswindell committed
113
114
115
116
117
118
119
120
121
122
123
124
125
			"\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"
126
127
			"    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"
rswindell's avatar
rswindell committed
128
129
130
131
			"    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"
132
133
134
135
			"`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 FidoNet Config (`echocfg`) and SBBSecho AreaFix.\n"
			"\n"
136
137
138
139
140
			"`Minimum Free Disk Space` determines the minimum amount of free disk\n"
			"    space for SBBSecho to run.  SBBSecho will just exit with an error\n"
			"    message (and an error level of 1) if the minimum amount of free\n"
			"    space is not found in directories into which SBBSecho may write.\n"
			"\n"
141
142
143
144
145
146
147
148
			"`Strip Incoming Soft CRs` instructs SBBSecho to remove any \"Soft\"\n"
			"    Carriage Return (ASCII 141) characters from the text of `imported`\n"
			"    EchoMail and NetMail messages.\n"
			"\n"
			"`Strip Outgoing Line Feeds` instructs SBBSecho to remove any Line Feed\n"
			"    (ASCII 10) characters from the body text of `exported` EchoMail and\n"
			"    NetMail messages.\n"
			"\n"
149
150
151
152
153
			"`Auto-detect UTF-8 Messages` instructs SBBSecho to treat incoming\n"
			"    messages which lack a CHRS/CHARSET control line and contain valid\n"
			"    UTF-8 character sequences in the message text, as UTF-8 encoded\n"
			"    messages.\n"
			"\n"
154
155
156
157
158
159
160
161
			"`Use Outboxes for Mail Files` instructs SBBSecho to place outbound\n"
			"    NetMail and EchoMail files into the configured `Outbox Directory`\n"
			"    of the relevant linked node. If the linked node has no configured\n"
			"    outbox, then outbound mail files for that node are placed in the\n"
			"    normal outbound directory hierarchy.  The BinkIT mailer will\n"
			"    send files from configured outboxes in addition to the normal\n"
			"    outbound directories, even when this option is set to `No`.\n"
			"\n"
rswindell's avatar
rswindell committed
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
			"`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"
180
181
182
183
184
			"`BinkP Capabilities` may be used to over-ride the default BinkP node\n"
			"    capabilities sent during a `BinkIT` mailer session (via the NDL\n"
			"    command). Default capabilities value is '115200,TCP,BINKP'\n"
			"\n"
			"`BinkP Sysop` may be used to over-ride the default BinkP sysop name\n"
185
			"    sent during a `BinkIT` mailer session (via the ZYZ command).\n"
186
			"    Default sysop name is that set in `SCFG->System->Operator`\n"
187
188
189
190
191
			"\n"
			"`BinkP Authentication` may be set to `Plain Only` if you wish to disable\n"
			"    CRAM-MD5 authentication for both inbound and outbound sessions.\n"
		    "    Note: CRAM-MD5 authentication is required for encrypted sessions.\n"
			"    Default: Plain or CRAM-MD5\n"
192
193
194
195
			"\n"
			"`BinkP Encryption` may be set to `Supported` (the default) only when\n"
			"    BinkP Authentication is set to Plain or CRAM-MD5.\n"
			"    Default: Supported\n"
rswindell's avatar
rswindell committed
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
			;

		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:
231
232
233
234
235
236
				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;

			case 5:
237
238
239
240
241
242
				byte_count_to_str(cfg.min_free_diskspace, str, sizeof(str));
				if(uifc.input(WIN_MID|WIN_SAV, 0, 0, "Minimum Free Disk Space (in bytes)", str, 10, K_EDIT) > 0)
					cfg.min_free_diskspace = parse_byte_count(str, 1);
				break;

			case 6:
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
			{
				int k = !cfg.strip_soft_cr;
				switch(uifc.list(WIN_MID|WIN_SAV,0,0,0,&k,0
					,"Strip Soft Carriage Returns from Incoming Messages",uifcYesNoOpts)) {
					case 0:	cfg.strip_soft_cr = true;	break;
					case 1:	cfg.strip_soft_cr = false;	break;
				}
				break;
			}
			case 7:
			{
				int k = !cfg.strip_lf;
				switch(uifc.list(WIN_MID|WIN_SAV,0,0,0,&k,0
					,"Strip Line Feeds from Outgoing Messages",uifcYesNoOpts)) {
					case 0:	cfg.strip_lf = true;	break;
					case 1:	cfg.strip_lf = false;	break;
				}
				break;
			}
			case 8:
263
264
265
266
267
268
269
270
271
272
			{
				int k = !cfg.auto_utf8;
				switch(uifc.list(WIN_MID|WIN_SAV,0,0,0,&k,0
					,"Auto-detect incoming UTF-8 encoded messages",uifcYesNoOpts)) {
					case 0:	cfg.auto_utf8 = true;	break;
					case 1:	cfg.auto_utf8 = false;	break;
				}
				break;
			}
			case 9:
273
274
275
276
277
278
279
280
281
			{
				int k = !cfg.use_outboxes;
				switch(uifc.list(WIN_MID|WIN_SAV,0,0,0,&k,0
					,"Use Outboxes for Outbound NetMail and EchoMail",uifcYesNoOpts)) {
					case 0:	cfg.use_outboxes = true;	break;
					case 1:	cfg.use_outboxes = false;	break;
				}
				break;
			}
282
			case 10:
rswindell's avatar
rswindell committed
283
284
285
286
287
				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;

288
			case 11:
rswindell's avatar
rswindell committed
289
290
291
292
293
				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;

294
			case 12:
295
				sprintf(str, "%lu", cfg.bso_lock_attempts);
rswindell's avatar
rswindell committed
296
297
298
299
				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;

300
			case 13:
301
				uifc.input(WIN_MID|WIN_SAV,0,0
302
					,"BinkP Capabilities (BinkIT)", cfg.binkp_caps, sizeof(cfg.binkp_caps)-1, K_EDIT);
303
304
				break;

305
			case 14:
306
				uifc.input(WIN_MID|WIN_SAV,0,0
307
					,"BinkP Sysop Name (BinkIT)", cfg.binkp_sysop, sizeof(cfg.binkp_sysop)-1, K_EDIT);
308
				break;
309

310
			case 15:
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
			{
				int k = !cfg.binkp_plainAuthOnly;
				strcpy(opt[0], "Plain-Password Only");
				strcpy(opt[1], "Plain-Password or CRAM-MD5");
				opt[2][0] = 0;
				switch(uifc.list(WIN_MID|WIN_SAV,0,0,0,&k,0
					,"BinkP Authentication",opt)) {
					case 0:
						cfg.binkp_plainAuthOnly = true;
						break;
					case 1:
						cfg.binkp_plainAuthOnly = false;
						break;
				}
				break;
			}
327

328
			case 16:
329
330
331
332
333
			{
				if(cfg.binkp_plainAuthOnly) {
					uifc.msg("CRAM-MD5 authentication/encryption has been disabled globally");
					break;
				}
334
				int k = cfg.binkp_plainTextOnly;
335
336
337
				switch(uifc.list(WIN_MID|WIN_SAV,0,0,0,&k,0
					,"BinkP Encryption Supported",uifcYesNoOpts)) {
					case 0:
338
						cfg.binkp_plainTextOnly = false;
339
340
						break;
					case 1:
341
						cfg.binkp_plainTextOnly = true;
342
343
344
345
						break;
				}
				break;
			}
rswindell's avatar
rswindell committed
346
347
348
349
		}
	}
}

350
351
352
static bool new_node(unsigned new_nodenum)
{
	nodecfg_t* nodecfg = realloc(cfg.nodecfg, sizeof(nodecfg_t)*(cfg.nodecfgs+1));
rswindell's avatar
rswindell committed
353

354
355
356
357
358
359
360
361
362
	if(nodecfg == NULL)
		return false;

	cfg.nodecfg = nodecfg;
	for(unsigned int i=cfg.nodecfgs; i > new_nodenum; i--)
		memcpy(&cfg.nodecfg[i], &cfg.nodecfg[i-1], sizeof(nodecfg_t));

	cfg.nodecfgs++;
	memset(&cfg.nodecfg[new_nodenum], 0, sizeof(nodecfg_t));
363
	cfg.nodecfg[new_nodenum].binkp_allowPlainText = true;
364
	cfg.nodecfg[new_nodenum].binkp_port = IPPORT_BINKP;
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
	return true;
}

static bool new_arcdef(unsigned new_arcnum)
{
	arcdef_t * arcdef = realloc(cfg.arcdef, sizeof(arcdef_t)*(cfg.arcdefs+1));

	if(arcdef == NULL)
		return false;

	cfg.arcdef = arcdef;

	for(unsigned j=cfg.arcdefs;j>new_arcnum;j--)
		memcpy(&cfg.arcdef[j],&cfg.arcdef[j-1], sizeof(arcdef_t));
	cfg.arcdefs++;
	memset(&cfg.arcdef[new_arcnum], 0, sizeof(arcdef_t));
	return true;
}

static bool new_list(unsigned new_listnum)
{
	echolist_t *listcfg = realloc(cfg.listcfg, sizeof(echolist_t)*(cfg.listcfgs+1));

	if(listcfg == NULL)
		return false;
	cfg.listcfg = listcfg;
	for(unsigned j=cfg.listcfgs;j>new_listnum;j--)
		memcpy(&cfg.listcfg[j],&cfg.listcfg[j-1], sizeof(echolist_t));
	cfg.listcfgs++;
	memset(&cfg.listcfg[new_listnum],0,sizeof(echolist_t));
	return true;
}

398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
static bool new_domain(unsigned new_domnum)
{
	struct fido_domain* new_list = realloc(cfg.domain_list, sizeof(struct fido_domain) * (cfg.domain_count + 1));
	if(new_list == NULL)
		return false;
	cfg.domain_list = new_list;
	for(unsigned i = cfg.domain_count; i > new_domnum; i--)
		memcpy(&cfg.domain_list[i], &cfg.domain_list[i-1], sizeof(struct fido_domain));
	cfg.domain_count++;
	memset(&cfg.domain_list[new_domnum], 0, sizeof(struct fido_domain));
	return true;
}

static char* int_list(int* list, unsigned count)
{
	static char str[128];

	str[0]=0;
	for(unsigned i = 0; i < count; i++) {
		if(i)
			sprintf(str + strlen(str), ",%d", *(list + i));
		else
			sprintf(str, "%d", *list);
	}

	return str;
}

void binkp_settings(nodecfg_t* node)
{
428
	static int cur;
429
430
431
432
433
434
435

	while(1) {
		char str[128];
		int i = 0;
		sprintf(opt[i++], "%-20s %s", "Host", node->binkp_host);
		sprintf(opt[i++], "%-20s %u", "Port", node->binkp_port);
		sprintf(opt[i++], "%-20s %s", "Poll", node->binkp_poll ? "Yes" : "No");
436
437
		char* auth = "Plain Only";
		char* crypt = "Unsupported";
438
		if(!cfg.binkp_plainAuthOnly && !node->binkp_plainAuthOnly) {
439
			if(!cfg.binkp_plainTextOnly)
440
				crypt = node->binkp_allowPlainText ? "Supported" : "Required";
441
442
443
444
445
446
447
			if(node->binkp_allowPlainAuth) 
				auth = "Plain or CRAM-MD5";
			else
				auth = "CRAM-MD5 Only";
		}
		sprintf(opt[i++], "%-20s %s", "Authentication", auth);
		sprintf(opt[i++], "%-20s %s", "Encryption", crypt);
448
		sprintf(opt[i++], "%-20s %s", "Implicit TLS", node->binkp_tls ? "Yes" : "No");
449
450
451
452
		sprintf(opt[i++], "%-20s %s", "Source Address", node->binkp_src);
		opt[i][0]=0;
		char title[128];
		SAFEPRINTF(title, "%s BinkP Settings", faddrtoa(&node->addr));
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
		uifc.helpbuf=
			"~ BinkP Settings ~\n"
			"\nThese settings are used by the Synchronet `BinkIT` BinkP/BSO mailer.\n"
			"\n"
			"`Host` defines the TCP/IP address or host name with which to connect for\n"
			"    sessions with this linked node.  If the host is not set, then a\n"
			"    DNS-based look-up will be attempted (e.g. the IP address for\n"
			"    `1:103/705` would be looked-up via host name `f705.n103.z1.binkp.net`).\n"
			"    Nodelist-based look-ups are also supported.\n"
			"\n"
			"`Port` defines the TCP port used by this linked node for BinkP sessions.\n"
			"    The default BinkP TCP port is `24554`.\n"
			"\n"
			"`Poll` defines whether or not to periodically poll this linked node.\n"
			"\n"
468
469
470
			"`Authentication` determines what types of authentication will be supported\n"
			"    during both inbound and outbound sessions with this linked node.\n"
			"    The supported BinkP-auth methods are `Plain-Password` and `CRAM-MD5`.\n"
471
472
			"    Note: For `incoming` connections, CRAM-MD5 will be supported unless\n"
			"    CRAM-MD5 authentication has been `globally` disabled.\n"
473
			"\n"
474
475
476
477
478
			"`Encryption` determines whether unencrypted data transfers will be\n"
			"    supported or required when communicating with this linked node.\n"
			"    With this setting set to `Required`, ~only~ BinkD-style-encrypted BinkP\n"
			"    sessions will be supported.\n"
			"    CRAM-MD5 authentication `must` be used when encrypting BinkP sessions.\n"
479
			"\n"
480
481
482
			"`Implicit TLS` defines whether or not to use `BINKPS` when connecting\n"
			"    (outbound) with this linked node.\n"
			"\n"
483
484
485
486
			"`Source Address` allows you to override the source FTN address used\n"
			"    with outgoing BinkP mailer sessions with this linked node.\n"
			"    Normally, this setting is left blank (not set).\n"
			;
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
		int k = uifc.list(WIN_RHT|WIN_BOT|WIN_SAV|WIN_ACT,0,0,0,&cur,0, title, opt);
		if(k < 0)
			break;
		switch(k) {
			case 0:
				uifc.input(WIN_MID|WIN_SAV,0,0
					,"Host name or IP address", node->binkp_host, sizeof(node->binkp_host)-1, K_EDIT);
				break;
			case 1:
				sprintf(str, "%u", node->binkp_port);
				if(uifc.input(WIN_MID|WIN_SAV,0,0
					,"TCP Port Number (e.g. 24554)", str, 5, K_EDIT|K_NUMBER) > 0) {
					node->binkp_port = atoi(str);
					uifc.changes = TRUE;
				}
				break;
			case 2:
				k = !node->binkp_poll;
				switch(uifc.list(WIN_MID|WIN_SAV,0,0,0,&k,0
					,"Poll This Node Periodically for Inbound Files/Mail",uifcYesNoOpts)) {
					case 0:	node->binkp_poll = true;	uifc.changes=TRUE; break;
					case 1:	node->binkp_poll = false;	uifc.changes=TRUE; break;
				}
				break;
			case 3:
512
				if(cfg.binkp_plainAuthOnly) {
513
					uifc.msg("CRAM-MD5 authentication/ has been disabled globally");
514
515
					break;
				}
516
517
518
519
520
				k = node->binkp_plainAuthOnly ? 0 : (1 + !node->binkp_allowPlainAuth);
				strcpy(opt[0], "Plain-Password Only");
				strcpy(opt[1], "Plain-Password or CRAM-MD5");
				strcpy(opt[2], "CRAM-MD5 Only");
				opt[3][0] = 0;
521
				switch(uifc.list(WIN_MID|WIN_SAV,0,0,0,&k,0
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
					,"Authentication",opt)) {
					case 0:	
						node->binkp_plainAuthOnly = true;
						node->binkp_allowPlainAuth = true;
						node->binkp_allowPlainText = true;
						uifc.changes=TRUE;
						break;
					case 1:
						node->binkp_allowPlainAuth = true;
						node->binkp_plainAuthOnly = false;
						node->binkp_allowPlainText = true;
						uifc.changes=TRUE;
						break;
					case 2:
						node->binkp_allowPlainAuth = false;
						node->binkp_plainAuthOnly = false;
						uifc.changes=TRUE;
						break;
540
541
542
				}
				break;
			case 4:
543
				if(cfg.binkp_plainTextOnly) {
544
545
546
					uifc.msg("BinkP encryption has been disabled globally");
					break;
				}
547
548
549
550
				if(cfg.binkp_plainAuthOnly) {
					uifc.msg("CRAM-MD5 authentication/encryption has been disabled globally");
					break;
				}
551
552
553
				k = !node->binkp_allowPlainText;
				switch(uifc.list(WIN_MID|WIN_SAV,0,0,0,&k,0
					,"Allow Plain-Text (Unencrypted) Sessions",uifcYesNoOpts)) {
554
555
556
557
558
559
560
561
562
563
564
					case 0:
						node->binkp_allowPlainText = true;
						node->binkp_allowPlainAuth = true;
						uifc.changes=TRUE;
						break;
					case 1:
						node->binkp_allowPlainText = false;
						node->binkp_allowPlainAuth = false;
						node->binkp_plainAuthOnly = false;
						uifc.changes=TRUE;
						break;
565
566
567
				}
				break;
			case 5:
568
569
570
571
572
573
574
575
				k = !node->binkp_tls;
				switch(uifc.list(WIN_MID|WIN_SAV,0,0,0,&k,0
					,"Use BINKPS (Implicit TLS) Connections with This Node",uifcYesNoOpts)) {
					case 0:	node->binkp_tls = true;		uifc.changes=TRUE; break;
					case 1:	node->binkp_tls = false;	uifc.changes=TRUE; break;
				}
				break;
			case 6:
576
577
578
579
580
581
582
583
584
585
586
587
588
				uifc.helpbuf=
				"~ Source Address ~\n\n"
				"This is the FidoNet style address to use as the source address when\n"
				"conducting BinkP sessions with this linked node.";
				uifc.input(WIN_MID|WIN_SAV,0,0
					,"Source Node Address (optional)"
					,node->binkp_src
					,sizeof(node->binkp_src)-1, K_EDIT);
				break;
		}
	}
}

589
590
591
int main(int argc, char **argv)
{
	char str[256],*p;
592
	int i,j,k,x,dflt,nodeop=0,nodeopbar=0,packop=0,listop=0;
593
594
595
	echolist_t savlistcfg;
	nodecfg_t savnodecfg;
	arcdef_t savarcdef;
596
	struct fido_domain savedomain;
597
	BOOL door_mode=FALSE;
598
	int		ciolib_mode=CIOLIB_MODE_AUTO;
rswindell's avatar
rswindell committed
599
600
601
	unsigned int u;
	char	sysop_aliases[256];
	sbbsecho_cfg_t orig_cfg;
602

603
604
605
	ZERO_VAR(savlistcfg);
	ZERO_VAR(savnodecfg);
	ZERO_VAR(savarcdef);
606
	ZERO_VAR(savedomain);
607

608
609
	fprintf(stderr,"\nSynchronet FidoNet Configuration  Version %u.%02u  " COPYRIGHT_NOTICE
		"\n\n",SBBSECHO_VERSION_MAJOR, SBBSECHO_VERSION_MINOR);
610

rswindell's avatar
rswindell committed
611
	memset(&cfg,0,sizeof(cfg));
612
613
614
615
	str[0]=0;
	for(i=1;i<argc;i++) {
		if(argv[i][0]=='-')
			switch(toupper(argv[i][1])) {
616
                case 'D':
rswindell's avatar
rswindell committed
617
					printf("NOTICE: The -d option is deprecated, use -id instead\n");
618
619
620
621
622
623
624
625
626
					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;
627
				case 'I':
628
629
630
631
632
633
634
635
					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
636
							printf("NOTICE: The -i option is deprecated, use -if instead\n");
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
							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;
					}
653
					break;
654
655
656
				case 'K':	/* Keyboard-only mode (no mouse support) */
					uifc.mode |= UIFC_NOMOUSE;
					break;
657
658
659
660
661
662
		        case 'M':   /* Monochrome mode */
        			uifc.mode|=UIFC_MONO;
                    break;
                case 'C':
        			uifc.mode|=UIFC_COLOR;
                    break;
663
664
                case 'V':
                    textmode(atoi(argv[i]+2));
665
                    break;
666
667
                default:
					USAGE:
rswindell's avatar
rswindell committed
668
                    printf("usage: echocfg [path/to/sbbsecho.ini] [options]"
669
                        "\n\noptions:\n\n"
rswindell's avatar
rswindell committed
670
671
672
673
674
						"-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"
675
#ifdef __unix__
rswindell's avatar
rswindell committed
676
677
678
						"       X = X11 mode\n"
						"       C = Curses mode\n"
						"       F = Curses mode with forced IBM charset\n"
679
#else
rswindell's avatar
rswindell committed
680
						"       W = Win32 native mode\n"
681
#endif
rswindell's avatar
rswindell committed
682
683
684
685
						"       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"
686
687
                        );
        			exit(0);
688
689
		}
		else
690
			SAFECOPY(str,argv[i]);
691
692
	}
	if(str[0]==0) {
693
694
695
696
697
		SAFECOPY(cfg.cfgfile, get_ctrl_dir());
		backslash(cfg.cfgfile);
		SAFECAT(cfg.cfgfile, "sbbsecho.ini");
	} else {
		SAFECOPY(cfg.cfgfile,str);
698
	}
699

rswindell's avatar
rswindell committed
700
701
702
703
704
	if(!sbbsecho_read_ini(&cfg)) {
		fprintf(stderr, "ERROR %d (%s) reading %s\n", errno, strerror(errno), cfg.cfgfile);
		exit(1);
	}
	orig_cfg = cfg;
705

706
	// savnum=0;
rswindell's avatar
rswindell committed
707
	if((opt=(char **)malloc(sizeof(char *)*1000))==NULL) {
708
		puts("memory allocation error\n");
rswindell's avatar
rswindell committed
709
		exit(1);
710
	}
rswindell's avatar
rswindell committed
711
712
	for(i=0;i<1000;i++)
		if((opt[i]=(char *)malloc(MAX_OPLN+1))==NULL) {
713
			puts("memory allocation error\n");
rswindell's avatar
rswindell committed
714
			exit(1);
715
		}
716
	uifc.size=sizeof(uifc);
717
718
719
720
721
722
723
724
	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 */
	}
725
	else
726
    	i=uifcinix(&uifc);  /* stdio */
727
728
729
730
731
732

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

rswindell's avatar
rswindell committed
733
	uifc.timedisplay = NULL;
734
	sprintf(str,"Synchronet FidoNet Config v%u.%02u",SBBSECHO_VERSION_MAJOR, SBBSECHO_VERSION_MINOR);
735
	uifc.scrn(str);
rswindell's avatar
rswindell committed
736
737
738
739
	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);
740

rswindell's avatar
rswindell committed
741
742
743
744
745
	/* Remember current menu item selections using these vars: */
	int netmail_opt = 0;
	int echomail_opt = 0;
	int path_opt = 0;
	int node_opt = 0;
746
	int node_bar = 0;
rswindell's avatar
rswindell committed
747
	int archive_opt = 0;
748
	int archive_bar = 0;
rswindell's avatar
rswindell committed
749
	int echolist_opt = 0;
750
	int echolist_bar = 0;
751
	int domain_opt = 0;
752
	int domain_bar = 0;
753
754
	dflt=0;
	while(1) {
rswindell's avatar
rswindell committed
755
756
		if(memcmp(&cfg, &orig_cfg, sizeof(cfg)) != 0)
			uifc.changes = TRUE;
757
		uifc.helpbuf=
758
	"~ FidoNet Configuration ~\n\n"
rswindell's avatar
rswindell committed
759
	"This program allows you to easily configure the Synchronet BBS\n"
760
761
762
	"FidoNet-style EchoMail program known as `SBBSecho` and the FidoNet/BinkP\n"
	"mailer known as `BinkIT`.  Alternatively, you may edit the configuration\n"
	"file (e.g. `ctrl/sbbsecho.ini`) using an ASCII/plain-text editor.\n"
rswindell's avatar
rswindell committed
763
764
	"\n"
	"For detailed documentation, see `http://wiki.synchro.net/util:sbbsecho`\n"
765
	"                            and `http://wiki.synchro.net/module:binkit`\n"
rswindell's avatar
rswindell committed
766
	"\n"
767
	"The `Global Settings` sub-menu is where FidoNet configuration settings\n"
rswindell's avatar
rswindell committed
768
	"are located which are neither NetMail nor EchoMail specific, but more\n"
769
	"general to the operation of the tosser (SBBSecho) and mailer (BinkIT).\n"
rswindell's avatar
rswindell committed
770
771
772
773
774
775
776
	"\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"
777
	"EchoMail bundle files (usually in 'PKZIP' format).\n"
rswindell's avatar
rswindell committed
778
779
780
781
782
783
784
785
786
787
	"\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"
788
789
790
791
	"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"
	"\n"
rswindell's avatar
rswindell committed
792
793
794
	"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
795
	"`Area File` (e.g. areas.bbs) for advanced AreaFix/AreaMgr operations."
rswindell's avatar
rswindell committed
796
	;
797
		i=0;
rswindell's avatar
rswindell committed
798
		sprintf(opt[i++],"Global Settings...");
rswindell's avatar
rswindell committed
799
800
		sprintf(opt[i++],"Linked Nodes...");
		sprintf(opt[i++],"Archive Types...");
801
802
		sprintf(opt[i++],"NetMail Settings...");
		sprintf(opt[i++],"EchoMail Settings...");
rswindell's avatar
rswindell committed
803
		sprintf(opt[i++],"Paths and Filenames...");
804
		sprintf(opt[i++],"Domains...");
rswindell's avatar
rswindell committed
805
		sprintf(opt[i++],"EchoLists...");
rswindell's avatar
rswindell committed
806
807
		if(uifc.changes)
			snprintf(opt[i++],MAX_OPLN-1,"Save Changes to %s", getfname(cfg.cfgfile));
rswindell's avatar
rswindell committed
808
		opt[i][0]=0;
rswindell's avatar
rswindell committed
809
		switch(uifc.list(WIN_ORG|WIN_MID|WIN_ACT|WIN_ESC,0,0,0,&dflt,0
810
			,"Configure FidoNet",opt)) {
811

812
			case 0:
rswindell's avatar
rswindell committed
813
				global_settings();
814
				break;
815

816
817
818
			case 1:
				i=0;
				while(1) {
rswindell's avatar
rswindell committed
819
					uifc.helpbuf=
rswindell's avatar
rswindell committed
820
821
822
823
824
	"~ 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"
825
826
827
828
	"of nodes, by using the `ALL` wildcard word.\n"
	"\n"
	"The hexadecimal numbers in parentheses are provided as an aide when\n"
	"correlating FidoNet files and BSO directories with node numbers."
rswindell's avatar
rswindell committed
829
830
	;

rswindell's avatar
rswindell committed
831
832
					for(u=0;u<cfg.nodecfgs;u++) {
						char hexaddr[16] = "";
833
834
835
836
837
838
839
						if(cfg.nodecfg[u].addr.zone != 0xffff) {
							if(!faddr_contains_wildcard(&cfg.nodecfg[u].addr))
								sprintf(hexaddr, "(%04hx%04hx)", cfg.nodecfg[u].addr.net,cfg.nodecfg[u].addr.node);
							else
								sprintf(hexaddr, "(.%03X)", cfg.nodecfg[u].addr.zone);
						}
						snprintf(opt[u], MAX_OPLN-1, "%-16s %-10s  %s"
rswindell's avatar
rswindell committed
840
841
842
							,faddrtoa(&cfg.nodecfg[u].addr), hexaddr
							,cfg.nodecfg[u].name[0] ? cfg.nodecfg[u].name : cfg.nodecfg[u].comment);
					}
843
					opt[u][0]=0;
rswindell's avatar
rswindell committed
844
					int mode = WIN_SAV | WIN_INS | WIN_DEL | WIN_ACT
845
						| WIN_INSACT | WIN_DELACT | WIN_XTR;
846
847
					if(cfg.nodecfgs)
						mode |= WIN_COPY | WIN_CUT;
848
					if (savnodecfg.addr.zone)
849
						mode |= WIN_PASTE | WIN_PASTEXTR;
850
					i=uifc.list(mode,0,0,0,&node_opt,&node_bar,"Linked Nodes",opt);
851
852
					if(i==-1)
						break;
853
854
855
					int msk = i&MSK_ON;
					i &= MSK_OFF;
					if (msk == MSK_INS) {
856
857
						str[0]=0;
	uifc.helpbuf=
rswindell's avatar
rswindell committed
858
859
860
861
	"~ 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
862
						if(uifc.input(WIN_MID|WIN_SAV,0,0
863
864
865
							,"Node Address (ALL wildcard allowed)",str
							,25,K_EDIT)<1)
							continue;
866
						if(!new_node(i)) {
867
							printf("\nMemory Allocation Error\n");
rswindell's avatar
rswindell committed
868
							exit(1);
869
						}
rswindell's avatar
rswindell committed
870
871
						cfg.nodecfg[i].addr=atofaddr(str);
						uifc.changes=TRUE;
rswindell's avatar
rswindell committed
872
						continue;
873
					}
874

875
					if (msk == MSK_DEL || msk == MSK_CUT) {
876
877
						if(msk == MSK_CUT)
							memcpy(&savnodecfg, &cfg.nodecfg[i], sizeof(nodecfg_t));
878
879
880
						cfg.nodecfgs--;
						if(cfg.nodecfgs<=0) {
							cfg.nodecfgs=0;
rswindell's avatar
rswindell committed
881
							continue;
882
						}
883
884
						for(u=i;u<cfg.nodecfgs;u++)
							memcpy(&cfg.nodecfg[u],&cfg.nodecfg[u+1]
885
								,sizeof(nodecfg_t));
rswindell's avatar
rswindell committed
886
						uifc.changes=TRUE;
rswindell's avatar
rswindell committed
887
						continue;
888
					}
889
					if (msk == MSK_COPY) {
890
						memcpy(&savnodecfg,&cfg.nodecfg[i],sizeof(nodecfg_t));
rswindell's avatar
rswindell committed
891
						continue;
892
					}
893
894
895
					if (msk == MSK_PASTE) {
						if(!new_node(i))
							continue;
896
						memcpy(&cfg.nodecfg[i],&savnodecfg,sizeof(nodecfg_t));
rswindell's avatar
rswindell committed
897
						uifc.changes=TRUE;
rswindell's avatar
rswindell committed
898
						continue;
899
					}
900
901
					while(1) {
	uifc.helpbuf=
rswindell's avatar
rswindell committed
902
903
904
905
906
907
908
909
	"~ 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"
910
	"`Name` is name of the system operator of the configured node. This is used\n"
rswindell's avatar
rswindell committed
911
912
	"    as the destination name for AreaFix Notification NetMail messages.\n"
	"\n"
rswindell's avatar
rswindell committed
913
	"`Comment` is a note to yourself about this node. Setting this to the\n"
rswindell's avatar
rswindell committed
914
915
	"    BBS name or official FidoNet title corresponding with the configured\n"
	"    node can be a helpful reminder to yourself later.\n"
rswindell's avatar
rswindell committed
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
	"\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"
935
936
937
938
	"`Session Password` is the password that will be used for authenticated\n"
	"    BinkP sessions with this node. Session passwords are case sensitive.\n"
	"    This password is only used by BinkIT (if you choose to use it).\n"
	"\n"
rswindell's avatar
rswindell committed
939
	"`TIC File Password` is an optional password that may be configured here\n"
rswindell's avatar
rswindell committed
940
	"    (and in your `sbbsecho.ini` file) for use by `tickit.js` when creating\n"
rswindell's avatar
rswindell committed
941
942
943
	"    or authenticating `.TIC` files.\n"
	"    This setting may be managed by the node using AreaFix requests.\n"
	"\n"
rswindell's avatar
rswindell committed
944
945
	"`AreaFix Support` is a toggle that determines whether or not this node\n"
	"    may send AreaFix NetMail requests to your system to perform remote\n"
946
	"    area and account management.\n"
rswindell's avatar
rswindell committed
947
948
949
	"\n"
	"`AreaFix Password` is an optional password used to authenticate inbound\n"
	"    AreaFix NetMail requests (Remote Area Management) from this node.\n"
rswindell's avatar
rswindell committed
950
951
952
	"    AreaFix Passwords are case insensitive.\n"
	"    This setting may be managed by the node using AreaFix requests.\n"
	"\n"
rswindell's avatar
rswindell committed
953
	"`EchoList Keys` is a list of keys which enable AreaFix access to one or\n"
rswindell's avatar
rswindell committed
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
	"    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"
rswindell's avatar
rswindell committed
975
976
977
978
979
980
	"`Local Address` is an optional local system address (AKA) to use when\n"
	"    sending packets to this node.  When a Local Address is not specified\n"
	"    SBBSecho will automatically choose the local address that matches\n"
	"    the destination address (zone and net number) the closest\n"
	"    (Best Match).\n"
	"\n"
rswindell's avatar
rswindell committed
981
982
983
984
985
986
987
988
989
990
	"`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"
991
992
	"\n"
	"`BinkP Settings` are settings specific to BinkP/BinkIT mailer operation.\n"
rswindell's avatar
rswindell committed
993
	;
994
						j=0;
rswindell's avatar
rswindell committed
995
996
						snprintf(opt[j++],MAX_OPLN-1,"%-30.30s %s","Address"
							,faddrtoa(&cfg.nodecfg[i].addr));
997
998
						snprintf(opt[j++],MAX_OPLN-1,"%-30.30s %s","Domain"
							,cfg.nodecfg[i].domain);
rswindell's avatar
rswindell committed
999
1000
						snprintf(opt[j++],MAX_OPLN-1,"%-30.30s %s","Name"
							,cfg.nodecfg[i].name);
rswindell's avatar
rswindell committed
1001
1002
1003
1004
1005
1006
1007
1008
						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"
1009
							,cfg.nodecfg[i].pktpwd);
1010
1011
						snprintf(opt[j++],MAX_OPLN-1,"%-30.30s %s","Session Password"
							,cfg.nodecfg[i].sesspwd);
1012
1013
						snprintf(opt[j++],MAX_OPLN-1,"%-30.30s %s","TIC File Password"
							,cfg.nodecfg[i].ticpwd);
rswindell's avatar
rswindell committed
1014
1015
						snprintf(opt[j++],MAX_OPLN-1,"%-30.30s %s","AreaFix Support"
							,cfg.nodecfg[i].areafix ? "Yes" : "No");
rswindell's avatar
rswindell committed
1016
						snprintf(opt[j++],MAX_OPLN-1,"%-30.30s %s","AreaFix Password"
1017
							,cfg.nodecfg[i].password);
rswindell's avatar
rswindell committed
1018
						snprintf(opt[j++],MAX_OPLN-1,"%-30.30s %s","EchoList Keys"
rswindell's avatar
rswindell committed
1019
1020
1021
1022
1023
1024
1025
1026
1027
							,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
1028
1029
						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
1030
1031
1032
						snprintf(opt[j++],MAX_OPLN-1,"%-30.30s %s","Local Address (AKA)"
							,cfg.nodecfg[i].local_addr.zone
							? faddrtoa(&cfg.nodecfg[i].local_addr) : "Best Match");
rswindell's avatar
rswindell committed
1033
1034
						if(cfg.flo_mailer) {
							snprintf(opt[j++],MAX_OPLN-1,"%-30.30s %s","Route To"
1035
								,cfg.nodecfg[i].route.zone
rswindell's avatar
rswindell committed
1036
								? faddrtoa(&cfg.nodecfg[i].route) : "Disabled");
1037
1038
1039
							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);
1040
								strcpy(opt[j++], "BinkP Settings...");
1041
							}
rswindell's avatar
rswindell committed
1042
						}
1043
						opt[j][0]=0;
rswindell's avatar
rswindell committed
1044
						SAFEPRINTF(str, "Linked Node - %s"
rswindell's avatar
rswindell committed
1045
							,cfg.nodecfg[i].name[0] ? cfg.nodecfg[i].name : faddrtoa(&cfg.nodecfg[i].addr));
1046
						k=uifc.list(WIN_MID|WIN_ACT|WIN_SAV,0,0,0,&nodeop,&nodeopbar,str,opt);
1047
1048
1049
						if(k==-1)
							break;
						switch(k) {
rswindell's avatar
rswindell committed
1050
							case __COUNTER__:
1051
	uifc.helpbuf=
rswindell's avatar
rswindell committed
1052
1053
	"~ Address ~\n\n"
	"This is the FidoNet style address of this linked node.\n";
1054
								SAFECOPY(str,faddrtoa(&cfg.nodecfg[i].addr));
rswindell's avatar
rswindell committed
1055
								if(uifc.input(WIN_MID|WIN_SAV,0,0
1056
									,"Node Address (ALL wildcard allowed)",str
rswindell's avatar
rswindell committed
1057
1058
									,25,K_EDIT|K_UPPER)>0)
									cfg.nodecfg[i].addr=atofaddr(str);
1059
								break;
rswindell's avatar
rswindell committed
1060
1061
							case __COUNTER__:
	uifc.helpbuf=
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
	"~ Domain ~\n\n"
	"This is the domain portion of the 5D FTN address of this linked node\n"
	"(e.g. '`fidonet`').  FTN domains are limited to 8 characters and must not\n"
	"contain the characters '@' or '.'";
								uifc.input(WIN_MID|WIN_SAV,0,0
									,"Domain"
									,cfg.nodecfg[i].domain, sizeof(cfg.nodecfg[i].domain)-1
									,K_EDIT);
								break;
							case __COUNTER__:
	uifc.helpbuf=
rswindell's avatar
rswindell committed
1073
1074
1075
1076
1077
1078
1079
1080
1081
	"~ Name ~\n\n"
	"This is an optional NetMail destination name for the node (e.g. the sysop's name).\n"
	"This is used for AreaFix Notification NetMail messages.\n";
								uifc.input(WIN_MID|WIN_SAV,0,0
									,"Name"
									,cfg.nodecfg[i].name,sizeof(cfg.nodecfg[i].name)-1
									,K_EDIT);
								break;
							case __COUNTER__:
1082
	uifc.helpbuf=
rswindell's avatar
rswindell committed
1083
1084
1085
	"~ 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
1086
1087
1088
1089
1090
								uifc.input(WIN_MID|WIN_SAV,0,0
									,"Comment"
									,cfg.nodecfg[i].comment,sizeof(cfg.nodecfg[i].comment)-1
									,K_EDIT);
								break;
rswindell's avatar
rswindell committed
1091
							case __COUNTER__:
rswindell's avatar
rswindell committed
1092
	uifc.helpbuf=
rswindell's avatar
rswindell committed
1093
1094
1095
	"~ 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
1096
1097
1098
1099
								int cur=cfg.arcdefs;
								for(u=0;u<cfg.arcdefs;u++) {
									if(cfg.nodecfg[i].archive == &cfg.arcdef[u])
										cur=u;
1100
									strcpy(opt[u],cfg.arcdef[u].name);
rswindell's avatar
rswindell committed
1101
								}
1102
1103
								strcpy(opt[u++],"None");
								opt[u][0]=0;
rswindell's avatar
rswindell committed
1104
								k=uifc.list(WIN_RHT|WIN_SAV,0,0,0,&cur,0
1105
1106
1107
									,"Archive Type",opt);
								if(k==-1)
									break;
1108
								if((unsigned)k>=cfg.arcdefs)
rswindell's avatar
rswindell committed
1109
									cfg.nodecfg[i].archive = SBBSECHO_ARCHIVE_NONE;
1110
								else
rswindell's avatar
rswindell committed
1111
1112
									cfg.nodecfg[i].archive = &cfg.arcdef[k];
								uifc.changes=TRUE;
1113
								break;
rswindell's avatar
rswindell committed
1114
							case __COUNTER__:
1115
	uifc.helpbuf=
rswindell's avatar
rswindell committed
1116
1117
1118
1119
1120
1121
1122
1123
	"~ 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
1124
	;
1125
1126
								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
1127
									,pktTypeStringList);
1128
1129
1130
								if(k==-1)
									break;
								cfg.nodecfg[i].pkt_type=k;
rswindell's avatar
rswindell committed
1131
								uifc.changes=TRUE;
1132
								break;
rswindell's avatar
rswindell committed
1133
							case __COUNTER__:
1134
	uifc.helpbuf=
rswindell's avatar
rswindell committed
1135
1136
	"~ Packet Password ~\n\n"
	"This is an optional password that SBBSecho will place into packets\n"
1137
1138
1139
	"destined for this node.\n"
	"\n"
	"Packet passwords are `case-insensitive`";
1140
1141
								uifc.input(WIN_MID|WIN_SAV,0,0
									,"Packet Password (optional)"
rswindell's avatar
rswindell committed
1142
1143
									,cfg.nodecfg[i].pktpwd,sizeof(cfg.nodecfg[i].pktpwd)-1
									,K_EDIT|K_UPPER);
1144
								break;
rswindell's avatar
rswindell committed
1145
							case __COUNTER__:
1146
	uifc.helpbuf=
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
	"~ Session Password ~\n\n"
	"This is an optional password that BinkIT will use for authenticated\n"
	"BinkP sessions with this node.\n"
	"\n"
	"Session passwords are `case-sensitive`";
								uifc.input(WIN_MID|WIN_SAV,0,0
									,"Session Password"
									,cfg.nodecfg[i].sesspwd,sizeof(cfg.nodecfg[i].sesspwd)-1