Synchronet now requires the libarchive development package (e.g. libarchive-dev on Debian-based Linux distros, libarchive.org for more info) to build successfully.

scfgsub.c 56.1 KB
Newer Older
1 2 3 4
/****************************************************************************
 * @format.tab-size 4		(Plain Text/Source Code File Header)			*
 * @format.use-tabs true	(see http://www.synchro.net/ptsc_hdr.html)		*
 *																			*
5
 * Copyright Rob Swindell - http://www.synchro.net/copyright.html			*
6 7 8 9 10 11 12 13 14 15 16 17 18
 *																			*
 * 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										*
 *																			*
 * For Synchronet coding style and modification guidelines, see				*
 * http://www.synchro.net/source.html										*
 *																			*
 * Note: If this box doesn't appear square, then you need to fix your tabs.	*
 ****************************************************************************/
rswindell's avatar
rswindell committed
19 20

#include "scfg.h"
rswindell's avatar
rswindell committed
21

22 23
static sub_t** cut_qhub_sub;

24
bool new_sub(unsigned new_subnum, unsigned group_num, sub_t* pasted_sub, long misc)
rswindell's avatar
rswindell committed
25 26 27 28 29 30 31 32 33 34
{
	sub_t* new_subboard;
	if ((new_subboard = (sub_t *)malloc(sizeof(*new_subboard))) == NULL) {
		errormsg(WHERE, ERR_ALLOC, "sub-board", sizeof(*new_subboard));
		return false;
	}
	memset(new_subboard, 0, sizeof(*new_subboard));
	if (cfg.total_faddrs)
		new_subboard->faddr = cfg.faddr[0];
	/* ToDo: Define these defaults somewhere else: */
rswindell's avatar
rswindell committed
35
	new_subboard->misc = (SUB_NSDEF | SUB_SSDEF | SUB_QUOTE | SUB_TOUSER | SUB_FAST);
36
	new_subboard->misc |= misc;
37 38
	if(new_subboard->misc&(SUB_FIDO | SUB_INET))
		new_subboard->misc |= SUB_NOVOTING;
39
	new_subboard->pmode = P_MARKUP | P_HIDEMARKS | P_NOATCODES;
rswindell's avatar
rswindell committed
40 41
	new_subboard->maxmsgs = 500;

42 43 44 45 46 47 48 49 50
	/* Use last sub in group (if exists) as a template for new subs */
	for (unsigned u = 0; u < cfg.total_subs; u++) {
		if(cfg.sub[u]->grp == group_num) {
			*new_subboard = *cfg.sub[u];
			new_subboard->misc &= ~SUB_TEMPLATE;
			if(cfg.sub[u]->misc & SUB_TEMPLATE)	/* Use this sub (not last) if marked as template */
				break;
		}
	}
rswindell's avatar
rswindell committed
51
	new_subboard->misc |= SUB_HDRMOD;
52 53 54 55 56 57 58 59
	if (pasted_sub != NULL) {
		*new_subboard = *pasted_sub;
		if (cut_qhub_sub != NULL && (*cut_qhub_sub) == NULL) {
			*cut_qhub_sub = new_subboard;
			cut_qhub_sub = NULL;
		}
	}
	new_subboard->grp = group_num;
60

rswindell's avatar
rswindell committed
61
	/* Allocate a new (unused) pointer index (deprecated!) */
rswindell's avatar
rswindell committed
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83
	for (; new_subboard->ptridx < USHRT_MAX; new_subboard->ptridx++) {
		int n;
		for (n = 0; n < cfg.total_subs; n++)
			if (cfg.sub[n]->ptridx == new_subboard->ptridx)
				break;
		if (n == cfg.total_subs)
			break;
	}

	sub_t **new_sub_list;
	if ((new_sub_list = (sub_t **)realloc(cfg.sub, sizeof(sub_t *)*(cfg.total_subs + 1))) == NULL) {
		errormsg(WHERE, ERR_ALLOC, "sub list", cfg.total_subs + 1);
		free(new_subboard);
		return false;
	}
	cfg.sub = new_sub_list;

	/* Move higher numbered subs (for inserting) */
	for (unsigned u = cfg.total_subs; u > new_subnum; u--)
		cfg.sub[u] = cfg.sub[u - 1];


84
	new_subboard->subnum = new_subnum;
rswindell's avatar
rswindell committed
85 86
	cfg.sub[new_subnum] = new_subboard;
	cfg.total_subs++;
87

rswindell's avatar
rswindell committed
88 89 90
	return true;
}

91
void remove_sub(scfg_t* cfg, unsigned subnum, bool cut)
92 93
{
	sub_t* sub = cfg->sub[subnum];
94 95
	if(cut)
		cut_qhub_sub = NULL;
96 97 98
	// Remove the sub-board from any QWKnet hub sub-boards
	for (unsigned q = 0; q < cfg->total_qhubs; q++) {
		for (unsigned s = 0; s < cfg->qhub[q]->subs; s++) {
99 100 101
			if (cfg->qhub[q]->sub[s] == sub) {
				if(cut && cut_qhub_sub == NULL)
					cut_qhub_sub = &cfg->qhub[q]->sub[s];
102
				cfg->qhub[q]->sub[s] = NULL;
103
			}
104 105 106 107 108 109 110 111
		}
	}
	FREE_AND_NULL(cfg->sub[subnum]);
	--cfg->total_subs;
	for (unsigned i = subnum; i < cfg->total_subs; i++)
		cfg->sub[i] = cfg->sub[i + 1];
}

rswindell's avatar
rswindell committed
112 113
void sub_cfg(uint grpnum)
{
114
	static int dflt,tog_dflt,tog_bar,opt_dflt,net_dflt,adv_dflt,bar;
115
	char str[128],str2[128],done=0,code[128];
116 117
	char path[MAX_PATH+1];
	char data_dir[MAX_PATH+1];
118
	int j,m,n;
rswindell's avatar
rswindell committed
119
	uint i,subnum[MAX_OPTS+1];
rswindell's avatar
rswindell committed
120 121
	static sub_t savsub;

122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165
	char* sub_long_name_help = 
		"`Sub-board Long Name:`\n"
		"\n"
		"This is a description of the message sub-board which is displayed in all\n"
		"sub-board (message area) listings.\n"
		"\n"
		"Sub-board Long Names are limited to 40 characters in length.\n"
		"\n"
		"If don't have any good ideas for a Long Name or description and just\n"
		"want to use a short name (less than or equal to 25 characters in length)\n"
		"for both the Sub-board Long Name and Short Name, there is no harm in"
		"doing that."
		;
	char* sub_short_name_help =
		"`Sub-board Short Name:`\n"
		"\n"
		"This is a unique name to assign the message sub-board. This name will be\n"
		"displayed in prompts and other areas where space may be limited or where\n"
		"a full message area description (Long Name) is unnecessary.\n"
		"\n"
		"Sub-board Short Names are limited to 25 characters in length.\n"
		"\n"
		"For sub-boards that are FidoNet-networked (using FTN), it is customary\n"
		"to use the standardized `Echo Tag` or `Area Tag` as the sub-board Short Name\n"
		"replacing underscore (`_`) characters with spaces.  This will make the\n"
		"task of importing-from or exporting-to EchoLists (e.g. `BACKBONE.NA`) or\n"
		"an Area File (e.g. `areas.bbs`) much easier."
		;
	char* sub_code_help =
		"`Sub-board Internal Code Suffix:`\n"
		"\n"
		"Every sub-board must have its own unique code for Synchronet to refer\n"
		"to it internally. This code should be descriptive of the sub-board's\n"
		"topic, usually an abbreviation of the sub-board's name.\n"
		"\n"
		"`Note:` The Internal Code (displayed) is the complete internal code\n"
		"constructed from the message group's `Code Prefix` and the sub-board's\n"
		"`Code Suffix`.\n"
		"\n"
		"Changing a sub-board's internal code (suffix or prefix) changes the\n"
		"underlying database file filenames used for that sub-board, so change\n"
		"these values with caution."
		;

166 167 168 169
	while(1) {
		if(uifc.changes && cfg.grp[grpnum]->sort)
			sort_subs(grpnum);
		int maxlen = 0;
170
		bool template_shown = false;
171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191
		for(i=0,j=0;i<cfg.total_subs && j<MAX_OPTS;i++)
			if(cfg.sub[i]->grp==grpnum) {
				subnum[j]=i;
				int len = 0;
				opt[j][0] = 0;
				if(cfg.sub[subnum[0]]->qwkconf)
					len += sprintf(opt[j], "%-5u ", cfg.sub[i]->qwkconf);
				char* name = cfg.sub[i]->lname;
				int name_len = LEN_SLNAME;
				switch(cfg.grp[grpnum]->sort) {
					case AREA_SORT_SNAME:
						name = cfg.sub[i]->sname;
						name_len = LEN_SSNAME;
						break;
					case AREA_SORT_CODE:
						name = cfg.sub[i]->code_suffix;
						name_len = LEN_CODE;
						break;
					default:	/* Defeat stupid GCC warning */
						break;
				}
192 193 194
				sprintf(str, "%-*s %c", name_len, name, (cfg.sub[i]->misc&SUB_TEMPLATE && !template_shown) ? '*' : ' ');
				if(cfg.sub[i]->misc&SUB_TEMPLATE)
					template_shown = true;
195 196 197 198 199
				truncsp(str);
				len += sprintf(opt[j] + strlen(opt[j]), "%s", str);
				if(len > maxlen)
					maxlen = len;
				j++; 
200
			}
201 202 203 204 205 206 207 208 209 210
		subnum[j]=cfg.total_subs;
		opt[j][0]=0;
		sprintf(str,"%s Sub-boards (%u)",cfg.grp[grpnum]->sname, j);
		int mode = WIN_SAV|WIN_ACT|WIN_RHT;
		if(j)
			mode |= WIN_DEL|WIN_COPY|WIN_CUT|WIN_DELACT;
		if(j<MAX_OPTS)
			mode |= WIN_INS|WIN_XTR|WIN_PASTEXTR|WIN_INSACT;
		if(savsub.sname[0])
			mode |= WIN_PASTE;
211
		uifc.helpbuf=
212
			"`Message Sub-boards:`\n"
213
			"\n"
214 215 216 217 218 219 220 221 222 223 224 225
			"This is a list of message sub-boards that have been configured for the\n"
			"selected message group.\n"
			"\n"
			"The `template` sub-board, if one exists, will be denoted with an asterisk.\n"
			"Normally, only one template sub-board should exist per message group.\n"
			"\n"
			"To add a sub-board, select the desired position with the arrow keys and\n"
			"hit ~ INS ~.\n"
			"\n"
			"To delete a sub-board, select it with the arrow keys and hit ~ DEL ~.\n"
			"\n"
			"To configure a sub-board, select it with the arrow keys and hit ~ ENTER ~.\n"
226
		;
227 228 229 230 231 232
		i = uifc.list(mode, 0, 0, maxlen+5, &dflt, &bar, str, opt);
		if((signed)i==-1)
			return;
		int msk = i & MSK_ON;
		i &= MSK_OFF;
		if((int)i > j)
rswindell's avatar
rswindell committed
233
			continue;
234 235 236 237 238 239 240 241 242 243 244 245 246
		if(msk==MSK_INS) {
			strcpy(str,"General");
			uifc.helpbuf=sub_long_name_help;
			if(uifc.input(WIN_MID|WIN_SAV,0,0,"Sub-board Long Name",str,LEN_SLNAME
				,K_EDIT)<1)
				continue;
			sprintf(str2,"%.*s",LEN_SSNAME,str);
			uifc.helpbuf=sub_short_name_help;
			if(uifc.input(WIN_MID|WIN_SAV,0,0,"Sub-board Short Name",str2,LEN_SSNAME
				,K_EDIT)<1)
				continue;
	#if 0
			sprintf(str3,"%.10s",str2);
247
			uifc.helpbuf=
248
				"`Sub-board QWK Name:`\n"
249
				"\n"
250
				"This is the name of the sub-board used for QWK off-line readers.\n"
251
			;
252 253 254 255 256 257 258 259 260 261 262 263 264 265 266
			if(uifc.input(WIN_MID|WIN_SAV,0,0,"Sub-board QWK Name",str3,10
				,K_EDIT)<1)
				continue;
	#endif
			SAFECOPY(code,str2);
			prep_code(code,/* prefix: */NULL);
			uifc.helpbuf=sub_code_help;
			if(uifc.input(WIN_MID|WIN_SAV,0,0,"Sub-board Internal Code Suffix",code,LEN_CODE
				,K_EDIT|K_UPPER)<1)
				continue;
			if(!code_ok(code)) {
				uifc.helpbuf=invalid_code;
				uifc.msg("Invalid Code");
				uifc.helpbuf=0;
				continue; 
267
			}
rswindell's avatar
rswindell committed
268

269
			if (!new_sub(subnum[i], grpnum, /* pasted_sub: */NULL, /* misc: */0))
270 271 272 273 274 275 276 277 278 279 280 281 282
				continue;

			SAFECOPY(cfg.sub[subnum[i]]->code_suffix,code);
			SAFECOPY(cfg.sub[subnum[i]]->lname,str);
			SAFECOPY(cfg.sub[subnum[i]]->sname,str2);
			SAFECOPY(cfg.sub[subnum[i]]->qwkname,code);
			if(strchr(str,'.') && strchr(str,' ')==NULL)
				SAFECOPY(cfg.sub[subnum[i]]->newsgroup,str);
			uifc.changes = TRUE;
			continue; 
		}
		if(msk == MSK_DEL || msk == MSK_CUT) {
			if (msk == MSK_DEL) {
283
				uifc.helpbuf=
284
					"`Delete Data in Sub-board:`\n"
285
					"\n"
286
					"If you want to delete all the messages for this sub-board, select `Yes`.\n"
287
				;
288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304
				j=1;
				SAFEPRINTF2(str,"%s%s.*"
					,cfg.grp[cfg.sub[subnum[i]]->grp]->code_prefix
					,cfg.sub[subnum[i]]->code_suffix);
				strlwr(str);
				if(!cfg.sub[subnum[i]]->data_dir[0])
					SAFEPRINTF(data_dir,"%ssubs/",cfg.data_dir);
				else
					SAFECOPY(data_dir,cfg.sub[subnum[i]]->data_dir);

				SAFEPRINTF2(path,"%s%s",data_dir,str);
				if(fexist(path)) {
					SAFEPRINTF(str2,"Delete %s",path);
					j=uifc.list(WIN_MID|WIN_SAV,0,0,0,&j,0
						,str2,uifcYesNoOpts);
					if(j==-1)
						continue;
305
					if(j==0)
306
						delfiles(data_dir,str, /* keep: */0);
307
				}
308 309 310
			}
			if(msk == MSK_CUT)
				savsub = *cfg.sub[subnum[i]];
311
			remove_sub(&cfg, subnum[i], msk == MSK_CUT);
312 313 314 315 316
			uifc.changes = TRUE;
			continue; 
		}
		if(msk==MSK_COPY) {
			savsub=*cfg.sub[subnum[i]];
317
			cut_qhub_sub = NULL;
318 319 320
			continue; 
		}
		if(msk == MSK_PASTE) {
321
			if (!new_sub(subnum[i], grpnum, &savsub, /* misc: */0))
322 323 324 325 326 327 328 329 330 331 332 333 334 335 336
				continue;
			uifc.changes = TRUE;
			continue; 
		}
		i=subnum[i];
		j=0;
		done=0;
		while(!done) {
			n=0;
			sprintf(opt[n++],"%-27.27s%s","Long Name",cfg.sub[i]->lname);
			sprintf(opt[n++],"%-27.27s%s","Short Name",cfg.sub[i]->sname);
			sprintf(opt[n++],"%-27.27s%s","QWK Name",cfg.sub[i]->qwkname);
			sprintf(opt[n++],"%-27.27s%s%s","Internal Code"
				,cfg.grp[cfg.sub[i]->grp]->code_prefix, cfg.sub[i]->code_suffix);
			sprintf(opt[n++],"%-27.27s%s","Newsgroup Name",cfg.sub[i]->newsgroup);
337
			sprintf(opt[n++],"%-27.27s%s","Access Requirements"
338
				,cfg.sub[i]->arstr);
339
			sprintf(opt[n++],"%-27.27s%s","Reading Requirements"
340
				,cfg.sub[i]->read_arstr);
341
			sprintf(opt[n++],"%-27.27s%s","Posting Requirements"
342
				,cfg.sub[i]->post_arstr);
343
			sprintf(opt[n++],"%-27.27s%s","Operator Requirements"
344
				,cfg.sub[i]->op_arstr);
345
			sprintf(opt[n++],"%-27.27s%s","Moderated Posting User"
346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361
				,cfg.sub[i]->mod_arstr);
			if(cfg.sub[i]->maxmsgs)
				sprintf(str, "%"PRIu32, cfg.sub[i]->maxmsgs);
			else
				strcpy(str, "Unlimited");
			sprintf(opt[n++],"%-27.27s%s","Maximum Messages", str);
			if(cfg.sub[i]->maxage)
				sprintf(str,"Enabled (%u days old)",cfg.sub[i]->maxage);
			else
				strcpy(str,"Disabled");
			sprintf(opt[n++],"%-27.27s%s","Purge by Age",str);
			if(cfg.sub[i]->maxcrcs)
				sprintf(str,"Enabled (%"PRIu32" message CRCs)",cfg.sub[i]->maxcrcs);
			else
				strcpy(str,"Disabled");
			sprintf(opt[n++],"%-27.27s%s","Duplicate Checking",str);
362

363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380
			strcpy(opt[n++],"Toggle Options...");
			strcpy(opt[n++],"Network Options...");
			strcpy(opt[n++],"Advanced Options...");
			opt[n][0]=0;
			sprintf(str,"%s Sub-board", cfg.sub[i]->sname);
			uifc.helpbuf=
				"`Sub-board Configuration:`\n"
				"\n"
				"This menu allows you to configure the individual selected sub-board.\n"
				"Options with a trailing `...` provide a sub-menu of more options.\n"
			;
			switch(uifc.list(WIN_ACT|WIN_SAV|WIN_BOT|WIN_L2R
				,0,0,60,&opt_dflt,0,str,opt)) {
				case -1:
					done=1;
					break;
				case 0:
					uifc.helpbuf=sub_long_name_help;
381
					SAFECOPY(str, cfg.sub[i]->lname);
382
					if(uifc.input(WIN_MID|WIN_SAV,0,17,"Name to use for Listings"
383 384
						,str,LEN_SLNAME,K_EDIT) > 0)
						SAFECOPY(cfg.sub[i]->lname, str);
385 386 387
					break;
				case 1:
					uifc.helpbuf=sub_short_name_help;
388 389 390 391
					SAFECOPY(str, cfg.sub[i]->sname);
					if(uifc.input(WIN_MID|WIN_SAV,0,17,"Name to use for Prompts"
						,str,LEN_SSNAME,K_EDIT) > 0)
						SAFECOPY(cfg.sub[i]->sname, str);
392 393
					break;
				case 2:
394
					uifc.helpbuf=
395
						"`Sub-board QWK Conference Name:`\n"
396
						"\n"
397 398 399 400 401 402 403 404
						"This is the name of the sub-board to be used in the CONTROL.DAT file\n"
						"included in QWK packets for display by QWK off-line readers.\n"
						"\n"
						"For QWK Extended (QWKE) packets, the included Conference Names will be\n"
						"automatically generated from each message group short name and each\n"
						"sub-board's long name.\n"
						"\n"
						"QWK Conference Names are not used in QWK networks."
405
					;
406 407
					uifc.input(WIN_MID|WIN_SAV,0,17,"QWK Conference Name"
						,cfg.sub[i]->qwkname, sizeof(cfg.sub[i]->qwkname)-1, K_EDIT);
408 409 410 411 412 413 414 415 416 417 418 419
					break;
				case 3:
					uifc.helpbuf=sub_code_help;
					SAFECOPY(str,cfg.sub[i]->code_suffix);
					uifc.input(WIN_MID|WIN_SAV,0,17,"Internal Code Suffix (unique)"
						,str,LEN_CODE,K_EDIT|K_UPPER);
					if(code_ok(str))
						SAFECOPY(cfg.sub[i]->code_suffix,str);
					else {
						uifc.helpbuf=invalid_code;
						uifc.msg("Invalid Code");
						uifc.helpbuf=0; 
420
					}
421 422
					break;
				case 4:
423
					uifc.helpbuf=
424
						"`Newsgroup Name:`\n"
425
						"\n"
426 427 428
						"This is the name of the sub-board used for newsgroup readers. If no name\n"
						"is configured here, a name will be automatically generated from the\n"
						"Sub-board's Short Name and message group's Short Name.\n"
429 430 431 432 433
						"\n"
						"This field may also be used to specify the FidoNet-style `Echo Tag` for\n"
						"this message area.\n"
						"\n"
						"This name should ~ not ~ contain spaces."
434
					;
435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459
					uifc.input(WIN_MID|WIN_SAV,0,17,""
						,cfg.sub[i]->newsgroup,sizeof(cfg.sub[i]->newsgroup)-1,K_EDIT);
					break;
				case 5:
					sprintf(str,"%s Access",cfg.sub[i]->sname);
					getar(str,cfg.sub[i]->arstr);
					break;
				case 6:
					sprintf(str,"%s Reading",cfg.sub[i]->sname);
					getar(str,cfg.sub[i]->read_arstr);
					break;
				case 7:
					sprintf(str,"%s Posting",cfg.sub[i]->sname);
					getar(str,cfg.sub[i]->post_arstr);
					break;
				case 8:
					sprintf(str,"%s Operator",cfg.sub[i]->sname);
					getar(str,cfg.sub[i]->op_arstr);
					break;
				case 9:
					sprintf(str,"%s Moderated Posting User",cfg.sub[i]->sname);
					getar(str,cfg.sub[i]->mod_arstr);
					break;
				case 10:
					sprintf(str,"%"PRIu32,cfg.sub[i]->maxmsgs);
460
					uifc.helpbuf=
461 462 463 464 465 466 467 468
						"`Maximum Number of Messages:`\n"
						"\n"
						"This value is the maximum number of messages that will be kept in the\n"
						"sub-board. It is possible for newly-posted or imported messages to\n"
						"exceed this maximum (it is `not` an immediately imposed limit).\n"
						"\n"
						"Older messages that exceed this maximum count are purged using `smbutil`,\n"
						"typically run as a timed event (e.g. `MSGMAINT`).\n"
469
						"\n"
470 471
						"A value of `0` means no maximum number of stored messages will be\n"
						"imposed during message-base maintenance."
472
					;
473
					uifc.input(WIN_MID|WIN_SAV,0,17,"Maximum Number of Messages (0=Unlimited)"
474 475 476 477 478 479 480 481 482 483 484 485 486 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 512 513 514 515 516 517 518 519 520
						,str,9,K_EDIT|K_NUMBER);
					cfg.sub[i]->maxmsgs=atoi(str);
					cfg.sub[i]->misc|=SUB_HDRMOD;
					break;
				case 11:
					sprintf(str,"%u",cfg.sub[i]->maxage);
					uifc.helpbuf=
						"`Maximum Age of Messages:`\n"
						"\n"
						"This value is the maximum number of days that messages will be kept in\n"
						"the sub-board.\n"
						"\n"
						"Message age is calculated from the date and time of message import/post\n"
						"and not necessarily the date/time the message was originally written.\n"
						"\n"
						"Old messages are purged using `smbutil`, typically run as a timed\n"
						"event (e.g. `MSGMAINT`).\n"
						"\n"
						"A value of `0` means no maximum age of stored messages will be\n"
						"imposed during message-base maintenance."
					;
					uifc.input(WIN_MID|WIN_SAV,0,17,"Maximum Age of Messages (in days)"
						,str,5,K_EDIT|K_NUMBER);
					cfg.sub[i]->maxage=atoi(str);
					cfg.sub[i]->misc|=SUB_HDRMOD;
					break;
				case 12:
					sprintf(str,"%"PRIu32,cfg.sub[i]->maxcrcs);
					uifc.helpbuf=
						"`Maximum Number of CRCs:`\n"
						"\n"
						"This value is the maximum number of CRCs that will be kept in the\n"
						"sub-board for duplicate message checking. Once this maximum number of\n"
						"CRCs is reached, the oldest CRCs will be automatically purged.\n"
						"\n"
						"A value of `0` means no CRCs (or other hashes) of message body text\n"
						"or meta-data will be saved (i.e. for purposes of duplicate message\n"
						"detection and rejection)."
					;
					uifc.input(WIN_MID|WIN_SAV,0,17,"Maximum Number of CRCs"
						,str,9,K_EDIT|K_NUMBER);
					cfg.sub[i]->maxcrcs=atol(str);
					cfg.sub[i]->misc|=SUB_HDRMOD;
					break;
				case 13:
					while(1) {
						n=0;
521
						sprintf(opt[n++],"%-30.30s%s","Allow Private Posts"
522 523
							,cfg.sub[i]->misc&SUB_PRIV ? cfg.sub[i]->misc&SUB_PONLY
							? "Only":"Yes":"No");
524
						sprintf(opt[n++],"%-30.30s%s","Allow Anonymous Posts"
525 526
							,cfg.sub[i]->misc&SUB_ANON ? cfg.sub[i]->misc&SUB_AONLY
							? "Only":"Yes":"No");
527
						sprintf(opt[n++],"%-30.30s%s","Post Using Real Names"
528
							,cfg.sub[i]->misc&SUB_NAME ? "Yes":"No");
529
						sprintf(opt[n++],"%-30.30s%s","Users Can Edit Posts"
530 531
							,cfg.sub[i]->misc&SUB_EDIT ? cfg.sub[i]->misc&SUB_EDITLAST 
							? "Last" : "Yes" : "No");
532
						sprintf(opt[n++],"%-30.30s%s","Users Can Delete Posts"
533 534
							,cfg.sub[i]->misc&SUB_DEL ? cfg.sub[i]->misc&SUB_DELLAST
							? "Last" : "Yes" : "No");
535
						sprintf(opt[n++],"%-30.30s%s","Default On for New Scan"
536
							,cfg.sub[i]->misc&SUB_NSDEF ? "Yes":"No");
537
						sprintf(opt[n++],"%-30.30s%s","Forced On for New Scan"
538
							,cfg.sub[i]->misc&SUB_FORCED ? "Yes":"No");
539
						sprintf(opt[n++],"%-30.30s%s","Default On for Your Scan"
540
							,cfg.sub[i]->misc&SUB_SSDEF ? "Yes":"No");
541
						sprintf(opt[n++],"%-30.30s%s","Public 'To' User"
542
							,cfg.sub[i]->misc&SUB_TOUSER ? "Yes":"No");
543
						sprintf(opt[n++],"%-30.30s%s","Allow Message Voting"
544
							,cfg.sub[i]->misc&SUB_NOVOTING ? "No":"Yes");
545
						sprintf(opt[n++],"%-30.30s%s","Allow Message Quoting"
546
							,cfg.sub[i]->misc&SUB_QUOTE ? "Yes":"No");
547
						sprintf(opt[n++],"%-30.30s%s","Allow Message Tagging"
548
							,cfg.sub[i]->misc&SUB_MSGTAGS ? "Yes":"No");
549
						sprintf(opt[n++],"%-30.30s%s","Suppress User Signatures"
550
							,cfg.sub[i]->misc&SUB_NOUSERSIG ? "Yes":"No");
551
						sprintf(opt[n++],"%-30.30s%s","Permanent Operator Msgs"
552 553
							,cfg.sub[i]->misc&SUB_SYSPERM ? "Yes":"No");
	#if 0 /* this is not actually implemented (yet?) */
554
						sprintf(opt[n++],"%-30.30s%s","Kill Read Messages"
555 556 557
							,cfg.sub[i]->misc&SUB_KILL ? "Yes"
							: (cfg.sub[i]->misc&SUB_KILLP ? "Pvt" : "No"));
	#endif
558
						sprintf(opt[n++],"%-30.30s%s","Compress Messages (LZH)"
559
							,cfg.sub[i]->misc&SUB_LZH ? "Yes" : "No");
560
						sprintf(opt[n++],"%-30.30s%s","Apply Markup Codes"
561
							,cfg.sub[i]->pmode&P_MARKUP ? ((cfg.sub[i]->pmode&P_HIDEMARKS)  ? "Hide" : "Yes") : "No");
562
						sprintf(opt[n++],"%-30.30s%s","Extra Attribute Codes"
563
							,cfg.sub[i]->pmode&P_NOXATTRS ? "No" : "Yes");
564
						sprintf(opt[n++],"%-30.30s%s","Word-wrap Messages"
565
							,cfg.sub[i]->n_pmode&P_WORDWRAP ? "No" : "Yes");
566
						sprintf(opt[n++],"%-30.30s%s","Auto-detect UTF-8 Msgs"
567
							,cfg.sub[i]->pmode&P_AUTO_UTF8 ? "Yes" : "No");
568 569 570
						sprintf(opt[n++],"%-30.30s%s","Expand @-codes in Sysop Msgs"
							,cfg.sub[i]->pmode&P_NOATCODES ? "No" : "Yes");
						sprintf(opt[n++],"%-30.30s%s","Template for New Subs"
571 572 573 574 575 576 577 578 579
							,cfg.sub[i]->misc&SUB_TEMPLATE ? "Yes" : "No");

						opt[n][0]=0;
						uifc.helpbuf=
							"`Sub-board Toggle Options:`\n"
							"\n"
							"This menu allows you to toggle certain options for the selected\n"
							"sub-board between two or more settings, such as `Yes` and `No`.\n"
						;
580
						n=uifc.list(WIN_ACT|WIN_SAV|WIN_RHT|WIN_BOT,3,1,0,&tog_dflt, &tog_bar
581 582
							,"Toggle Options",opt);
						if(n==-1)
rswindell's avatar
rswindell committed
583
							break;
584
						switch(n) {
585
							case __COUNTER__:
586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622
								if(cfg.sub[i]->misc&SUB_PONLY)
									n=2;
								else 
									n=(cfg.sub[i]->misc&SUB_PRIV) ? 0:1;
								strcpy(opt[0],"Yes");
								strcpy(opt[1],"No");
								strcpy(opt[2],"Only");
								opt[3][0]=0;
								uifc.helpbuf=
									"`Allow Private Posts on Sub-board:`\n"
									"\n"
									"If you want users to be able to post private messages to other users\n"
									"on this sub-board, set this value to `Yes`. Usually, E-mail is the\n"
									"preferred method of private communication. If you want users to be able\n"
									"to post private messages only on this sub-board, select `Only`.\n"
								;
								n=uifc.list(WIN_SAV|WIN_MID,0,0,0,&n,0
									,"Allow Private Posts",opt);
								if(n==-1)
									break;
								if(!n && (cfg.sub[i]->misc&(SUB_PRIV|SUB_PONLY))
									!=SUB_PRIV) {
									uifc.changes = TRUE;
									cfg.sub[i]->misc&=~SUB_PONLY;
									cfg.sub[i]->misc|=SUB_PRIV;
									break; 
								}
								if(n==1 && cfg.sub[i]->misc&SUB_PRIV) {
									uifc.changes = TRUE;
									cfg.sub[i]->misc&=~SUB_PRIV;
									break; 
								}
								if(n==2 && (cfg.sub[i]->misc&(SUB_PRIV|SUB_PONLY))
									!=(SUB_PRIV|SUB_PONLY)) {
									uifc.changes = TRUE;
									cfg.sub[i]->misc|=(SUB_PRIV|SUB_PONLY); 
								}
rswindell's avatar
rswindell committed
623
								break;
624
							case __COUNTER__:
625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662
								if(cfg.sub[i]->misc&SUB_AONLY)
									n=2;
								else 
									n=(cfg.sub[i]->misc&SUB_ANON) ? 0:1;
								strcpy(opt[0],"Yes");
								strcpy(opt[1],"No");
								strcpy(opt[2],"Only");
								opt[3][0]=0;
								uifc.helpbuf=
									"`Allow Anonymous Posts on Sub-board:`\n"
									"\n"
									"If you want users with the `A` exemption to be able to post anonymously on\n"
									"this sub-board, select `Yes`. If you want all posts on this sub-board to be\n"
									"forced anonymous, select `Only`. If you do not want anonymous posts allowed\n"
									"on this sub-board at all, select `No`.\n"
								;
								n=uifc.list(WIN_SAV|WIN_MID,0,0,0,&n,0
									,"Allow Anonymous Posts",opt);
								if(n==-1)
									break;
								if(!n && (cfg.sub[i]->misc&(SUB_ANON|SUB_AONLY))
									!=SUB_ANON) {
									uifc.changes = TRUE;
									cfg.sub[i]->misc&=~SUB_AONLY;
									cfg.sub[i]->misc|=SUB_ANON;
									break; 
								}
								if(n==1 && cfg.sub[i]->misc&(SUB_ANON|SUB_AONLY)) {
									uifc.changes = TRUE;
									cfg.sub[i]->misc&=~(SUB_ANON|SUB_AONLY);
									break; 
								}
								if(n==2 && (cfg.sub[i]->misc&(SUB_ANON|SUB_AONLY))
									!=(SUB_ANON|SUB_AONLY)) {
									uifc.changes = TRUE;
									cfg.sub[i]->misc|=(SUB_ANON|SUB_AONLY); 
								}
								break;
663
							case __COUNTER__:
664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685
								n=(cfg.sub[i]->misc&SUB_NAME) ? 0:1;
								uifc.helpbuf=
									"`User Real Names in Posts on Sub-board:`\n"
									"\n"
									"If you allow aliases on your system, you can have messages on this\n"
									"sub-board automatically use the real name of the posting user by setting\n"
									"this option to `Yes`.\n"
								;
								n=uifc.list(WIN_SAV|WIN_MID,0,0,0,&n,0
									,"Use Real Names in Posts",uifcYesNoOpts);
								if(n==-1)
									break;
								if(!n && !(cfg.sub[i]->misc&SUB_NAME)) {
									uifc.changes = TRUE;
									cfg.sub[i]->misc|=SUB_NAME;
									break; 
								}
								if(n==1 && cfg.sub[i]->misc&SUB_NAME) {
									uifc.changes = TRUE;
									cfg.sub[i]->misc&=~SUB_NAME; 
								}
								break;
686
							case __COUNTER__:
687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729
								if(cfg.sub[i]->misc&SUB_EDITLAST)
									n=2;
								else
									n=(cfg.sub[i]->misc&SUB_EDIT) ? 0:1;
								strcpy(opt[0],"Yes");
								strcpy(opt[1],"No");
								strcpy(opt[2],"Last Post Only");
								opt[3][0]=0;
								uifc.helpbuf=
									"`Users Can Edit Posts on Sub-board:`\n"
									"\n"
									"If you wish to allow users to edit their messages after they have been\n"
									"posted, this option to `Yes`. If you wish to allow users to edit only the\n"
									"last message on a message base, set this option to `Last Post Only`.\n"
								;
								n=uifc.list(WIN_SAV|WIN_MID,0,0,0,&n,0
									,"Users Can Edit Messages",opt);
								if(n==-1)
									break;
								if(n==0 /* yes */
									&& (cfg.sub[i]->misc&(SUB_EDIT|SUB_EDITLAST))
									!=SUB_EDIT
									) {
									uifc.changes = TRUE;
									cfg.sub[i]->misc|=SUB_EDIT;
									cfg.sub[i]->misc&=~SUB_EDITLAST;
									break; 
								}
								if(n==1 /* no */
									&& cfg.sub[i]->misc&(SUB_EDIT|SUB_EDITLAST)
									) {
									uifc.changes = TRUE;
									cfg.sub[i]->misc&=~(SUB_EDIT|SUB_EDITLAST);
									break;
								}
								if(n==2 /* last only */
									&& (cfg.sub[i]->misc&(SUB_EDIT|SUB_EDITLAST))
									!=(SUB_EDIT|SUB_EDITLAST)
									) {
									uifc.changes = TRUE;
									cfg.sub[i]->misc|=(SUB_EDIT|SUB_EDITLAST);
									break;
								}
rswindell's avatar
rswindell committed
730
								break;
731
							case __COUNTER__:
732 733 734 735 736
								if(cfg.sub[i]->misc&SUB_DELLAST)
									n=2;
								else 
									n=(cfg.sub[i]->misc&SUB_DEL) ? 0:1;

rswindell's avatar
rswindell committed
737
								strcpy(opt[0],"Yes");
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
								strcpy(opt[1],"No");
								strcpy(opt[2],"Last Post Only");
								opt[3][0]=0;
								uifc.helpbuf=
									"`Users Can Delete Posts on Sub-board:`\n"
									"\n"
									"If you want users to be able to delete any of their own posts on this\n"
									"sub-board, set this option to `Yes`. If you want to allow users the\n"
									"ability to delete their message only if it is the last message on the\n"
									"sub-board, select `Last Post Only`. If you want to disallow users from\n"
									"deleting any of their posts, set this option to `No`.\n"
								;
								n=uifc.list(WIN_SAV|WIN_MID,0,0,0,&n,0
									,"Users Can Delete Posts",opt);
								if(n==-1)
									break;
								if(!n && (cfg.sub[i]->misc&(SUB_DEL|SUB_DELLAST))
									!=SUB_DEL) {
									uifc.changes = TRUE;
									cfg.sub[i]->misc&=~SUB_DELLAST;
									cfg.sub[i]->misc|=SUB_DEL;
									break; 
								}
								if(n==1 && cfg.sub[i]->misc&SUB_DEL) {
									uifc.changes = TRUE;
									cfg.sub[i]->misc&=~SUB_DEL;
									break; 
								}
								if(n==2 && (cfg.sub[i]->misc&(SUB_DEL|SUB_DELLAST))
									!=(SUB_DEL|SUB_DELLAST)) {
									uifc.changes = TRUE;
									cfg.sub[i]->misc|=(SUB_DEL|SUB_DELLAST); 
								}
								break;
772
							case __COUNTER__:
773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793
								n=(cfg.sub[i]->misc&SUB_NSDEF) ? 0:1;
								uifc.helpbuf=
									"`Default On for New Scan:`\n"
									"\n"
									"If you want this sub-board to be included in all user new message scans\n"
									"by default, set this option to `Yes`.\n"
								;
								n=uifc.list(WIN_SAV|WIN_MID,0,0,0,&n,0
									,"Default On for New Scan",uifcYesNoOpts);
								if(n==-1)
									break;
								if(!n && !(cfg.sub[i]->misc&SUB_NSDEF)) {
									uifc.changes = TRUE;
									cfg.sub[i]->misc|=SUB_NSDEF;
									break; 
								}
								if(n==1 && cfg.sub[i]->misc&SUB_NSDEF) {
									uifc.changes = TRUE;
									cfg.sub[i]->misc&=~SUB_NSDEF; 
								}
								break;
794
							case __COUNTER__:
795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816
								n=(cfg.sub[i]->misc&SUB_FORCED) ? 0:1;
								uifc.helpbuf=
									"`Forced On for New Scan:`\n"
									"\n"
									"If you want this sub-board to be included in all user new message scans\n"
									"even if the user has removed it from their new scan configuration, set\n"
									"this option to `Yes`.\n"
								;
								n=uifc.list(WIN_SAV|WIN_MID,0,0,0,&n,0
									,"Forced New Scan",uifcYesNoOpts);
								if(n==-1)
									break;
								if(!n && !(cfg.sub[i]->misc&SUB_FORCED)) {
									uifc.changes = TRUE;
									cfg.sub[i]->misc|=SUB_FORCED;
									break; 
								}
								if(n==1 && cfg.sub[i]->misc&SUB_FORCED) {
									uifc.changes = TRUE;
									cfg.sub[i]->misc&=~SUB_FORCED; 
								}
								break;
817
							case __COUNTER__:
818 819 820 821 822 823 824 825 826 827
								n=(cfg.sub[i]->misc&SUB_SSDEF) ? 0:1;
								uifc.helpbuf=
									"`Default On for Your Scan:`\n"
									"\n"
									"If you want this sub-board to be included in all user personal message\n"
									"scans by default, set this option to `Yes`.\n"
								;
								n=uifc.list(WIN_SAV|WIN_MID,0,0,0,&n,0
									,"Default On for Your Scan",uifcYesNoOpts);
								if(n==-1)
rswindell's avatar
rswindell committed
828
									break;
829 830 831 832 833 834 835 836 837 838
								if(!n && !(cfg.sub[i]->misc&SUB_SSDEF)) {
									uifc.changes = TRUE;
									cfg.sub[i]->misc|=SUB_SSDEF;
									break; 
								}
								if(n==1 && cfg.sub[i]->misc&SUB_SSDEF) {
									uifc.changes = TRUE;
									cfg.sub[i]->misc&=~SUB_SSDEF; 
								}
								break;
839
							case __COUNTER__:
840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861
								n=(cfg.sub[i]->misc&SUB_TOUSER) ? 0:1;
								uifc.helpbuf=
									"`Prompt for 'To' User on Public Posts:`\n"
									"\n"
									"If you want all posts on this sub-board to be prompted for a 'To' user,\n"
									"set this option to `Yes`. This is a useful option for sub-boards that\n"
									"are on a network that does not allow private posts.\n"
								;
								n=uifc.list(WIN_SAV|WIN_MID,0,0,0,&n,0
									,"Prompt for 'To' User on Public Posts",uifcYesNoOpts);
								if(n==-1)
									break;
								if(!n && !(cfg.sub[i]->misc&SUB_TOUSER)) {
									uifc.changes = TRUE;
									cfg.sub[i]->misc|=SUB_TOUSER;
									break; 
								}
								if(n==1 && cfg.sub[i]->misc&SUB_TOUSER) {
									uifc.changes = TRUE;
									cfg.sub[i]->misc&=~SUB_TOUSER; 
								}
								break;
862
							case __COUNTER__:
863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883
								n=(cfg.sub[i]->misc&SUB_NOVOTING) ? 1:0;
								uifc.helpbuf=
									"`Allow Message Voting:`\n"
									"\n"
									"If you want users to be allowed to Up-Vote or Down-Vote messages on this\n"
									"sub-board, set this option to `Yes`.\n"
								;
								n=uifc.list(WIN_SAV|WIN_MID,0,0,0,&n,0
									,"Allow Message Voting",uifcYesNoOpts);
								if(n==-1)
									break;
								if(!n && (cfg.sub[i]->misc&SUB_NOVOTING)) {
									uifc.changes = TRUE;
									cfg.sub[i]->misc ^= SUB_NOVOTING;
									break; 
								}
								if(n==1 && !(cfg.sub[i]->misc&SUB_NOVOTING)) {
									uifc.changes = TRUE;
									cfg.sub[i]->misc ^= SUB_NOVOTING; 
								}
								break;
884
							case __COUNTER__:
885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905
								n=(cfg.sub[i]->misc&SUB_QUOTE) ? 0:1;
								uifc.helpbuf=
									"`Allow Message Quoting:`\n"
									"\n"
									"If you want users to be allowed to quote messages on this sub-board, set\n"
									"this option to `Yes`.\n"
								;
								n=uifc.list(WIN_SAV|WIN_MID,0,0,0,&n,0
									,"Allow Message Quoting",uifcYesNoOpts);
								if(n==-1)
									break;
								if(!n && !(cfg.sub[i]->misc&SUB_QUOTE)) {
									uifc.changes = TRUE;
									cfg.sub[i]->misc|=SUB_QUOTE;
									break; 
								}
								if(n==1 && cfg.sub[i]->misc&SUB_QUOTE) {
									uifc.changes = TRUE;
									cfg.sub[i]->misc&=~SUB_QUOTE; 
								}
								break;
906
							case __COUNTER__:
907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927
								n=(cfg.sub[i]->misc&SUB_MSGTAGS) ? 0:1;
								uifc.helpbuf=
									"`Allow Message Tagging:`\n"
									"\n"
									"If you want users to be allowed to add tags to messages on this sub-board, \n"
									"set this option to `Yes` (not to be confused with 'tag-lines').\n"
								;
								n=uifc.list(WIN_SAV|WIN_MID,0,0,0,&n,0
									,"Allow Message Tagging",uifcYesNoOpts);
								if(n==-1)
									break;
								if(!n && !(cfg.sub[i]->misc&SUB_MSGTAGS)) {
									uifc.changes = TRUE;
									cfg.sub[i]->misc|=SUB_MSGTAGS;
									break; 
								}
								if(n==1 && cfg.sub[i]->misc&SUB_MSGTAGS) {
									uifc.changes = TRUE;
									cfg.sub[i]->misc&=~SUB_MSGTAGS; 
								}
								break;
928
							case __COUNTER__:
929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949
								n=(cfg.sub[i]->misc&SUB_NOUSERSIG) ? 0:1;
								uifc.helpbuf=
									"Suppress User Signatures:\n"
									"\n"
									"If you do not wish to have user signatures automatically appended to\n"
									"messages posted in this sub-board, set this option to Yes.\n"
								;
								n=uifc.list(WIN_SAV|WIN_MID,0,0,0,&n,0
									,"Suppress User Signatures",uifcYesNoOpts);
								if(n==-1)
									break;
								if(!n && !(cfg.sub[i]->misc&SUB_NOUSERSIG)) {
									uifc.changes = TRUE;
									cfg.sub[i]->misc|=SUB_NOUSERSIG;
									break; 
								}
								if(n==1 && cfg.sub[i]->misc&SUB_NOUSERSIG) {
									uifc.changes = TRUE;
									cfg.sub[i]->misc&=~SUB_NOUSERSIG; 
								}
								break;
950
							case __COUNTER__:
951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011
								n=(cfg.sub[i]->misc&SUB_SYSPERM) ? 0:1;
								uifc.helpbuf=
									"`Operator Messages Automatically Permanent:`\n"
									"\n"
									"If you want messages posted by `System` and `Sub-board Operators` to be\n"
									"automatically permanent (non-purgeable) for this sub-board, set this\n"
									"option to `Yes`.\n"
								;
								n=uifc.list(WIN_SAV|WIN_MID,0,0,0,&n,0
									,"Permanent Operator Messages",uifcYesNoOpts);
								if(n==-1)
									break;
								if(!n && !(cfg.sub[i]->misc&SUB_SYSPERM)) {
									uifc.changes = TRUE;
									cfg.sub[i]->misc|=SUB_SYSPERM;
									break; 
								}
								if(n==1 && cfg.sub[i]->misc&SUB_SYSPERM) {
									uifc.changes = TRUE;
									cfg.sub[i]->misc&=~SUB_SYSPERM; 
								}
								break;
	#if 0 /* This is not actually implemented (yet?) */
							case 12:
								if(cfg.sub[i]->misc&SUB_KILLP)
									n=2;
								else
									n=(cfg.sub[i]->misc&SUB_KILL) ? 0:1;
								strcpy(opt[0],"Yes");
								strcpy(opt[1],"No");
								strcpy(opt[2],"Private");
								opt[3][0]=0;
								uifc.helpbuf=
									"`Kill Read Messages Automatically:`\n"
									"\n"
									"If you want messages that have been read by the intended recipient to\n"
									"be automatically deleted by `SMBUTIL`, set this option to `Yes` or\n"
									"`Private` if you want only private messages to be automatically deleted.\n"
								;
								n=uifc.list(WIN_SAV|WIN_MID,0,0,0,&n,0
									,"Kill Read Messages",opt);
								if(n==-1)
									break;
								if(!n && !(cfg.sub[i]->misc&SUB_KILL)) {
									uifc.changes = TRUE;
									cfg.sub[i]->misc|=SUB_KILL;
									cfg.sub[i]->misc&=~SUB_KILLP;
									break; 
								}
								if(n==1 && cfg.sub[i]->misc&(SUB_KILL|SUB_KILLP)) {
									uifc.changes = TRUE;
									cfg.sub[i]->misc&=~(SUB_KILL|SUB_KILLP); 
								}
								if(n==2 && !(cfg.sub[i]->misc&SUB_KILLP)) {
									uifc.changes = TRUE;
									cfg.sub[i]->misc|=SUB_KILLP;
									cfg.sub[i]->misc&=~SUB_KILL;
									break; 
								}
								break;
	#endif
1012
							case __COUNTER__:
1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040
								n=(cfg.sub[i]->misc&SUB_LZH) ? 0:1;
								uifc.helpbuf=
									"`Compress Messages with LZH Encoding:`\n"
									"\n"
									"If you want all messages in this sub-board to be automatically\n"
									"compressed via `LZH` (Lempel/Ziv/Huffman algorithm used in LHarc, LHA,\n"
									"and other popular compression and archive programs), this option to `Yes`.\n"
									"\n"
									"Compression will slow down the reading and writing of messages slightly,\n"
									"but the storage space saved can be as much as `50 percent`.\n"
									"\n"
									"Before setting this option to `Yes`, make sure that all of the SMB\n"
									"compatible mail programs you use support the `LZH` translation.\n"
								;
								n=uifc.list(WIN_SAV|WIN_MID,0,0,0,&n,0
									,"Compress Messages (LZH)",uifcYesNoOpts);
								if(n==-1)
									break;
								if(!n && !(cfg.sub[i]->misc&SUB_LZH)) {
									uifc.changes = TRUE;
									cfg.sub[i]->misc|=SUB_LZH;
									break; 
								}
								if(n==1 && cfg.sub[i]->misc&SUB_LZH) {
									uifc.changes = TRUE;
									cfg.sub[i]->misc&=~SUB_LZH; 
								}
								break;
1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078
							case __COUNTER__:
								n = (cfg.sub[i]->pmode&P_MARKUP) ? (cfg.sub[i]->pmode&P_HIDEMARKS ? 1 : 0) : 2;
								uifc.helpbuf=
									"`Interpret/Display Markup Codes in Messages:`\n"
									"\n"
									"Markup codes are called 'StyleCodes' in GoldEd, 'Rich Text' in SemPoint,\n"
									"and 'Structured Text' in Mozilla/Thunderbird.\n"
									"\n"
									"`*Bold Text*`\n"
									"/Italic Text/\n"
									"~#Inverse Text#~\n"
									"_Underlined Text_\n"
									"\n"
									"Markup character cannot be combined.\n"
								;
								strcpy(opt[0],"Yes");
								strcpy(opt[1],"Yes and Hide the Markup Characters");
								strcpy(opt[2],"No");
								opt[3][0]=0;
								n=uifc.list(WIN_SAV|WIN_MID,0,0,0,&n,0
									,"Interpret/Display Markup Codes in Messages", opt);
								if(n==-1)
									break;
								if(n == 0 && (cfg.sub[i]->pmode&(P_MARKUP|P_HIDEMARKS)) != P_MARKUP) {
									uifc.changes = TRUE;
									cfg.sub[i]->pmode |= P_MARKUP;
									cfg.sub[i]->pmode &= ~P_HIDEMARKS;
								}
								else if(n == 1 && (cfg.sub[i]->pmode&(P_MARKUP|P_HIDEMARKS)) != (P_MARKUP|P_HIDEMARKS)) {
									uifc.changes = TRUE;
									cfg.sub[i]->pmode |= (P_MARKUP|P_HIDEMARKS);
								}
								else if(n == 2 && (cfg.sub[i]->pmode&(P_MARKUP|P_HIDEMARKS)) != 0) {
									uifc.changes = TRUE;
									cfg.sub[i]->pmode &= ~(P_MARKUP|P_HIDEMARKS);
								}
								break;
							case __COUNTER__:
1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099
								n=(cfg.sub[i]->pmode&P_NOXATTRS) ? 1:0;
								uifc.helpbuf=
									"`Extra Attribute Codes:`\n"
									"\n"
									"Set this option to `No` to disable the interpretation of so-called\n"
									"Extra Attribute Codes (printable color codes for other BBS software\n"
									"e.g. pipe codes).\n"
								;
								n=uifc.list(WIN_SAV|WIN_MID,0,0,0,&n,0
									,"Interpret/Display Extra Attribute Codes in Messages",uifcYesNoOpts);
								if(n==-1)
									break;
								if(n == 0 && (cfg.sub[i]->pmode&P_NOXATTRS)) {
									uifc.changes = TRUE;
									cfg.sub[i]->pmode ^= P_NOXATTRS;
								}
								else if(n == 1 && !(cfg.sub[i]->pmode&P_NOXATTRS)) {
									uifc.changes = TRUE;
									cfg.sub[i]->pmode ^= P_NOXATTRS;
								}
								break;
1100
							case __COUNTER__:
1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121
								n=(cfg.sub[i]->n_pmode&P_WORDWRAP) ? 1:0;
								uifc.helpbuf=
									"`Word-wrap Message Text:`\n"
									"\n"
									"Set this option to `No` to disable the automatic reflowing (word-wrapping)\n"
									"of the lines of text of messages in this sub-board when viewed from the\n"
									"Terminal Server."
								;
								n=uifc.list(WIN_SAV|WIN_MID,0,0,0,&n,0
									,"Word-wrap Message Text",uifcYesNoOpts);
								if(n==-1)
									break;
								if(n == 0 && (cfg.sub[i]->n_pmode&P_WORDWRAP)) {
									uifc.changes = TRUE;
									cfg.sub[i]->n_pmode ^= P_WORDWRAP;
								}
								else if(n == 1 && !(cfg.sub[i]->n_pmode&P_WORDWRAP)) {
									uifc.changes = TRUE;
									cfg.sub[i]->n_pmode ^= P_WORDWRAP;
								}
								break;
1122
							case __COUNTER__:
1123 1124 1125 1126 1127
								n=(cfg.sub[i]->pmode&P_AUTO_UTF8) ? 0:1;
								uifc.helpbuf=
									"`Automatically Detect UTF-8 Message Text:`\n"
									"\n"
									"Set this option to `Yes` to enable automatic detection of UTF-8 message\n"
1128
									"text during display; no \"`charset=utf-8`\" need be specified by the sender.\n"
1129
									"\n"
1130 1131
									"Note: Setting this option to `Yes` does *not* enable automatic detection\n"
									"of UTF-8 header field values (e.g. To, From, Subject)."
1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145
								;
								n=uifc.list(WIN_SAV|WIN_MID,0,0,0,&n,0
									,"Automatically Detect UTF-8 Message Text",uifcYesNoOpts);
								if(n==-1)
									break;
								if(n == 0 && !(cfg.sub[i]->pmode&P_AUTO_UTF8)) {
									uifc.changes = TRUE;
									cfg.sub[i]->pmode ^= P_AUTO_UTF8;
								}
								else if(n == 1 && (cfg.sub[i]->pmode&P_AUTO_UTF8)) {
									uifc.changes = TRUE;
									cfg.sub[i]->pmode ^= P_AUTO_UTF8;
								}
								break;
1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167
							case __COUNTER__:
								n=(cfg.sub[i]->pmode&P_NOATCODES) ? 1:0;
								uifc.helpbuf=
									"`Expand @-codes in Sysop-Posted Messages:`\n"
									"\n"
									"Set this option to `Yes` to enable the interpretation and expansion of\n"
									"message variables (@-codes) in messages posted by the local sysop\n"
									"(user #1).\n"
								;
								n=uifc.list(WIN_SAV|WIN_MID,0,0,0,&n,0
									,"Expand @-codes in Sysop-Posted Messages",uifcYesNoOpts);
								if(n==-1)
									break;
								if(n == 0 && (cfg.sub[i]->pmode & P_NOATCODES)) {
									uifc.changes = TRUE;
									cfg.sub[i]->pmode ^= P_NOATCODES;
								}
								else if(n == 1 && !(cfg.sub[i]->pmode & P_NOATCODES)) {
									uifc.changes = TRUE;
									cfg.sub[i]->pmode ^= P_NOATCODES;
								}
								break;
1168
							case __COUNTER__:
1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338
								n=(cfg.sub[i]->misc&SUB_TEMPLATE) ? 0:1;
								uifc.helpbuf=
									"`Use this Sub-board as a Template for New Subs:`\n"
									"\n"
									"If you want this sub-board's options / settings to be used as the\n"
									"template for newly-created or cloned sub-boards in this message group,\n"
									"set this option to `Yes`.\n"
									"\n"
									"If multiple sub-boards have this option enabled, only the first will be\n"
									"used as the template."
								;
								n=uifc.list(WIN_SAV|WIN_MID,0,0,0,&n,0
									,"Use this Sub-board as a Template for New Subs",uifcYesNoOpts);
								if(n==-1)
									break;
								if(!n && !(cfg.sub[i]->misc&SUB_TEMPLATE)) {
									uifc.changes = TRUE;
									cfg.sub[i]->misc|=SUB_TEMPLATE;
									break; 
								}
								if(n==1 && cfg.sub[i]->misc&SUB_TEMPLATE) {
									uifc.changes = TRUE;
									cfg.sub[i]->misc&=~SUB_TEMPLATE; 
								}
								break;
							} 
						}
					break;
				case 14:
					while(1) {
						n=0;
						sprintf(opt[n++],"%-27.27s%s","Append Tag/Origin Line"
							,cfg.sub[i]->misc&SUB_NOTAG ? "No":"Yes");
						sprintf(opt[n++],"%-27.27s%s","Export ASCII Only"
							,cfg.sub[i]->misc&SUB_ASCII ? "Yes":"No");