scfgxtrn.c 64 KB
Newer Older
rswindell's avatar
rswindell committed
1
2
/* scfgxtrn.c */

3
4
5
6
7
8
9
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
/* $Id$ */

/****************************************************************************
 * @format.tab-size 4		(Plain Text/Source Code File Header)			*
 * @format.use-tabs true	(see http://www.synchro.net/ptsc_hdr.html)		*
 *																			*
 * Copyright 2002 Rob Swindell - http://www.synchro.net/copyright.html		*
 *																			*
 * 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.	*
 ****************************************************************************/
rswindell's avatar
rswindell committed
35
36
37
38
39
40
/****************************************************************************/
/* Synchronet configuration utility 										*/
/****************************************************************************/

#include "scfg.h"

41
char *daystr(char days);
42
43
static void hotkey_cfg(void);

44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
static char* mdaystr(long mdays)
{
	int		i;
	char	tmp[16];
	static	char str[256];

	if(mdays==0 || mdays==1)
		return("Any");

	str[0]=0;
	for(i=1;i<32;i++) {
		if((mdays&(1<<i))==0)
			continue;
		if(str[0])
			strcat(str," ");
		sprintf(tmp,"%u",i);
		strcat(str,tmp);
	}
	
	return(str);
}

66
67
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
static char* dropfile(int type, ulong misc)
{
	static char str[128];
	char fname[64]="";

	switch(type) {
		case XTRN_SBBS:
			strcpy(fname,"XTRN.DAT");
			break;
		case XTRN_WWIV:
			strcpy(fname,"CHAIN.TXT");
			break;
		case XTRN_GAP:
			strcpy(fname,"DOOR.SYS");
			break;
		case XTRN_RBBS:
			strcpy(fname,"DORINFO#.DEF");
			break;
		case XTRN_RBBS1:
			strcpy(fname,"DORINFO1.DEF");
            break;
		case XTRN_WILDCAT:
			strcpy(fname,"CALLINFO.BBS");
			break;
		case XTRN_PCBOARD:
			strcpy(fname,"PCBOARD.SYS");
			break;
		case XTRN_SPITFIRE:
			strcpy(fname,"SFDOORS.DAT");
			break;
		case XTRN_UTI:
			strcpy(fname,"UTIDOOR.TXT");
			break;
		case XTRN_SR:
			strcpy(fname,"DOORFILE.SR");
			break;
		case XTRN_TRIBBS:
			strcpy(fname,"TRIBBS.SYS");
			break;
        case XTRN_DOOR32:
            strcpy(fname,"DOOR32.SYS");
            break;
	}

	if(misc&XTRN_LWRCASE)
		strlwr(fname);

	switch(type) {
		case XTRN_SBBS:
			sprintf(str,"%-15s %s","Synchronet",fname);
			break;
		case XTRN_WWIV:
			sprintf(str,"%-15s %s","WWIV",fname);
			break;
		case XTRN_GAP:
			sprintf(str,"%-15s %s","GAP",fname);
			break;
		case XTRN_RBBS:
			sprintf(str,"%-15s %s","RBBS/QuickBBS",fname);
			break;
		case XTRN_RBBS1:
			sprintf(str,"%-15s %s","RBBS/QuickBBS",fname);
            break;
		case XTRN_WILDCAT:
			sprintf(str,"%-15s %s","Wildcat",fname);
			break;
		case XTRN_PCBOARD:
			sprintf(str,"%-15s %s","PCBoard",fname);
			break;
		case XTRN_SPITFIRE:
			sprintf(str,"%-15s %s","SpitFire",fname);
			break;
		case XTRN_UTI:
			sprintf(str,"%-15s %s","MegaMail",fname);
			break;
		case XTRN_SR:
			sprintf(str,"%-15s %s","Solar Realms",fname);
			break;
		case XTRN_TRIBBS:
			sprintf(str,"%-15s %s","TriBBS",fname);
			break;
        case XTRN_DOOR32:
            sprintf(str,"%-15s %s","Mystic",fname);
            break;
		default:
			strcpy(str,"None");
			break; 
	}
	return(str);
}

rswindell's avatar
rswindell committed
157
158
159
160
161
162
163
164
165
void xprogs_cfg()
{
	static int xprogs_dflt;
	int 	i;

while(1) {
	i=0;
	strcpy(opt[i++],"Fixed Events");
	strcpy(opt[i++],"Timed Events");
166
	strcpy(opt[i++],"Native Program List");
rswindell's avatar
rswindell committed
167
	strcpy(opt[i++],"External Editors");
168
	strcpy(opt[i++],"Global Hot Key Events");
169
	strcpy(opt[i++],"Online Programs (Doors)");
rswindell's avatar
rswindell committed
170
171
172
173
174
175
176
177
	opt[i][0]=0;
	SETHELP(WHERE);
/*
Online External Programs:

From this menu, you can configure external events, external editors, or
online external programs (doors).
*/
178
	switch(uifc.list(WIN_ORG|WIN_CHE|WIN_ACT,0,0,0,&xprogs_dflt,0
rswindell's avatar
rswindell committed
179
180
181
182
183
184
		,"External Programs",opt)) {
		case -1:
			i=save_changes(WIN_MID);
            if(i==-1)
                break;
			if(!i) {
185
				cfg.new_install=new_install;
rswindell's avatar
rswindell committed
186
                write_xtrn_cfg(&cfg,backup_level);
187
				write_main_cfg(&cfg,backup_level);
188
                refresh_cfg(&cfg);
189
            }
rswindell's avatar
rswindell committed
190
191
192
193
194
195
196
			return;
		case 0:
			fevents_cfg();
			break;
		case 1:
			tevents_cfg();
			break;
197
		case 2:
rswindell's avatar
rswindell committed
198
199
			natvpgm_cfg();
			break;
200
		case 3:
rswindell's avatar
rswindell committed
201
202
			xedit_cfg();
			break;
203
204
205
206
        case 4:
            hotkey_cfg();
            break;
		case 5:
rswindell's avatar
rswindell committed
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
			xtrnsec_cfg();
			break; } }
}

void fevents_cfg()
{
	static int event_dflt;
	int i;

while(1) {
	i=0;
	sprintf(opt[i++],"%-32.32s%.40s","Logon Event",cfg.sys_logon);
	sprintf(opt[i++],"%-32.32s%.40s","Logout Event",cfg.sys_logout);
	sprintf(opt[i++],"%-32.32s%.40s","Daily Event",cfg.sys_daily);
	opt[i][0]=0;
	SETHELP(WHERE);
/*
External Events:

From this menu, you can configure the logon and logout events, and the
system daily event.
*/
229
	switch(uifc.list(WIN_ACT|WIN_SAV|WIN_CHE|WIN_BOT|WIN_RHT,0,0,60,&event_dflt,0
rswindell's avatar
rswindell committed
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
		,"Fixed Events",opt)) {
		case -1:
			return;
		case 0:
			SETHELP(WHERE);
/*
Logon Event:

This is the command line for a program that will execute during the
logon sequence of every user. The program cannot have user interaction.
The program will be executed after the LOGON message is displayed and
before the logon user list is displayed. If you wish to place a program
in the logon sequence of users that includes interaction or requires
account information, you probably want to use an online external
program configured to run as a logon event.
*/
246
			uifc.input(WIN_MID|WIN_SAV,0,0,"Logon Event"
247
				,cfg.sys_logon,sizeof(cfg.sys_logon)-1,K_EDIT);
rswindell's avatar
rswindell committed
248
249
250
251
252
253
254
255
256
257
258
259
260
			break;
		case 1:
			SETHELP(WHERE);
/*
Logout Event:

This is the command line for a program that will execute during the
logout sequence of every user. This program cannot have user
interaction because it is executed after carrier is dropped. If you
wish to have a program execute before carrier is dropped, you probably
want to use an Online External Program configured to run as a logoff
event.
*/
261
			uifc.input(WIN_MID|WIN_SAV,0,0,"Logout Event"
262
				,cfg.sys_logout,sizeof(cfg.sys_logout)-1,K_EDIT);
rswindell's avatar
rswindell committed
263
264
265
266
267
268
269
270
271
			break;
		case 2:
			SETHELP(WHERE);
/*
Daily Event:

This is the command line for a program that will run after the first
user that logs on after midnight, logs off (regardless of what node).
*/
272
			uifc.input(WIN_MID|WIN_SAV,0,0,"Daily Event"
273
				,cfg.sys_daily,sizeof(cfg.sys_daily)-1,K_EDIT);
rswindell's avatar
rswindell committed
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293

			break; } }
}

void tevents_cfg()
{
	static int dflt,dfltopt,bar;
	char str[81],done=0,*p;
	int j,k;
	uint i;
	static event_t savevent;

while(1) {
	for(i=0;i<cfg.total_events && i<MAX_OPTS;i++)
		sprintf(opt[i],"%-8.8s      %.50s",cfg.event[i]->code,cfg.event[i]->cmd);
	opt[i][0]=0;
	j=WIN_SAV|WIN_ACT|WIN_CHE|WIN_RHT;
	if(cfg.total_events)
		j|=WIN_DEL|WIN_GET;
	if(cfg.total_events<MAX_OPTS)
294
		j|=WIN_INS|WIN_INSACT|WIN_XTR;
rswindell's avatar
rswindell committed
295
296
297
298
299
300
301
302
303
304
305
306
307
308
	if(savevent.code[0])
		j|=WIN_PUT;
	SETHELP(WHERE);
/*
Timed Events:

This is a list of the configured timed external events.

To add an event hit  INS .

To delete an event, select it and hit  DEL .

To configure an event, select it and hit  ENTER .
*/
309
	i=uifc.list(j,0,0,45,&dflt,&bar,"Timed Events",opt);
rswindell's avatar
rswindell committed
310
311
312
313
314
315
316
317
318
319
	if((signed)i==-1)
		return;
	if((i&MSK_ON)==MSK_INS) {
		i=cfg.total_events;
		SETHELP(WHERE);
/*
Timed Event Internal Code:

This is the internal code for the timed event.
*/
320
		if(uifc.input(WIN_MID|WIN_SAV,0,0,"Event Internal Code",str,LEN_CODE
rswindell's avatar
rswindell committed
321
322
			,K_UPPER)<1)
            continue;
deuce's avatar
deuce committed
323
		if((cfg.event=(event_t **)realloc(cfg.event
rswindell's avatar
rswindell committed
324
325
326
327
328
			,sizeof(event_t *)*(cfg.total_events+1)))==NULL) {
			errormsg(WHERE,ERR_ALLOC,nulstr,cfg.total_events+1);
			cfg.total_events=0;
			bail(1);
            continue; }
deuce's avatar
deuce committed
329
		if((cfg.event[i]=(event_t *)malloc(sizeof(event_t)))==NULL) {
rswindell's avatar
rswindell committed
330
331
332
333
334
335
336
			errormsg(WHERE,ERR_ALLOC,nulstr,sizeof(event_t));
			continue; }
		memset((event_t *)cfg.event[i],0,sizeof(event_t));
		strcpy(cfg.event[i]->code,str);
		cfg.event[i]->node=1;
		cfg.event[i]->days=0xff;
		cfg.total_events++;
337
		uifc.changes=1;
rswindell's avatar
rswindell committed
338
339
340
		continue; }
	if((i&MSK_ON)==MSK_DEL) {
		i&=MSK_OFF;
deuce's avatar
deuce committed
341
		free(cfg.event[i]);
rswindell's avatar
rswindell committed
342
343
344
		cfg.total_events--;
		for(j=i;j<cfg.total_events;j++)
			cfg.event[j]=cfg.event[j+1];
345
		uifc.changes=1;
rswindell's avatar
rswindell committed
346
347
348
349
350
351
352
353
		continue; }
	if((i&MSK_ON)==MSK_GET) {
		i&=MSK_OFF;
		savevent=*cfg.event[i];
		continue; }
	if((i&MSK_ON)==MSK_PUT) {
		i&=MSK_OFF;
		*cfg.event[i]=savevent;
354
		uifc.changes=1;
rswindell's avatar
rswindell committed
355
356
357
358
359
360
361
        continue; }
	done=0;
	while(!done) {
		k=0;
		sprintf(opt[k++],"%-32.32s%s","Internal Code",cfg.event[i]->code);
		sprintf(opt[k++],"%-32.32s%.40s","Start-up Directory",cfg.event[i]->dir);
		sprintf(opt[k++],"%-32.32s%.40s","Command Line",cfg.event[i]->cmd);
362
363
		sprintf(opt[k++],"%-32.32s%s","Enabled"
			,cfg.event[i]->misc&EVENT_DISABLED ? "No":"Yes");
rswindell's avatar
rswindell committed
364
		sprintf(opt[k++],"%-32.32s%u","Execution Node",cfg.event[i]->node);
365
366
		sprintf(opt[k++],"%-32.32s%s","Execution Days of Month"
			,mdaystr(cfg.event[i]->mdays));
367
		sprintf(opt[k++],"%-32.32s%s","Execution Days of Week",daystr(cfg.event[i]->days));
368
369
370
371
372
373
374
375
        if(cfg.event[i]->freq) {
            sprintf(str,"%u times a day",1440/cfg.event[i]->freq);
            sprintf(opt[k++],"%-32.32s%s","Execution Frequency",str);
        } else {
            sprintf(str,"%2.2u:%2.2u"
                ,cfg.event[i]->time/60,cfg.event[i]->time%60);
            sprintf(opt[k++],"%-32.32s%s","Execution Time",str);
        }
rswindell's avatar
rswindell committed
376
377
378
379
		sprintf(opt[k++],"%-32.32s%s","Requires Exclusive Execution"
			,cfg.event[i]->misc&EVENT_EXCL ? "Yes":"No");
		sprintf(opt[k++],"%-32.32s%s","Force Users Off-line For Event"
			,cfg.event[i]->misc&EVENT_FORCE ? "Yes":"No");
380
381
		sprintf(opt[k++],"%-32.32s%s","Native (32-bit) Executable"
			,cfg.event[i]->misc&EX_NATIVE ? "Yes" : "No");
382
383
		sprintf(opt[k++],"%-32.32s%s","Use Shell to Execute"
			,cfg.event[i]->misc&XTRN_SH ? "Yes" : "No");
384
385
		sprintf(opt[k++],"%-32.32s%s","Background Execution"
			,cfg.event[i]->misc&EX_BG ? "Yes" : "No");
386
		sprintf(opt[k++],"%-32.32s%s","Always Run After Init/Re-init"
387
			,cfg.event[i]->misc&EVENT_INIT ? "Yes":"No");
388

rswindell's avatar
rswindell committed
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
		opt[k][0]=0;
		SETHELP(WHERE);
/*
Timed Event:

This is the configuration menu for a timed event. An event is an
external program that performs some type of automated function on the
system. Use this menu to configure how and when this event will be
executed.

If you need the BBS to swap out of memory for this event (to make more
available memory), add the program name (first word of the command line)
to Global Swap List from the External Programs menu.
*/
		sprintf(str,"%s Timed Event",cfg.event[i]->code);
404
		switch(uifc.list(WIN_SAV|WIN_ACT|WIN_L2R|WIN_BOT,0,0,70,&dfltopt,0
rswindell's avatar
rswindell committed
405
406
407
408
409
410
411
412
413
414
415
416
417
418
			,str,opt)) {
			case -1:
				done=1;
				break;
			case 0:
				strcpy(str,cfg.event[i]->code);
				SETHELP(WHERE);
/*
Timed Event Internal Code:

Every timed event must have its own unique internal code for Synchronet
to reference it by. It is helpful if this code is an abreviation of the
command line.
*/
419
				uifc.input(WIN_MID|WIN_SAV,0,17,"Internal Code (unique)"
420
					,str,LEN_CODE,K_EDIT|K_UPPER);
rswindell's avatar
rswindell committed
421
422
423
				if(code_ok(str))
					strcpy(cfg.event[i]->code,str);
				else {
424
425
426
					uifc.helpbuf=invalid_code;
					uifc.msg("Invalid Code");
					uifc.helpbuf=0; }
rswindell's avatar
rswindell committed
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
                break;
			case 1:
				SETHELP(WHERE);
/*
Timed Event Start-up Directory:

This is the DOS drive/directory where the event program is located.
If a path is specified here, it will be made the current directory
before the event's command line is executed. This eliminates the need
for batch files that just change the current drive and directory before
executing the event.

If this option is not used, the current NODE's directory will be the
current DOS drive/directory before the command line is executed.
*/
442
				uifc.input(WIN_MID|WIN_SAV,0,10,"Directory"
443
					,cfg.event[i]->dir,sizeof(cfg.event[i]->dir)-1,K_EDIT);
rswindell's avatar
rswindell committed
444
445
446
447
448
449
450
451
                break;
			case 2:
				SETHELP(WHERE);
/*
Timed Event Command Line:

This is the command line to execute upon this timed event.
*/
452
				uifc.input(WIN_MID|WIN_SAV,0,10,"Command"
453
					,cfg.event[i]->cmd,sizeof(cfg.event[i]->cmd)-1,K_EDIT);
rswindell's avatar
rswindell committed
454
				break;
455

rswindell's avatar
rswindell committed
456
			case 3:
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
				k=cfg.event[i]->misc&EVENT_DISABLED ? 1:0;
				strcpy(opt[0],"Yes");
				strcpy(opt[1],"No");
				opt[2][0]=0;
				SETHELP(WHERE);
/*
`Event Enabled:`

If you want disable this event from executing, set this option to ~No~.
*/
				k=uifc.list(WIN_MID|WIN_SAV,0,0,0,&k,0
					,"Enabled",opt);
				if((k==0 && cfg.event[i]->misc&EVENT_DISABLED) 
					|| (k==1 && !(cfg.event[i]->misc&EVENT_DISABLED))) {
					cfg.event[i]->misc^=EVENT_DISABLED;
					uifc.changes=1; 
				}
                break;

			case 4:
rswindell's avatar
rswindell committed
477
478
479
480
481
482
483
				SETHELP(WHERE);
/*
Timed Event Node:

This is the node number to execute the timed event.
*/
				sprintf(str,"%u",cfg.event[i]->node);
484
				uifc.input(WIN_MID|WIN_SAV,0,0,"Node Number"
rswindell's avatar
rswindell committed
485
486
487
					,str,3,K_EDIT|K_NUMBER);
				cfg.event[i]->node=atoi(str);
				break;
488
			case 5:
489
490
				SETHELP(WHERE);
/*
491
`Days of Month to Execute Event:`
492

493
494
495
Specifies the days of the month (`1-31`, separated by spaces) on which 
to execute this event, or `Any` to execute event on any and all days of
the month.
496
*/
497
498
499
500
501
502
503
504
505
506
507
				SAFECOPY(str,mdaystr(cfg.event[i]->mdays));
				uifc.input(WIN_MID|WIN_SAV,0,0,"Days of Month to Execute Event (or Any)"
					,str,16,K_EDIT);
				cfg.event[i]->mdays=0;
				for(p=str;*p;p++) {
					if(!isdigit(*p))
						continue;
					cfg.event[i]->mdays|=(1<<atoi(p));
					while(*p && isdigit(*p))
						p++;
				}
508
				break;
509
			case 6:
rswindell's avatar
rswindell committed
510
511
512
				j=0;
				while(1) {
					for(k=0;k<7;k++)
513
						sprintf(opt[k],"%-30s %3s"
rswindell's avatar
rswindell committed
514
							,wday[k],(cfg.event[i]->days&(1<<k)) ? "Yes":"No");
515
516
					strcpy(opt[k++],"All");
					strcpy(opt[k++],"None");
rswindell's avatar
rswindell committed
517
518
519
					opt[k][0]=0;
					SETHELP(WHERE);
/*
520
Days of Week to Execute Event:
rswindell's avatar
rswindell committed
521
522
523

These are the days of the week that this event will be executed.
*/
524
					k=uifc.list(WIN_MID|WIN_SAV|WIN_ACT,0,0,0,&j,0
525
						,"Days of Week to Execute Event",opt);
rswindell's avatar
rswindell committed
526
527
					if(k==-1)
						break;
528
529
530
531
532
533
534
535
					if(k==7)
						cfg.event[i]->days=0xff;
					else if(k==8)
						cfg.event[i]->days=0;
					else
						cfg.event[i]->days^=(1<<k);
					uifc.changes=1; 
				}
rswindell's avatar
rswindell committed
536
				break;
537
			case 7:
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
                if(cfg.event[i]->freq==0)
                    k=0;
                else
                    k=1;
                strcpy(opt[0],"Yes");
                strcpy(opt[1],"No");
                opt[2][0]=0;
                SETHELP(WHERE);
/*
Execute Event at a Specific Time:

If you want the system execute this event at a specific time, set
this option to Yes. If you want the system to execute this event more
than once a day at predetermined intervals, set this option to No.
*/
553
                k=uifc.list(WIN_MID|WIN_SAV,0,0,0,&k,0
554
555
556
557
558
559
560
561
562
563
                    ,"Execute Event at a Specific Time",opt);
                if(k==0) {
                    sprintf(str,"%2.2u:%2.2u",cfg.event[i]->time/60
                        ,cfg.event[i]->time%60);
                    SETHELP(WHERE);
/*
Time to Execute Event:

This is the time (in 24 hour HH:MM format) to execute the event.
*/
564
                    if(uifc.input(WIN_MID|WIN_SAV,0,0
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
                        ,"Time to Execute Event (HH:MM)"
                        ,str,5,K_UPPER|K_EDIT)>0) {
                        cfg.event[i]->freq=0;
                        cfg.event[i]->time=atoi(str)*60;
                        if((p=strchr(str,':'))!=NULL)
                            cfg.event[i]->time+=atoi(p+1); } }
                else if(k==1) {
                    sprintf(str,"%u"
                        ,cfg.event[i]->freq && cfg.event[i]->freq<=1440
                            ? 1440/cfg.event[i]->freq : 0);
                    SETHELP(WHERE);
/*
Number of Executions Per Day:

This is the maximum number of times the system will execute this event
per day.
*/
582
                    if(uifc.input(WIN_MID|WIN_SAV,0,0
583
584
585
586
587
588
589
590
591
592
593
                        ,"Number of Executions Per Day"
                        ,str,4,K_NUMBER|K_EDIT)>0) {
                        cfg.event[i]->time=0;
                        k=atoi(str);
                        if(k && k<=1440)
                            cfg.event[i]->freq=1440/k;
                        else
                            cfg.event[i]->freq=0;
                        }
                    }
                break;
594
			case 8:
595
				k=cfg.event[i]->misc&EVENT_EXCL ? 0:1;
rswindell's avatar
rswindell committed
596
597
598
599
600
601
602
603
604
605
				strcpy(opt[0],"Yes");
				strcpy(opt[1],"No");
				opt[2][0]=0;
				SETHELP(WHERE);
/*
Exclusive Event Execution:

If this event must be run exclusively (all nodes inactive), set this
option to Yes.
*/
606
				k=uifc.list(WIN_MID|WIN_SAV,0,0,0,&k,0,"Exclusive Execution"
rswindell's avatar
rswindell committed
607
608
609
					,opt);
				if(!k && !(cfg.event[i]->misc&EVENT_EXCL)) {
					cfg.event[i]->misc|=EVENT_EXCL;
610
					uifc.changes=1; }
rswindell's avatar
rswindell committed
611
612
				else if(k==1 && cfg.event[i]->misc&EVENT_EXCL) {
					cfg.event[i]->misc&=~EVENT_EXCL;
613
					uifc.changes=1; }
rswindell's avatar
rswindell committed
614
                break;
615
			case 9:
616
				k=cfg.event[i]->misc&EVENT_FORCE ? 0:1;
rswindell's avatar
rswindell committed
617
618
619
620
621
622
623
624
625
626
				strcpy(opt[0],"Yes");
				strcpy(opt[1],"No");
				opt[2][0]=0;
				SETHELP(WHERE);
/*
Force Users Off-line for Event:

If you want to have your users' on-line time reduced so the event can
execute precisely on time, set this option to Yes.
*/
627
				k=uifc.list(WIN_MID|WIN_SAV,0,0,0,&k,0
rswindell's avatar
rswindell committed
628
629
630
					,"Force Users Off-line for Event",opt);
				if(!k && !(cfg.event[i]->misc&EVENT_FORCE)) {
					cfg.event[i]->misc|=EVENT_FORCE;
631
					uifc.changes=1; }
rswindell's avatar
rswindell committed
632
633
				else if(k==1 && cfg.event[i]->misc&EVENT_FORCE) {
					cfg.event[i]->misc&=~EVENT_FORCE;
634
                    uifc.changes=1; }
rswindell's avatar
rswindell committed
635
636
                break;

637
			case 10:
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
				k=cfg.event[i]->misc&EX_NATIVE ? 0:1;
				strcpy(opt[0],"Yes");
				strcpy(opt[1],"No");
				opt[2][0]=0;
				SETHELP(WHERE);
/*
Native (32-bit) Executable:

If this event program is a native 32-bit executable,
set this option to Yes.
*/
				k=uifc.list(WIN_MID|WIN_SAV,0,0,0,&k,0
					,"Native (32-bit)",opt);
				if(!k && !(cfg.event[i]->misc&EX_NATIVE)) {
					cfg.event[i]->misc|=EX_NATIVE;
					uifc.changes=TRUE;
                }
				else if(k==1 && cfg.event[i]->misc&EX_NATIVE) {
					cfg.event[i]->misc&=~EX_NATIVE;
					uifc.changes=TRUE;
                }
                break;

661
			case 11:
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
				k=cfg.event[i]->misc&XTRN_SH ? 0:1;
				strcpy(opt[0],"Yes");
				strcpy(opt[1],"No");
				opt[2][0]=0;
				SETHELP(WHERE);
/*
`Use Shell to Execute Command:`

If this command-line requires the system command shell to execute, (Unix 
shell script or DOS batch file), set this option to ~Yes~.
*/
				k=uifc.list(WIN_MID|WIN_SAV,0,0,0,&k,0
					,"Use Shell",opt);
				if(!k && !(cfg.event[i]->misc&XTRN_SH)) {
					cfg.event[i]->misc|=XTRN_SH;
					uifc.changes=TRUE;
                }
				else if(k==1 && cfg.event[i]->misc&XTRN_SH) {
					cfg.event[i]->misc&=~XTRN_SH;
					uifc.changes=TRUE;
                }
                break;

685
			case 12:
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
				k=cfg.event[i]->misc&EX_BG ? 0:1;
				strcpy(opt[0],"Yes");
				strcpy(opt[1],"No");
				opt[2][0]=0;
				SETHELP(WHERE);
/*
Execute Event in Background (Asynchronously):

If you would like this event to run simultaneously with other events,
set this option to Yes. Exclusive events will not run in the background.
*/
				k=uifc.list(WIN_MID|WIN_SAV,0,0,0,&k,0
					,"Background (Asynchronous) Execution",opt);
				if(!k && !(cfg.event[i]->misc&EX_BG)) {
					cfg.event[i]->misc|=EX_BG;
					uifc.changes=TRUE;
                }
				else if(k==1 && cfg.event[i]->misc&EX_BG) {
					cfg.event[i]->misc&=~EX_BG;
                    uifc.changes=TRUE;
                }
                break;

709
			case 13:
710
711
712
713
714
715
				k=cfg.event[i]->misc&EVENT_INIT ? 0:1;
				strcpy(opt[0],"Yes");
				strcpy(opt[1],"No");
				opt[2][0]=0;
				SETHELP(WHERE);
/*
716
`Always Run After Initialization or Re-initialization:`
717
718
719
720
721

If you want this event to always run after the BBS is initialized or
re-initialized, set this option to ~Yes~.
*/
				k=uifc.list(WIN_MID|WIN_SAV,0,0,0,&k,0
722
					,"Always Run After Initialization or Re-initialization",opt);
723
724
725
726
727
728
729
730
731
732
733
734
				if(!k && !(cfg.event[i]->misc&EVENT_INIT)) {
					cfg.event[i]->misc|=EVENT_INIT;
					uifc.changes=1; 
				}
				else if(k==1 && cfg.event[i]->misc&EVENT_INIT) {
					cfg.event[i]->misc&=~EVENT_INIT;
                    uifc.changes=1; 
				}
                break;
			} 
		} 
	}
rswindell's avatar
rswindell committed
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
}


void xtrn_cfg(uint section)
{
	static int ext_dflt,ext_bar,opt_dflt,time_dflt;
	char str[128],code[9],done=0,*p;
	int j,k;
	uint i,n,xtrnnum[MAX_OPTS+1];
	static xtrn_t savxtrn;

while(1) {
	for(i=0,j=0;i<cfg.total_xtrns && j<MAX_OPTS;i++)
		if(cfg.xtrn[i]->sec==section) {
			sprintf(opt[j],"%-25s",cfg.xtrn[i]->name);
			xtrnnum[j++]=i; }
	xtrnnum[j]=cfg.total_xtrns;
	opt[j][0]=0;
	i=WIN_ACT|WIN_CHE|WIN_SAV|WIN_RHT;
	if(j)
		i|=WIN_DEL|WIN_GET;
	if(cfg.total_xtrns<MAX_OPTS)
		i|=WIN_INS|WIN_INSACT|WIN_XTR;
	if(savxtrn.name[0])
		i|=WIN_PUT;
	SETHELP(WHERE);
/*
Online External Programs:

This is a list of the configured online external programs (doors).

To add a program, select the desired location with the arrow keys and
hit  INS .

To delete a program, select it with the arrow keys and hit  DEL .

To configure a program, select it with the arrow keys and hit  ENTER .
*/
	sprintf(str,"%s Online Programs",cfg.xtrnsec[section]->name);
774
	i=uifc.list(i,0,0,45,&ext_dflt,&ext_bar,str,opt);
rswindell's avatar
rswindell committed
775
776
777
778
779
780
781
782
783
784
	if((signed)i==-1)
		return;
	if((i&MSK_ON)==MSK_INS) {
		i&=MSK_OFF;
		SETHELP(WHERE);
/*
Online Program Name:

This is the name or description of the online program (door).
*/
785
		if(uifc.input(WIN_MID|WIN_SAV,0,0,"Online Program Name",str,25
rswindell's avatar
rswindell committed
786
787
788
			,0)<1)
            continue;
		sprintf(code,"%.8s",str);
789
		p=strchr(code,' ');
rswindell's avatar
rswindell committed
790
791
792
793
794
795
796
797
798
799
		if(p) *p=0;
        strupr(code);
		SETHELP(WHERE);
/*
Online Program Internal Code:

Every online program must have its own unique code for Synchronet to
refer to it internally. This code is usually an abreviation of the
online program name.
*/
800
		if(uifc.input(WIN_MID|WIN_SAV,0,0,"Internal Code"
801
			,code,LEN_CODE,K_EDIT|K_UPPER)<1)
rswindell's avatar
rswindell committed
802
803
			continue;
		if(!code_ok(code)) {
804
805
806
			uifc.helpbuf=invalid_code;
			uifc.msg("Invalid Code");
			uifc.helpbuf=0;
rswindell's avatar
rswindell committed
807
            continue; }
deuce's avatar
deuce committed
808
		if((cfg.xtrn=(xtrn_t **)realloc(cfg.xtrn,sizeof(xtrn_t *)*(cfg.total_xtrns+1)))
rswindell's avatar
rswindell committed
809
810
811
812
813
814
815
816
            ==NULL) {
            errormsg(WHERE,ERR_ALLOC,nulstr,cfg.total_xtrns+1);
			cfg.total_xtrns=0;
			bail(1);
            continue; }
		if(j)
			for(n=cfg.total_xtrns;n>xtrnnum[i];n--)
				cfg.xtrn[n]=cfg.xtrn[n-1];
deuce's avatar
deuce committed
817
		if((cfg.xtrn[xtrnnum[i]]=(xtrn_t *)malloc(sizeof(xtrn_t)))==NULL) {
rswindell's avatar
rswindell committed
818
819
820
821
822
823
824
			errormsg(WHERE,ERR_ALLOC,nulstr,sizeof(xtrn_t));
			continue; }
		memset((xtrn_t *)cfg.xtrn[xtrnnum[i]],0,sizeof(xtrn_t));
		strcpy(cfg.xtrn[xtrnnum[i]]->name,str);
		strcpy(cfg.xtrn[xtrnnum[i]]->code,code);
		cfg.xtrn[xtrnnum[i]]->sec=section;
		cfg.total_xtrns++;
825
		uifc.changes=TRUE;
rswindell's avatar
rswindell committed
826
827
828
		continue; }
	if((i&MSK_ON)==MSK_DEL) {
		i&=MSK_OFF;
deuce's avatar
deuce committed
829
		free(cfg.xtrn[xtrnnum[i]]);
rswindell's avatar
rswindell committed
830
831
832
		cfg.total_xtrns--;
		for(j=xtrnnum[i];j<cfg.total_xtrns;j++)
			cfg.xtrn[j]=cfg.xtrn[j+1];
833
		uifc.changes=TRUE;
rswindell's avatar
rswindell committed
834
835
836
837
838
839
840
841
842
		continue; }
	if((i&MSK_ON)==MSK_GET) {
		i&=MSK_OFF;
		savxtrn=*cfg.xtrn[xtrnnum[i]];
		continue; }
	if((i&MSK_ON)==MSK_PUT) {
		i&=MSK_OFF;
		*cfg.xtrn[xtrnnum[i]]=savxtrn;
		cfg.xtrn[xtrnnum[i]]->sec=section;
843
		uifc.changes=TRUE;
rswindell's avatar
rswindell committed
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
        continue; }
	done=0;
	i=xtrnnum[i];
	while(!done) {
		k=0;
		sprintf(opt[k++],"%-27.27s%s","Name",cfg.xtrn[i]->name);
		sprintf(opt[k++],"%-27.27s%s","Internal Code",cfg.xtrn[i]->code);
		sprintf(opt[k++],"%-27.27s%.40s","Start-up Directory",cfg.xtrn[i]->path);
		sprintf(opt[k++],"%-27.27s%.40s","Command Line",cfg.xtrn[i]->cmd);
		sprintf(opt[k++],"%-27.27s%.40s","Clean-up Command Line",cfg.xtrn[i]->clean);
		if(cfg.xtrn[i]->cost)
			sprintf(str,"%lu credits",cfg.xtrn[i]->cost);
		else
			strcpy(str,"None");
		sprintf(opt[k++],"%-27.27s%s","Execution Cost",str);
		sprintf(opt[k++],"%-27.27s%.40s","Access Requirements",cfg.xtrn[i]->arstr);
		sprintf(opt[k++],"%-27.27s%.40s","Execution Requirements"
			,cfg.xtrn[i]->run_arstr);
		sprintf(opt[k++],"%-27.27s%s","Multiple Concurrent Users"
			,cfg.xtrn[i]->misc&MULTIUSER ? "Yes" : "No");
864
		sprintf(opt[k++],"%-27.27s%s%s%s","Intercept Standard I/O"
rswindell's avatar
rswindell committed
865
			,cfg.xtrn[i]->misc&IO_INTS ? "Yes" : "No"
866
867
868
869
			,(cfg.xtrn[i]->misc&(IO_INTS|WWIVCOLOR))
				==(IO_INTS|WWIVCOLOR) ? ", WWIV Color" : nulstr
			,(cfg.xtrn[i]->misc&(IO_INTS|XTRN_NOECHO))
				==(IO_INTS|XTRN_NOECHO) ? ", No Echo" : nulstr);
870
871
		sprintf(opt[k++],"%-27.27s%s","Native (32-bit) Executable"
			,cfg.xtrn[i]->misc&XTRN_NATIVE ? "Yes" : "No");
872
873
		sprintf(opt[k++],"%-27.27s%s","Use Shell to Execute"
			,cfg.xtrn[i]->misc&XTRN_SH ? "Yes" : "No");
rswindell's avatar
rswindell committed
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
		sprintf(opt[k++],"%-27.27s%s","Modify User Data"
            ,cfg.xtrn[i]->misc&MODUSERDAT ? "Yes" : "No");
		switch(cfg.xtrn[i]->event) {
			case EVENT_LOGON:
				strcpy(str,"Logon");
				break;
			case EVENT_LOGOFF:
				strcpy(str,"Logoff");
				break;
			case EVENT_NEWUSER:
				strcpy(str,"New User");
				break;
			case EVENT_BIRTHDAY:
				strcpy(str,"Birthday");
				break;
889
890
891
892
893
894
895
896
897
			case EVENT_POST:
				strcpy(str,"Message Posted");
				break;
			case EVENT_UPLOAD:
				strcpy(str,"File Uploaded");
				break;
			case EVENT_DOWNLOAD:
				strcpy(str,"File Downloaded");
				break;
rswindell's avatar
rswindell committed
898
899
			default:
				strcpy(str,"No");
900
901
				break; 
		}
rswindell's avatar
rswindell committed
902
903
904
		if(cfg.xtrn[i]->misc&EVENTONLY && cfg.xtrn[i]->event)
			strcat(str,", Only");
		sprintf(opt[k++],"%-27.27s%s","Execute on Event",str);
905
906
		sprintf(opt[k++],"%-27.27s%s","Pause After Execution"
			,cfg.xtrn[i]->misc&XTRN_PAUSE ? "Yes" : "No");
rswindell's avatar
rswindell committed
907
		sprintf(opt[k++],"%-23.23s%-4s%s","BBS Drop File Type"
908
909
			,cfg.xtrn[i]->misc&REALNAME ? "(R)":nulstr
			,dropfile(cfg.xtrn[i]->type,cfg.xtrn[i]->misc));
rswindell's avatar
rswindell committed
910
911
912
913
914
915
916
917
918
919
		sprintf(opt[k++],"%-27.27s%s","Place Drop File In"
			,cfg.xtrn[i]->misc&STARTUPDIR ? "Start-Up Directory":"Node Directory");
		sprintf(opt[k++],"Time Options...");
		opt[k][0]=0;
		SETHELP(WHERE);
/*
Online Program Configuration:

This menu is for configuring the selected online program.
*/
920
		switch(uifc.list(WIN_SAV|WIN_ACT|WIN_MID,0,0,60,&opt_dflt,0,cfg.xtrn[i]->name
rswindell's avatar
rswindell committed
921
922
923
924
925
926
927
928
929
930
931
932
			,opt)) {
			case -1:
				done=1;
				break;
			case 0:
				SETHELP(WHERE);
/*
Online Program Name:

This is the name or description of the online program (door).
*/
				strcpy(str,cfg.xtrn[i]->name);
933
				if(!uifc.input(WIN_MID|WIN_SAV,0,10,"Online Program Name"
934
					,cfg.xtrn[i]->name,sizeof(cfg.xtrn[i]->name)-1,K_EDIT))
rswindell's avatar
rswindell committed
935
936
937
938
939
940
941
942
943
944
945
946
					strcpy(cfg.xtrn[i]->name,str);
				break;
			case 1:
				SETHELP(WHERE);
/*
Online Program Internal Code:

Every online program must have its own unique code for Synchronet to
refer to it internally. This code is usually an abreviation of the
online program name.
*/
				strcpy(str,cfg.xtrn[i]->code);
947
				uifc.input(WIN_MID|WIN_SAV,0,10,"Internal Code"
948
					,str,LEN_CODE,K_UPPER|K_EDIT);
rswindell's avatar
rswindell committed
949
950
951
				if(code_ok(str))
					strcpy(cfg.xtrn[i]->code,str);
				else {
952
953
					uifc.helpbuf=invalid_code;
					uifc.msg("Invalid Code");
954
955
                    uifc.helpbuf=0; 
				}
rswindell's avatar
rswindell committed
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
                break;
			case 2:
                SETHELP(WHERE);
/*
Online Program Start-up Directory:

This is the DOS drive/directory where the online program is located.
If a path is specified here, it will be made the current directory
before the program's command line is executed. This eliminates the need
for batch files that just change the current drive and directory before
executing the program.

If this option is not used, the current NODE's directory will be the
current DOS drive/directory before the command line is executed.
*/
971
972
				uifc.input(WIN_MID|WIN_SAV,0,10,""
					,cfg.xtrn[i]->path,sizeof(cfg.xtrn[i]->path)-1,K_EDIT);
rswindell's avatar
rswindell committed
973
974
975
976
977
978
979
980
                break;
			case 3:
				SETHELP(WHERE);
/*
Online Program Command Line:

This is the command line to execute to run the online program.
*/
981
				uifc.input(WIN_MID|WIN_SAV,0,10,"Command"
982
					,cfg.xtrn[i]->cmd,sizeof(cfg.xtrn[i]->cmd)-1,K_EDIT);
rswindell's avatar
rswindell committed
983
984
985
986
987
988
989
990
991
				break;
			case 4:
				SETHELP(WHERE);
/*
Online Program Clean-up Command:

This is the command line to execute after the main command line. This
option is usually only used for multiuser online programs.
*/
992
				uifc.input(WIN_MID|WIN_SAV,0,10,"Clean-up"
993
					,cfg.xtrn[i]->clean,sizeof(cfg.xtrn[i]->clean)-1,K_EDIT);
rswindell's avatar
rswindell committed
994
995
996
997
998
999
1000
1001
1002
1003
1004
                break;
			case 5:
                ultoa(cfg.xtrn[i]->cost,str,10);
                SETHELP(WHERE);
/*
Online Program Cost to Run:

If you want users to be charged credits to run this online program,
set this value to the number of credits to charge. If you want this
online program to be free, set this value to 0.
*/
1005
                uifc.input(WIN_MID|WIN_SAV,0,0,"Cost to Run (in Credits)"
rswindell's avatar
rswindell committed
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
                    ,str,10,K_EDIT|K_NUMBER);
                cfg.xtrn[i]->cost=atol(str);
                break;
			case 6:
				sprintf(str,"%s Access",cfg.xtrn[i]->name);
				getar(str,cfg.xtrn[i]->arstr);
                break;
			case 7:
				sprintf(str,"%s Execution",cfg.xtrn[i]->name);
				getar(str,cfg.xtrn[i]->run_arstr);
                break;
			case 8:
rswindell's avatar
rswindell committed
1018
				k=cfg.xtrn[i]->misc&MULTIUSER ? 0:1;
rswindell's avatar
rswindell committed
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
				strcpy(opt[0],"Yes");
				strcpy(opt[1],"No");
				opt[2][0]=0;
				SETHELP(WHERE);
/*
Supports Multiple Users:

If this online program supports multiple simultaneous users (nodes),
set this option to Yes.
*/
1029
				k=uifc.list(WIN_MID|WIN_SAV,0,0,0,&k,0,"Supports Multiple Users"
rswindell's avatar
rswindell committed
1030
1031
1032
					,opt);
				if(!k && !(cfg.xtrn[i]->misc&MULTIUSER)) {
					cfg.xtrn[i]->misc|=MULTIUSER;
1033
					uifc.changes=TRUE; }
rswindell's avatar
rswindell committed
1034
1035
				else if(k==1 && cfg.xtrn[i]->misc&MULTIUSER) {
					cfg.xtrn[i]->misc&=~MULTIUSER;
1036
					uifc.changes=TRUE; }
rswindell's avatar
rswindell committed
1037
1038
                break;
			case 9:
rswindell's avatar
rswindell committed
1039
				k=cfg.xtrn[i]->misc&IO_INTS ? 0:1;
rswindell's avatar
rswindell committed
1040
1041
1042
1043
1044
				strcpy(opt[0],"Yes");
				strcpy(opt[1],"No");
				opt[2][0]=0;
				SETHELP(WHERE);
/*
1045
Intercept Standard I/O:
rswindell's avatar
rswindell committed
1046

rswindell's avatar
rswindell committed
1047
1048
If this online program uses a FOSSIL driver or SOCKET communications,
set this option to No.
rswindell's avatar
rswindell committed
1049
*/
1050
				k=uifc.list(WIN_MID|WIN_SAV,0,0,0,&k,0,"Intercept Standard I/O"
rswindell's avatar
rswindell committed
1051
1052
1053
					,opt);
				if(!k && !(cfg.xtrn[i]->misc&IO_INTS)) {
					cfg.xtrn[i]->misc|=IO_INTS;
1054
					uifc.changes=TRUE; }
rswindell's avatar
rswindell committed
1055
1056
				else if(k==1 && cfg.xtrn[i]->misc&IO_INTS) {
					cfg.xtrn[i]->misc&=~(IO_INTS|WWIVCOLOR);
1057
					uifc.changes=TRUE; }
rswindell's avatar
rswindell committed
1058
1059
                else if(k==-1)
                    break;
rswindell's avatar
rswindell committed
1060
1061
				if(!(cfg.xtrn[i]->misc&IO_INTS))
					break;
rswindell's avatar
rswindell committed
1062
				k=cfg.xtrn[i]->misc&WWIVCOLOR ? 0:1;
rswindell's avatar
rswindell committed
1063
1064
1065
1066
1067
1068
1069
				SETHELP(WHERE);
/*
Program Uses WWIV Color Codes:

If this program was written for use exclusively under WWIV, set this
option to Yes.
*/
1070
				k=uifc.list(WIN_MID|WIN_SAV,0,0,0,&k,0
rswindell's avatar
rswindell committed
1071
1072
1073
1074
					,"Program Uses WWIV Color Codes"
					,opt);
				if(!k && !(cfg.xtrn[i]->misc&WWIVCOLOR)) {
					cfg.xtrn[i]->misc|=WWIVCOLOR;
1075
					uifc.changes=TRUE; }
rswindell's avatar
rswindell committed
1076
1077
				else if(k==1 && cfg.xtrn[i]->misc&WWIVCOLOR) {
					cfg.xtrn[i]->misc&=~WWIVCOLOR;
1078
                    uifc.changes=TRUE; }
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
				k=cfg.xtrn[i]->misc&XTRN_NOECHO ? 1:0;
				SETHELP(WHERE);
/*
`Echo Input:`

If you want the BBS to copy ("echo") all keyboard input to the screen
output, set this option to ~Yes~ (for native Win32 programs only).
*/
				k=uifc.list(WIN_MID|WIN_SAV,0,0,0,&k,0
					,"Echo Keyboard Input"
					,opt);
				if(!k && cfg.xtrn[i]->misc&XTRN_NOECHO) {
					cfg.xtrn[i]->misc&=~XTRN_NOECHO;
					uifc.changes=TRUE; 
				} else if(k==1 && !(cfg.xtrn[i]->misc&XTRN_NOECHO)) {
					cfg.xtrn[i]->misc|=XTRN_NOECHO;
					uifc.changes=TRUE; 
				}
rswindell's avatar
rswindell committed
1097
                break;
1098
			case 10:
rswindell's avatar
rswindell committed
1099
				k=cfg.xtrn[i]->misc&XTRN_NATIVE ? 0:1;
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
				strcpy(opt[0],"Yes");
				strcpy(opt[1],"No");
				opt[2][0]=0;
				SETHELP(WHERE);
/*
Native (32-bit) Executable:

If this online program is a native 32-bit executable,
set this option to Yes.
*/
1110
				k=uifc.list(WIN_MID|WIN_SAV,0,0,0,&k,0
1111
1112
1113
					,"Native (32-bit)",opt);
				if(!k && !(cfg.xtrn[i]->misc&XTRN_NATIVE)) {
					cfg.xtrn[i]->misc|=XTRN_NATIVE;
1114
					uifc.changes=TRUE; }
1115
1116
				else if(k==1 && cfg.xtrn[i]->misc&XTRN_NATIVE) {
					cfg.xtrn[i]->misc&=~XTRN_NATIVE;
1117
					uifc.changes=TRUE; }
1118
				break;
rswindell's avatar
rswindell committed
1119
			case 11:
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
				k=cfg.xtrn[i]->misc&XTRN_SH ? 0:1;
				strcpy(opt[0],"Yes");
				strcpy(opt[1],"No");
				opt[2][0]=0;
				SETHELP(WHERE);
/*
`Use Shell to Execute Command:`

If this command-line requires the system command shell to execute, (Unix 
shell script or DOS batch file), set this option to ~Yes~.
*/
				k=uifc.list(WIN_MID|WIN_SAV,0,0,0,&k,0
					,"Use Shell",opt);
				if(!k && !(cfg.xtrn[i]->misc&XTRN_SH)) {
					cfg.xtrn[i]->misc|=XTRN_SH;
					uifc.changes=TRUE; 
				}
				else if(k==1 && cfg.xtrn[i]->misc&XTRN_SH) {
					cfg.xtrn[i]->misc&=~XTRN_SH;
					uifc.changes=TRUE; 
				}
				break;
			case 12:
rswindell's avatar
rswindell committed
1143
				k=cfg.xtrn[i]->misc&MODUSERDAT ? 0:1;
rswindell's avatar
rswindell committed
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
				strcpy(opt[0],"Yes");
				strcpy(opt[1],"No");
				opt[2][0]=0;
				SETHELP(WHERE);
/*
Program Can Modify User Data:

If this online programs recognizes the Synchronet MODUSER.DAT format
or the RBBS/QuickBBS EXITINFO.BBS format and you want it to be able to
modify the data of users who run the program, set this option to Yes.
*/
1155
				k=uifc.list(WIN_MID|WIN_SAV,0,0,0,&k,0
rswindell's avatar
rswindell committed
1156
1157
1158
					,"Program Can Modify User Data",opt);
				if(!k && !(cfg.xtrn[i]->misc&MODUSERDAT)) {
					cfg.xtrn[i]->misc|=MODUSERDAT;
1159
					uifc.changes=TRUE; }
rswindell's avatar
rswindell committed
1160
1161
				else if(k==1 && cfg.xtrn[i]->misc&MODUSERDAT) {
					cfg.xtrn[i]->misc&=~MODUSERDAT;
1162
					uifc.changes=TRUE; }
rswindell's avatar
rswindell committed
1163
                break;
1164
			case 13:
rswindell's avatar
rswindell committed
1165
1166
1167
1168
1169
1170
				k=0;
				strcpy(opt[k++],"No");
				strcpy(opt[k++],"Logon");
				strcpy(opt[k++],"Logoff");
				strcpy(opt[k++],"New User");
				strcpy(opt[k++],"Birthday");
1171
1172
1173
				strcpy(opt[k++],"Message Posted");
				strcpy(opt[k++],"File Uploaded");
				strcpy(opt[k++],"File Downloaded");
rswindell's avatar
rswindell committed
1174
				opt[k][0]=0;
1175
				k=cfg.xtrn[i]->event;
rswindell's avatar
rswindell committed
1176
1177
1178
1179
1180
1181
1182
				SETHELP(WHERE);
/*
Execute Online Program on Event:

If you would like this online program to automatically execute on a
specific user event, select the event. Otherwise, select No.
*/
1183
				k=uifc.list(WIN_MID|WIN_SAV,0,0,0,&k,0
rswindell's avatar
rswindell committed
1184
1185
1186
1187
1188
					,"Execute on Event",opt);
				if(k==-1)
					break;
				if(cfg.xtrn[i]->event!=k) {
					cfg.xtrn[i]->event=k;
1189
					uifc.changes=TRUE; }
rswindell's avatar
rswindell committed
1190
1191
				if(!cfg.xtrn[i]->event)
					break;
rswindell's avatar
rswindell committed
1192
				k=cfg.xtrn[i]->misc&EVENTONLY ? 0:1;
rswindell's avatar
rswindell committed
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
                strcpy(opt[0],"Yes");
                strcpy(opt[1],"No");
				opt[2][0]=0;
				SETHELP(WHERE);
/*
Execute Online Program as Event Only:

If you would like this online program to execute as an event only
(not available to users on the online program menu), set this option
to Yes.
*/
1204
				k=uifc.list(WIN_MID|WIN_SAV,0,0,0,&k
rswindell's avatar
rswindell committed
1205
1206
1207
1208
					,0,"Execute as Event Only"
                    ,opt);
                if(!k && !(cfg.xtrn[i]->misc&EVENTONLY)) {
                    cfg.xtrn[i]->misc|=EVENTONLY;
1209
                    uifc.changes=TRUE; }
rswindell's avatar
rswindell committed
1210
1211
                else if(k==1 && cfg.xtrn[i]->misc&EVENTONLY) {
                    cfg.xtrn[i]->misc&=~EVENTONLY;
1212
                    uifc.changes=TRUE; }
rswindell's avatar
rswindell committed
1213
                break;
1214
			case 14:
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
				k=cfg.xtrn[i]->misc&XTRN_PAUSE ? 0:1;
				strcpy(opt[0],"Yes");
				strcpy(opt[1],"No");
				opt[2][0]=0;
				SETHELP(WHERE);
/*
`Pause Screen After Execution:`

Set this option to ~Yes~ if you would like an automatic screen pause
(`[Hit a key]` prompt) to appear after the program executes.

This can be useful if the program displays information just before exiting
or you want to debug a program with a program not running correctly.
*/
				k=uifc.list(WIN_MID|WIN_SAV,0,0,0,&k,0
					,"Pause After Execution",opt);
				if((!k && !(cfg.xtrn[i]->misc&XTRN_PAUSE))
					|| (k && cfg.xtrn[i]->misc&XTRN_PAUSE)) {
					cfg.xtrn[i]->misc^=XTRN_PAUSE;
					uifc.changes=TRUE; 
				}
				break;
			case 15:
rswindell's avatar
rswindell committed
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
				k=0;
				strcpy(opt[k++],"None");
				sprintf(opt[k++],"%-15s %s","Synchronet","XTRN.DAT");
				sprintf(opt[k++],"%-15s %s","WWIV","CHAIN.TXT");
				sprintf(opt[k++],"%-15s %s","GAP","DOOR.SYS");
				sprintf(opt[k++],"%-15s %s","RBBS/QuickBBS","DORINFO#.DEF");
				sprintf(opt[k++],"%-15s %s","Wildcat","CALLINFO.BBS");
				sprintf(opt[k++],"%-15s %s","PCBoard","PCBOARD.SYS");
				sprintf(opt[k++],"%-15s %s","SpitFire","SFDOORS.DAT");
				sprintf(opt[k++],"%-15s %s","MegaMail","UTIDOOR.TXT");
				sprintf(opt[k++],"%-15s %s","Solar Realms","DOORFILE.SR");
				sprintf(opt[k++],"%-15s %s","RBBS/QuickBBS","DORINFO1.DEF");
				sprintf(opt[k++],"%-15s %s","TriBBS","TRIBBS.SYS");
1251
				sprintf(opt[k++],"%-15s %s","Mystic","DOOR32.SYS");
rswindell's avatar
rswindell committed
1252
1253
1254
1255
1256
1257
1258
1259
1260
				opt[k][0]=0;
				k=cfg.xtrn[i]->type;
				SETHELP(WHERE);
/*
Online Program BBS Drop File Type:

If this online program requires a specific BBS data (drop) file
format, select the file format from the list.
*/
1261
				k=uifc.list(WIN_MID|WIN_SAV,0,0,0,&k,0
rswindell's avatar
rswindell committed
1262
1263
1264
1265
1266
					,"BBS Drop File Type",opt);
				if(k==-1)
					break;
				if(cfg.xtrn[i]->type!=k) {
					cfg.xtrn[i]->type=k;
1267
1268
                    if(cfg.xtrn[i]->type==XTRN_DOOR32)
                        cfg.xtrn[i]->misc|=XTRN_NATIVE;
1269
					uifc.changes=TRUE; }
rswindell's avatar
rswindell committed
1270
1271
1272
1273
				if(cfg.xtrn[i]->type && cfg.uq&UQ_ALIASES) {
					strcpy(opt[0],"Yes");
					strcpy(opt[1],"No");
					opt[2][0]=0;
rswindell's avatar
rswindell committed
1274
					k=cfg.xtrn[i]->misc&REALNAME ? 0:1;
1275
					k=uifc.list(WIN_MID|WIN_SAV,0,0,0,&k,0,"Use Real Names",opt);
rswindell's avatar
rswindell committed
1276
1277
					if(k==0 && !(cfg.xtrn[i]->misc&REALNAME)) {
						cfg.xtrn[i]->misc|=REALNAME;
1278
						uifc.changes=TRUE; }
rswindell's avatar
rswindell committed
1279
1280
					else if(k==1 && cfg.xtrn[i]->misc&REALNAME) {
						cfg.xtrn[i]->misc&=~REALNAME;
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
						uifc.changes=TRUE; 
					} 
				}
				if(cfg.xtrn[i]->type) {
					strcpy(opt[0],"Yes");
					strcpy(opt[1],"No");
					opt[2][0]=0;
					k=cfg.xtrn[i]->misc&XTRN_LWRCASE ? 0:1;
					k=uifc.list(WIN_MID|WIN_SAV,0,0,0,&k,0,"Lowercase Filename",opt);
					if(k==0 && !(cfg.xtrn[i]->misc&XTRN_LWRCASE)) {
						cfg.xtrn[i]->misc|=XTRN_LWRCASE;
						uifc.changes=TRUE; 
					}
					else if(k==1 && cfg.xtrn[i]->misc&XTRN_LWRCASE) {
						cfg.xtrn[i]->misc&=~XTRN_LWRCASE;
						uifc.changes=TRUE; 
					} 
				}
rswindell's avatar
rswindell committed
1299
				break;
1300
			case 16:
rswindell's avatar
rswindell committed
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
				k=0;
				strcpy(opt[0],"Node Directory");
				strcpy(opt[1],"Start-up Directory");
				opt[2][0]=0;
				SETHELP(WHERE);
/*
Directory for Drop File:

You can have the data file created in the current Node Directory or the
Start-up Directory (if one is specified).
*/
1312
				k=uifc.list(WIN_MID|WIN_SAV,0,0,0,&k,0,"Create Drop File In"
rswindell's avatar
rswindell committed
1313
1314
1315
                    ,opt);
				if(!k && cfg.xtrn[i]->misc&STARTUPDIR) {
					cfg.xtrn[i]->misc&=~STARTUPDIR;
1316
                    uifc.changes=TRUE; }
rswindell's avatar
rswindell committed
1317
1318
				else if(k==1 && !(cfg.xtrn[i]->misc&STARTUPDIR)) {
					cfg.xtrn[i]->misc|=STARTUPDIR;
1319
                    uifc.changes=TRUE; }
rswindell's avatar
rswindell committed
1320
				break;
1321
			case 17:
rswindell's avatar
rswindell committed
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
				while(1) {
					k=0;
					if(cfg.xtrn[i]->textra)
						sprintf(str,"%u minutes",cfg.xtrn[i]->textra);
					else
						strcpy(str,"None");
					sprintf(opt[k++],"%-25.25s%s","Extra Time",str);
					if(cfg.xtrn[i]->maxtime)
						sprintf(str,"%u minutes",cfg.xtrn[i]->maxtime);
					else
						strcpy(str,"None");
					sprintf(opt[k++],"%-25.25s%s","Maximum Time",str);
					sprintf(opt[k++],"%-25.25s%s","Suspended (Free) Time"
						,cfg.xtrn[i]->misc&FREETIME ? "Yes" : "No");
1336
1337
					sprintf(opt[k++],"%-25.25s%s","Monitor Time Left"
						,cfg.xtrn[i]->misc&XTRN_CHKTIME ? "Yes" : "No");
rswindell's avatar
rswindell committed
1338
1339
1340
1341
1342
1343
1344
1345
					opt[k][0]=0;
					SETHELP(WHERE);
/*
Online Program Time Options:

This sub-menu allows you to define specific preferences regarding the
time users spend running this program.
*/
1346
					k=uifc.list(WIN_SAV|WIN_ACT|WIN_RHT|WIN_BOT,0,0,40
rswindell's avatar
rswindell committed
1347
1348
1349
1350
1351
1352
						,&time_dflt,0
						,"Online Program Time Options",opt);
					if(k==-1)
						break;
					switch(k) {
						case 0:
1353
							ultoa(cfg.xtrn[i]->textra,str,10);
rswindell's avatar
rswindell committed
1354
1355
1356
1357
1358
1359
1360
1361
							SETHELP(WHERE);
/*
Extra Time to Give User in Program:

If you want to give users extra time while in this online program,
set this value to the number of minutes to add to their current time
left online.
*/
1362
							uifc.input(WIN_MID|WIN_SAV,0,0
rswindell's avatar
rswindell committed
1363
1364
1365
1366
1367
								,"Extra Time to Give User (in minutes)"
								,str,2,K_EDIT|K_NUMBER);
							cfg.xtrn[i]->textra=atoi(str);
							break;
						case 1:
1368
							ultoa(cfg.xtrn[i]->maxtime,str,10);
rswindell's avatar
rswindell committed
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
							SETHELP(WHERE);
/*
Maximum Time Allowed in Program:

If this program supports a drop file that contains the number of minutes
left online for the current user, this option allows the sysop to set
the maximum number of minutes that will be allowed in the drop file.

Setting this option to 0, disables this feature.
*/
1379
							uifc.input(WIN_MID|WIN_SAV,0,0
rswindell's avatar
rswindell committed
1380
1381
1382
1383
1384
								,"Maximum Time (in minutes, 0=disabled)"
								,str,