sbbsdefs.h 50.2 KB
Newer Older
1
2
3
4
5
6
/* Synchronet constants, macros, and structure definitions */

/****************************************************************************
 * @format.tab-size 4		(Plain Text/Source Code File Header)			*
 * @format.use-tabs true	(see http://www.synchro.net/ptsc_hdr.html)		*
 *																			*
rswindell's avatar
rswindell committed
7
 * Copyright Rob Swindell - http://www.synchro.net/copyright.html			*
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
 *																			*
 * 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.	*
 ****************************************************************************/

#ifndef _SBBSDEFS_H
#define _SBBSDEFS_H

#include <time.h>

27
28
29
#include "gen_defs.h"	/* uchar, ushort, uint, ulong, etc. */
#include "nodedefs.h"	/* node_t */
#include "fidodefs.h"	/* fmsghdr_t, fpkthdr_t, FIDO_*, etc. */
deuce's avatar
deuce committed
30
#include "xpbeep.h"		/* BEEP() */
rswindell's avatar
rswindell committed
31
#include "str_list.h"	/* str_list_t */
32

33
34
35
36
/*************/
/* Constants */
/*************/

rswindell's avatar
rswindell committed
37
#define VERSION 	"3.18"  /* Version: Major.minor  */
38
#define REVISION	'c'     /* Revision: lowercase letter */
rswindell's avatar
rswindell committed
39
40
#define VERSION_NUM	(31800	 + (tolower(REVISION)-'a'))
#define VERSION_HEX	(0x31800 + (tolower(REVISION)-'a'))
41

42
#define VERSION_NOTICE		"Synchronet BBS for " PLATFORM_DESC\
43
								"  Version " VERSION
rswindell's avatar
rswindell committed
44
#define SYNCHRONET_CRC		0x9BCDD162
rswindell's avatar
rswindell committed
45
46
#define COPYRIGHT_NOTICE	"Copyright 2020 Rob Swindell"
#define COPYRIGHT_CRC		0xB12E96E6
47

48
49
#define SBBSCTRL_DEFAULT	"/sbbs/ctrl"

50
51
52
53
#define Y2K_2DIGIT_WINDOW	70

#define FNOPEN_BUF_SIZE		(2*1024)

54
#define ILLEGAL_FILENAME_CHARS	"\\/|<>:\";,%"
55

56
#define BIND_FAILURE_HELP	"!Another application or service may be using this port"
57
#define UNKNOWN_LOAD_ERROR	"Unknown load error - Library mismatch?"
58

59
#define STR_UNKNOWN_USER	"<unknown user>"
60
#define STR_NO_HOSTNAME		"<no name>"
61

62
63
#define	JAVASCRIPT_MAX_BYTES		(16*1024*1024)
#define JAVASCRIPT_CONTEXT_STACK	(8*1024)
64
#define JAVASCRIPT_TIME_LIMIT		(24*60*600)			/* in 100ms ticks */
65
#define JAVASCRIPT_YIELD_INTERVAL	10000
66
#define JAVASCRIPT_GC_INTERVAL		100
67
68
#define JAVASCRIPT_LOAD_PATH		"load"
#define JAVASCRIPT_LOAD_PATH_LIST	"load_path_list"
69
#define JAVASCRIPT_OPTIONS			0x810	// JSOPTION_JIT | JSOPTION_COMPILE_N_GO
70

71
#define JSVAL_NULL_OR_VOID(val)		(JSVAL_IS_NULL(val) || JSVAL_IS_VOID(val))
72

73
74
75
76
77
78
79
#ifndef MAX
#define MAX(a,b) ((a) > (b) ? (a) : (b))
#endif
#ifndef MIN
#define MIN(a,b) ((a) < (b) ? (a) : (b))
#endif

80
81
82
83
84
/************/
/* Maximums */
/************/

#define MAX_NODES		250
85
86
87
#define MAX_SUBS		65534
#define MAX_DIRS		65534
#define MAX_XTRNS		65534
88
89
90
91

#define MAX_FILES	  10000 /* Maximum number of files per dir			*/
#define MAX_USERXFER	500 /* Maximum number of dest. users of usrxfer */

92
93
#define MAX_TEXTDAT_ITEM_LEN	2000

94

95
96
97
98
99
100
101
102
#define LEN_DIR		63		/* Maximum length of directory paths		*/
#define LEN_CMD		63		/* Maximum length of command lines			*/

							/* MS-DOS limited values					*/
#define LEN_CODE	8		/* Maximum length of internal codes			*/
#define LEN_QWKID	8		/* Maximum length of QWK-ID					*/
#define LEN_MODNAME 8		/* Maximum length of loadable module name	*/
#define LEN_SIFNAME 8		/* Maximum length of SIF filename			*/
103
#define LEN_EXTCODE (LEN_CODE*2)	/* Code prefix + suffix */
104
105
106
107
108
109

							/* Lengths of various strings				*/
#define LEN_GSNAME	15		/* Group/Lib short name						*/
#define LEN_GLNAME	40		/* Group/Lib long name						*/
#define LEN_SSNAME	25		/* Sub/Dir short name						*/
#define LEN_SLNAME	40		/* Sub/Dir long name						*/
110

111
									/* User Questions (e.g. for new users)	*/
112
113
114
115
#define UQ_ALIASES		(1L<<0) 	/* Ask for alias						*/
#define UQ_LOCATION		(1L<<1) 	/* Ask for location 					*/
#define UQ_ADDRESS		(1L<<2) 	/* Ask for address						*/
#define UQ_PHONE		(1L<<3) 	/* Ask for phone number 				*/
116
#define UQ_HANDLE		(1L<<4) 	/* Ask for chat handle / HAM callsign	*/
117
118
119
#define UQ_DUPHAND		(1L<<5) 	/* Search for duplicate handles 		*/
#define UQ_SEX			(1L<<6) 	/* Ask for sex :)						*/
#define UQ_BIRTH		(1L<<7) 	/* Ask for birth date					*/
120
121
#define UQ_UNUSED1 		(1L<<8) 	/* was UQ_COMP							*/
#define UQ_UNUSED2		(1L<<9) 	/* was UQ_MC_COMP						*/
122
123
124
125
126
127
128
129
#define UQ_REALNAME		(1L<<10)	/* Ask for real name					*/
#define UQ_DUPREAL		(1L<<11)	/* Search for duplicate real names		*/
#define UQ_COMPANY		(1L<<12)	/* Ask for company name 				*/
#define UQ_NOEXASC		(1L<<13)	/* Don't allow ex-ASCII in user text    */
#define UQ_CMDSHELL		(1L<<14)	/* Ask for command shell				*/
#define UQ_XEDIT		(1L<<15)	/* Ask for external editor				*/
#define UQ_NODEF		(1L<<16)	/* Don't ask for default settings       */
#define UQ_NOCOMMAS		(1L<<17)	/* Do not require commas in location	*/
130
#define UQ_NONETMAIL	(1L<<18)	/* Don't ask for e-mail/netmail address	*/
131
#define UQ_NOUPRLWR		(1L<<19)	/* Don't force upper/lower case strings */
132
#define UQ_COLORTERM	(1L<<20)	/* Ask if new user has color terminal	*/
133
134


135
136
137
									/* Different bits in sys_misc				*/
#define SM_CLOSED		(1L<<0) 	/* System is clsoed to New Users			*/
#define SM_SYSSTAT		(1L<<1) 	/* Sysops activity included in statistics	*/
138
#define SM_NOSYSINFO	(1L<<2) 	/* Suppress system info display at logon	*/
139
140
141
142
143
144
145
146
147
148
#define SM_PWEDIT		(1L<<3) 	/* Allow users to change their passwords	*/
#define SM_RA_EMU		(1L<<4) 	/* Reverse R/A commands at msg read prompt	*/
#define SM_ANON_EM		(1L<<5) 	/* Allow anonymous e-mail					*/
#define SM_LISTLOC		(1L<<6) 	/* Use location of caller in user lists 	*/
#define SM_WILDCAT		(1L<<7) 	/* Expand Wildcat color codes in messages	*/
#define SM_PCBOARD		(1L<<8) 	/* Expand PCBoard color codes in messages	*/
#define SM_WWIV 		(1L<<9) 	/* Expand WWIV color codes in messages		*/
#define SM_CELERITY		(1L<<10)	/* Expand Celerity color codes in messages	*/
#define SM_RENEGADE		(1L<<11)	/* Expand Renegade color codes in messages	*/
#define SM_ECHO_PW		(1L<<12)	/* Echo passwords locally					*/
149
#define SM_SYSPASSLOGIN	(1L<<13)	/* Require system password for sysop login	*/
150
#define SM_AUTO_DST		(1L<<14)	/* Automatic Daylight Savings Toggle (US)   */
151
152
153
154
155
156
157
158
159
#define SM_R_SYSOP		(1L<<15)	/* Allow remote sysop logon/commands		*/
#define SM_QUOTE_EM		(1L<<16)	/* Allow quoting of e-mail					*/
#define SM_EURODATE		(1L<<17)	/* Europian date format (DD/MM/YY)			*/
#define SM_MILITARY		(1L<<18)	/* Military time format 					*/
#define SM_TIMEBANK		(1L<<19)	/* Allow time bank functions				*/
#define SM_FILE_EM		(1L<<20)	/* Allow file attachments in E-mail 		*/
#define SM_SHRTPAGE		(1L<<21)	/* Short sysop page 						*/
#define SM_TIME_EXP		(1L<<22)	/* Set to expired values if out-of-time 	*/
#define SM_FASTMAIL		(1L<<23)	/* Fast e-mail storage mode 				*/
160
#define SM_NONODELIST	(1L<<24)	/* Suppress active node list during logon	*/
161
#define SM_UNUSED2		(1L<<25)	/*											*/
162
163
164
165
166
167
#define SM_FWDTONET		(1L<<26)	/* Allow forwarding of e-mail to netmail	*/
#define SM_DELREADM		(1L<<27)	/* Delete read mail automatically			*/
#define SM_NOCDTCVT		(1L<<28)	/* No credit to minute conversions allowed	*/
#define SM_DELEMAIL		(1L<<29)	/* Physically remove deleted e-mail immed.	*/
#define SM_USRVDELM		(1L<<30)	/* Users can see deleted msgs				*/
#define SM_SYSVDELM		(1L<<31)	/* Sysops can see deleted msgs				*/
168

169
170
171
172
173
174
175
									/* Different bits in node_misc				*/
#define NM_NO_NUM		(1<<8)		/* Don't allow logons by user number        */
#define NM_LOGON_R		(1<<9)		/* Allow logons by user real name			*/
#define NM_LOGON_P		(1<<10)		/* Secure logons (always ask for password)	*/
#define NM_LOWPRIO		(1<<15)		/* Always use low priority input			*/
#define NM_7BITONLY		(1L<<16)	/* Except 7-bit input only (E71 terminals)	*/
#define NM_NOPAUSESPIN	(1L<<18)	/* No spinning cursor at pause prompt		*/
rswindell's avatar
rswindell committed
176
#define NM_CLOSENODEDAB	(1L<<19)	/* Keep node.dab file closed (for Samba)	*/
177

178
									/* Bit values for level_misc[x] 	*/
179
180
#define LEVEL_EXPTOLVL	(1<<0)		/* Expire to level_expireto[x]		*/
#define LEVEL_EXPTOVAL	(1<<1)		/* Expire to val[level_expireto[x]] */
181
182

									/* Bit values for prot[x].misc */
183
#define PROT_DSZLOG		(1<<0)      /* Supports DSZ Log */
184
#define PROT_NATIVE		(1<<1)		/* Native (not MS-DOS) executable */
185
#define PROT_SOCKET		(1<<2)		/* Use socket I/O, not stdio on *nix */
186
187
188
189
190
191
192
193
194
195

									/* Bit values in netmail_misc */

#define NMAIL_ALLOW 	(1<<0)		/* Allow NetMail */
#define NMAIL_CRASH 	(1<<1)		/* Default netmail to crash */
#define NMAIL_HOLD		(1<<2)		/* Default netmail to hold */
#define NMAIL_KILL		(1<<3)		/* Default netmail to kill after sent */
#define NMAIL_ALIAS 	(1<<4)		/* Use Aliases in NetMail */
#define NMAIL_FILE		(1<<5)		/* Allow file attachments */
#define NMAIL_DIRECT	(1<<6)		/* Default netmail to direct */
196
#define NMAIL_CHSRCADDR	(1<<7)		/* Allow sender to choose source address */
197

rswindell's avatar
rswindell committed
198
199
200
201
202
									/* Bit values for subscan_t.cfg and sav_cfg	*/
#define SUB_CFG_NSCAN	0x0005		/* Auto-scan for new messages				*/
#define SUB_CFG_SSCAN	0x0002		/* Auto-scan for unread messages to you		*/
#define SUB_CFG_YSCAN	0x0100		/* Auto-scan for new messages to you only	*/
									/* (bits 8-15 default to off)				*/
203
204

									/* Bit values for sub[x].misc */
205
#define SUB_NOVOTING	(1L<<0)		/* No voting allowed in this sub-board */
206
#define SUB_TEMPLATE	(1L<<1)		/* Use this sub as template for new subs (in this group) */
207
#define SUB_MSGTAGS		(1L<<2)		/* Allow messages to be tagged (ala hashtags) */
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
#define SUB_QNET		(1L<<3) 	/* Sub-board is netted via QWK network */
#define SUB_PNET		(1L<<4) 	/* Sub-board is netted via PostLink */
#define SUB_FIDO		(1L<<5) 	/* Sub-board is netted via FidoNet */
#define SUB_PRIV		(1L<<6) 	/* Allow private posts on sub */
#define SUB_PONLY		(1L<<7) 	/* Private posts only */
#define SUB_ANON		(1L<<8) 	/* Allow anonymous posts on sub */
#define SUB_AONLY		(1L<<9) 	/* Anonymous only */
#define SUB_NAME		(1L<<10)	/* Must use real names */
#define SUB_DEL 		(1L<<11)	/* Allow users to delete messages */
#define SUB_DELLAST		(1L<<12)	/* Allow users to delete last msg only */
#define SUB_FORCED		(1L<<13)	/* Sub-board is forced scanning */
#define SUB_NOTAG		(1L<<14)	/* Don't add tag or origin lines */
#define SUB_TOUSER		(1L<<15)	/* Prompt for to user on posts */
#define SUB_ASCII		(1L<<16)	/* ASCII characters only */
#define SUB_QUOTE		(1L<<17)	/* Allow online quoting */
#define SUB_NSDEF		(1L<<18)	/* New-Scan on by default */
#define SUB_INET		(1L<<19)	/* Sub-board is netted via Internet */
#define SUB_FAST		(1L<<20)	/* Fast storage mode */
226
227
228
#define SUB_KILL		(1L<<21)	/* Kill read messages automatically (NOT IMPLEMENTED) */
#define SUB_KILLP		(1L<<22)	/* Kill read pvt messages automatically (NOT IMPLEMENTED) */
#define SUB_SYSPERM		(1L<<23)	/* Sysop messages are permanent */
229
230
231
232
233
234
#define SUB_GATE		(1L<<24)	/* Gateway between Network types */
#define SUB_LZH 		(1L<<25)	/* Use LZH compression for msgs */
#define SUB_SSDEF		(1L<<26)	/* Default ON for Scan for Your msgs */
#define SUB_HYPER		(1L<<27)	/* Hyper allocation */
#define SUB_EDIT		(1L<<28)	/* Users can edit message text after posting */
#define SUB_EDITLAST	(1L<<29)	/* Users can edit last message only */
235
#define SUB_NOUSERSIG	(1L<<30)	/* Suppress user signatures */
236
#define SUB_HDRMOD		(1L<<31)	/* Modified sub-board header info (SCFG) */
237

238
239
240
                                    /* Bit values for lib[x].misc */
#define LIB_DIRS	(1<<0) 			/* Local directory (sub-directory of lib parent) access */

241
                                    /* Bit values for dir[x].misc */
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
#define DIR_FCHK		(1<<0) 		/* Check for file existence */
#define DIR_RATE		(1<<1) 		/* Force uploads to be rated G,R, or X */
#define DIR_MULT		(1<<2) 		/* Ask for multi-disk numbering */
#define DIR_DUPES		(1<<3) 		/* Search this dir for upload dupes */
#define DIR_FREE		(1<<4) 		/* Free downloads */
#define DIR_TFREE		(1<<5) 		/* Time to download is free */
#define DIR_CDTUL		(1<<6) 		/* Credit Uploads */
#define DIR_CDTDL		(1<<7) 		/* Credit Downloads */
#define DIR_ANON		(1<<8) 		/* Anonymous uploads */
#define DIR_AONLY		(1<<9) 		/* Anonymous only */
#define DIR_ULDATE		(1<<10)		/* Include upload date in listing */
#define DIR_DIZ 		(1<<11)		/* FILE_ID.DIZ and DESC.SDI support */
#define DIR_NOSCAN		(1<<12)		/* Don't new-scan this directory */
#define DIR_NOAUTO		(1<<13)		/* Don't auto-add this directory */
#define DIR_ULTIME		(1<<14)		/* Deduct time during uploads */
#define DIR_CDTMIN		(1<<15)		/* Give uploader minutes instead of cdt */
#define DIR_SINCEDL		(1<<16)		/* Purge based on days since last dl */
#define DIR_MOVENEW		(1<<17)		/* Files marked as new when moved */
#define DIR_QUIET		(1<<18)		/* Do not notify uploader of downloads */
#define DIR_NOSTAT		(1<<19)		/* Do not include transfers in system stats */
#define DIR_FILES		(1<<20)		/* List/access files not in database */
#define DIR_TEMPLATE	(1<<21)		/* Use this dir as template for new dirs (in this lib) */
264
265
266
267
268

                                    /* Bit values for file_t.misc */
#define FM_EXTDESC  (1<<0)          /* Extended description exists */
#define FM_ANON 	(1<<1)			/* Anonymous upload */

269
270
271
									/* Bit values for cfg.file_misc				*/
#define FM_NO_LFN	(1<<0)			/* No long filenames in listings			*/

272
									/* Bit values for cfg.msg_misc (upper 16-bits default to on) */
273
#define MM_REALNAME	(1<<16)			/* Allow receipt of e-mail using real names	*/
274
#define MM_EMAILSIG	(1<<17)			/* Include user signatures in e-mail msgs */
275

276
277
278
279
280
281
282
283
284
285
286
									/* errormsg() codes */
#define ERR_OPEN	"opening"		/* opening a file */
#define ERR_CLOSE	"closing"		/* close a file */
#define ERR_FDOPEN	"fdopen"		/* associating a stream with fd */
#define ERR_READ	"reading"		/* reading from file */
#define ERR_WRITE	"writing"		/* writing to file */
#define ERR_REMOVE 	"removing"		/* removing a file */
#define ERR_ALLOC	"allocating"	/* allocating memory */
#define ERR_CHK		"checking"		/* checking */
#define ERR_LEN		"checking length"
#define ERR_EXEC	"executing"		/* executing */
287
#define ERR_MKDIR	"making directory"
rswindell's avatar
rswindell committed
288
#define ERR_CHDIR	"changing directory"
289
290
291
#define ERR_CREATE	"creating" 		/* creating */
#define ERR_LOCK	"locking"		/* locking */
#define ERR_UNLOCK 	"unlocking"		/* unlocking */
292
#define ERR_TIMEOUT	"timeout"		/* timeout waiting for resource */
293
294
#define ERR_IOCTL	"sending IOCTL"	/* IOCTL error */
#define ERR_SEEK	"seeking"		/* SEEKing error */
295
296
297
298
299
300
301
302

enum {                              /* Values for dir[x].sort */
     SORT_NAME_A                    /* Sort by filename, ascending */
    ,SORT_NAME_D                    /* Sort by filename, descending */
    ,SORT_DATE_A                    /* Sort by upload date, ascending */
    ,SORT_DATE_D                    /* Sort by upload date, descending */
    };

303
304
305
306
307
308
/* Values for grp[x].sort */
enum area_sort {
	AREA_SORT_NONE,
	AREA_SORT_LNAME,
	AREA_SORT_SNAME,
	AREA_SORT_CODE,
309
	AREA_SORT_TYPES,
310
311
};

312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
enum {
	 clr_mnehigh
	,clr_mnelow
	,clr_mnecmd
	,clr_inputline
	,clr_err
	,clr_nodenum
	,clr_nodeuser
	,clr_nodestatus
	,clr_filename
	,clr_filecdt
	,clr_filedesc
	,clr_filelsthdrbox
	,clr_filelstline
	,clr_chatlocal
	,clr_chatremote
	,clr_multichat
	,clr_external
330
331
332
333
	,clr_votes_full
	,clr_votes_empty
	,clr_progress_full
	,clr_progress_empty
334
	,MIN_COLORS
335
};
336

337
338
339
340
341
342
343
344
345
346
347
348
349
350
enum {								/* Values for xtrn_t.type				*/
	 XTRN_NONE						/* No data file needed					*/
	,XTRN_SBBS						/* Synchronet external					*/
	,XTRN_WWIV						/* WWIV external						*/
	,XTRN_GAP						/* Gap door 							*/
	,XTRN_RBBS						/* RBBS, QBBS, or Remote Access 		*/
	,XTRN_WILDCAT					/* Wildcat								*/
	,XTRN_PCBOARD					/* PCBoard								*/
	,XTRN_SPITFIRE					/* SpitFire 							*/
	,XTRN_UTI						/* UTI Doors - MegaMail 				*/
	,XTRN_SR						/* Solar Realms 						*/
	,XTRN_RBBS1 					/* DORINFO1.DEF always					*/
	,XTRN_TRIBBS					/* TRIBBS.SYS							*/
	,XTRN_DOOR32					/* DOOR32.SYS							*/
351
352
	};

353
354
355
356
357
358
typedef enum {						/* Values for xtrn_t.event				*/
	 EVENT_NONE 					/* Only accessible by menu				*/
	,EVENT_LOGON					/* Execute during logon sequence		*/
	,EVENT_LOGOFF					/* Execute during logoff sequence		*/
	,EVENT_NEWUSER					/* Execute during newuser app.			*/
	,EVENT_BIRTHDAY 				/* Execute on birthday					*/
359
360
361
	,EVENT_POST						/* Execute after posting a message		*/
	,EVENT_UPLOAD					/* Execute after uploading a file		*/
	,EVENT_DOWNLOAD					/* Execute after downloading a file		*/
362
	,EVENT_LOCAL_CHAT				/* Execute upon local/sysop chat		*/
363
364
} user_event_t;

365
									/* Misc bits for event_t.misc			*/
366
367
368
369
#define EVENT_EXCL		(1<<0) 		/* Exclusive							*/
#define EVENT_FORCE		(1<<1) 		/* Force users off-line for event		*/
#define EVENT_INIT		(1<<2)		/* Always run event after init			*/
#define EVENT_DISABLED	(1<<3)		/* Disabled								*/
370

371
372
#define NODE_ANY		0			/* special qhub/event_t.node value		*/

373
									/* Bits in xtrn_t.misc					*/
374
#define MULTIUSER		(1<<0) 		/* allow multi simultaneous users		*/
375
376
#define XTRN_ANSI		(1<<1)		/* LEGACY (not used)                    */
#define XTRN_STDIO 		(1<<2) 		/* Intercept Standard I/O (aka IO_INTS)	*/
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
#define MODUSERDAT		(1<<3) 		/* Program can modify user data 		*/
#define WWIVCOLOR		(1<<4) 		/* Program uses WWIV color codes		*/
#define EVENTONLY		(1<<5) 		/* Program executes as event only		*/
#define STARTUPDIR		(1<<6) 		/* Create drop file in start-up dir		*/
#define REALNAME		(1<<7) 		/* Use real name in drop file			*/
#define SWAP			(1<<8) 		/* Swap for this door					*/
#define FREETIME		(1<<9) 		/* Free time while in this door 		*/
#define QUICKBBS		(1<<10)		/* QuickBBS style editor				*/
#define EXPANDLF		(1<<11)		/* Expand LF to CRLF editor 			*/
#define QUOTEALL		(1<<12)		/* Automatically quote all of msg		*/
#define QUOTENONE		(1<<13)		/* Automatically quote none of msg		*/
#define XTRN_NATIVE		(1<<14)		/* Native application (EX_NATIVE)		*/
#define STRIPKLUDGE		(1<<15)		/* Strip FTN Kludge lines from msg		*/
#define XTRN_CHKTIME	(1<<16)		/* Check time online (EX_CHKTIME)		*/
#define XTRN_LWRCASE	(1<<17)		/* Use lowercase drop-file names		*/
#define XTRN_SH			(1<<18)		/* Use command shell to execute			*/
393
#define XTRN_PAUSE		(1<<19)		/* Force a screen pause on exit			*/
394
#define XTRN_NOECHO		(1<<20)		/* Don't echo stdin to stdout			*/
395
#define QUOTEWRAP		(1<<21)		/* Word-wrap quoted message text		*/
396
#define SAVECOLUMNS		(1<<22)		/* Save/share current terminal width	*/
rswindell's avatar
rswindell committed
397
#define XTRN_UTF8		(1<<23)		/* External program supports UTF-8		*/
398
#define XTRN_TEMP_DIR	(1<<24)		/* Place drop files in temp dir			*/
399
#define XTRN_CONIO		(1<<31)		/* Intercept Windows Console I/O (Drwy)	*/
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418

									/* Bits in cfg.xtrn_misc				*/
#define XTRN_NO_MUTEX	(1<<0)		/* Do not use exec_mutex for FOSSIL VXD	*/

									/* Bits in user.qwk 					*/
#define QWK_FILES	(1L<<0) 		/* Include new files list				*/
#define QWK_EMAIL	(1L<<1) 		/* Include unread e-mail				*/
#define QWK_ALLMAIL (1L<<2) 		/* Include ALL e-mail					*/
#define QWK_DELMAIL (1L<<3) 		/* Delete e-mail after download 		*/
#define QWK_BYSELF	(1L<<4) 		/* Include messages from self			*/
#define QWK_UNUSED	(1L<<5) 		/* Currently unused 					*/
#define QWK_EXPCTLA (1L<<6) 		/* Expand ctrl-a codes to ascii 		*/
#define QWK_RETCTLA (1L<<7) 		/* Retain ctrl-a codes					*/
#define QWK_ATTACH	(1L<<8) 		/* Include file attachments 			*/
#define QWK_NOINDEX (1L<<9) 		/* Do not create index files in QWK		*/
#define QWK_TZ		(1L<<10)		/* Include "@TZ" time zone in msgs		*/
#define QWK_VIA 	(1L<<11)		/* Include "@VIA" seen-bys in msgs		*/
#define QWK_NOCTRL	(1L<<12)		/* No extraneous control files			*/
#define QWK_EXT		(1L<<13)		/* QWK Extended (QWKE) format			*/
419
#define QWK_MSGID	(1L<<14)		/* Include "@MSGID" in msgs				*/
420
#define QWK_HEADERS	(1L<<16)		/* Include HEADERS.DAT file				*/
rswindell's avatar
rswindell committed
421
#define QWK_VOTING	(1L<<17)		/* Include VOTING.DAT					*/
422
#define QWK_UTF8	(1L<<18)		/* Include UTF-8 characters				*/
423
424

#define QWK_DEFAULT	(QWK_FILES|QWK_ATTACH|QWK_EMAIL|QWK_DELMAIL)
425
426
427
428
429
430
431
432
433

#define QHUB_EXPCTLA	(1<<0)		/* Same as QM_EXPCTLA */
#define QHUB_RETCTLA	(1<<1)		/* Same as QM_RETCTLA */
#define QHUB_CTRL_A		(QHUB_EXPCTLA|QHUB_RETCTLA)
#define QHUB_STRIP		0
#define QHUB_EXT		(1<<13)		/* Use QWKE format */
#define QHUB_NOKLUDGES	(1<<14)		/* Don't include @-kludges */
#define QHUB_NOHEADERS	(1<<16)		/* Don't include HEADERS.DAT */
#define QHUB_NOVOTING	(1<<17)		/* Don't include VOTING.DAT */
434
#define QHUB_UTF8		(1<<18)		/* Include UTF-8 characters */
435

436
437
438
439
440
441
							/* Bits in user.chat							*/
#define CHAT_ECHO	(1<<0)	/* Multinode chat echo							*/
#define CHAT_ACTION (1<<1)	/* Chat actions 								*/
#define CHAT_NOPAGE (1<<2)	/* Can't be paged								*/
#define CHAT_NOACT	(1<<3)	/* No activity alerts							*/
#define CHAT_SPLITP (1<<4)	/* Split screen private chat					*/
442
443


444
445
#define INVALID_DIR ((uint)-1)	/* Invalid directory value					*/
#define INVALID_SUB ((uint)-1)	/* Invalid sub-board value					*/
446

447
448
#define KEY_BUFSIZE 1024	/* Size of keyboard input buffer				*/
#define LINE_BUFSIZE 512	/* Size of line output buffer					*/
449
450


451
#define EDIT_TABSIZE 4		/* Tab size for internal message/line editor	*/
452

453
#define DSTSDABLEN	50		/* Length of dsts.dab file						*/
454

455
456
457
								/* Console I/O Bits	(console)				*/
#define CON_R_ECHO		(1<<0)	/* Echo remotely							*/
#define CON_R_ECHOX		(1<<1)	/* Echo X's to remote user					*/
458
#define CON_L_ECHOX		0		// Unused
459
460
#define CON_R_INPUT		(1<<2)	/* Accept input remotely					*/
#define CON_L_ECHO		(1<<3)	/* Echo locally              				*/
461
#define CON_PAUSEOFF	(1<<4)	// Temporary pause over-ride (same as UPAUSE)
462
463
464
465
466
467
468
469
#define CON_L_INPUT		(1<<5)	/* Accept input locally						*/
#define CON_RAW_IN		(1<<8)	/* Raw input mode - no editing capabilities	*/
#define CON_ECHO_OFF	(1<<10)	/* Remote & Local echo disabled for ML/MF	*/
#define CON_UPARROW		(1<<11)	/* Up arrow hit - move up one line			*/
#define CON_DOWNARROW	(1<<12)	/* Down arrow hit, exiting from getstr()	*/
#define CON_NO_INACT	(1<<13)	/* Console inactivity detection disabled	*/
#define CON_BACKSPACE	(1<<14)	/* Backspace hit, exiting from getstr()		*/
#define CON_LEFTARROW	(1<<15)	/* Left arrow hit, exiting from getstr()	*/
470
#define CON_INSERT		(1<<16)	/* Insert mode, for getstr()				*/
471
#define CON_DELETELINE	(1<<17)	/* Deleted line, exiting from getstr()		*/
472
473
474
475
#define CON_NORM_FONT	(1<<18)	/* Alt normal font set activated			*/
#define CON_HIGH_FONT	(1<<19)	/* Alt high-intensity font activated		*/
#define CON_BLINK_FONT	(1<<20)	/* Alt blink attribute font activated		*/
#define CON_HBLINK_FONT	(1<<21)	/* Alt high-blink attribute font activated	*/
476
477
478
479
#define CON_MOUSE_CLK_PASSTHRU	(1<<24)	// Pass-through unhandled mouse button-click reports
#define CON_MOUSE_REL_PASSTHRU	(1<<25)	// Pass-through unhandled mouse button-release reports
#define CON_MOUSE_SCROLL		(1<<26)	// Mouse-reports enabled for non-hotspots (e.g. scroll-wheel)
#define CON_CR_CLREOL			(1<<31)	// outchar('\r') clears to end-of-line first
480

481
482
							/* Number of milliseconds						*/
#define DELAY_AUTOHG 1500	/* Delay for auto-hangup (xfer) 				*/
483

484
485
486
487
488
489
490
#define SEC_LOGON	1800	/* 30 minutes allowed to logon					*/
#define SEC_BILLING   90	/* under 2 minutes per billing call 			*/
#define SEC_OK		   5	/* Attempt to get an OK response from modem		*/
#define SEC_ANSI	   5	/* Attempt to get a valid ANSI response 		*/
#define SEC_ANSWER	  30	/* Retries to get an answer code from modem		*/
#define SEC_CID 	  10	/* Ten second pause for caller ID				*/
#define SEC_RING	   6	/* Maximum seconds between rings				*/
491

492
493
#define LOOP_NOPEN	  50	/* Retries before file access denied			*/
#define LOOP_NODEDAB  50	/* Retries on node.dab locking/unlocking		*/
494

495
496
497
498
499
500
501
502
							/* String lengths								*/
#define LEN_ALIAS		25	/* User alias									*/
#define LEN_NAME		25	/* User name									*/
#define LEN_HANDLE		8	/* User chat handle 							*/
#define LEN_NOTE		30	/* User note									*/
#define LEN_COMP		30	/* User computer description					*/
#define LEN_COMMENT 	60	/* User comment 								*/
#define LEN_NETMAIL 	60	/* NetMail forwarding address					*/
503
#define LEN_OLDPASS		 8	/* User password (old)							*/
504
505
506
507
508
509
510
511
512
#define LEN_PHONE		12	/* User phone number							*/
#define LEN_BIRTH		 8	/* Birthday in MM/DD/YY format					*/
#define LEN_ADDRESS 	30	/* User address 								*/
#define LEN_LOCATION	30	/* Location (City, State)						*/
#define LEN_ZIPCODE 	10	/* Zip/Postal code								*/
#define LEN_MODEM		 8	/* User modem type description					*/
#define LEN_FDESC		58	/* File description 							*/
#define LEN_FCDT		 9	/* 9 digits for file credit values				*/
#define LEN_TITLE		70	/* Message title								*/
513
514
515
#define LEN_MAIN_CMD	28	/* Unused Storage in user.dat					*/
#define LEN_COLS		3
#define LEN_ROWS		3
516
517
#define LEN_PASS		40
#define MIN_PASS_LEN	 4
518
#define RAND_PASS_LEN	 8
519
#define LEN_SCAN_CMD	35
520
#define LEN_IPADDR		45
deuce's avatar
deuce committed
521
#define LEN_CID 		45	/* Caller ID (phone number) 					*/
522
523
524
#define LEN_ARSTR		40	/* Max length of Access Requirement string		*/
#define LEN_CHATACTCMD	 9	/* Chat action command							*/
#define LEN_CHATACTOUT	65	/* Chat action output string					*/
525
526
527
528
529
530
531

/****************************************************************************/
/* This is a list of offsets into the USER.DAT file for different variables */
/* that are stored (for each user)											*/
/****************************************************************************/
#define U_ALIAS 	0					/* Offset to alias */
#define U_NAME		U_ALIAS+LEN_ALIAS  /* Offset to name */
532
533
534
535
#define U_HANDLE	U_NAME+LEN_NAME
#define U_NOTE		U_HANDLE+LEN_HANDLE+2
#define U_COMP		U_NOTE+LEN_NOTE
#define U_COMMENT	U_COMP+LEN_COMP+2
536

537
#define U_NETMAIL	U_COMMENT+LEN_COMMENT+2
538

539
540
541
#define U_ADDRESS	U_NETMAIL+LEN_NETMAIL+2
#define U_LOCATION	U_ADDRESS+LEN_ADDRESS
#define U_ZIPCODE	U_LOCATION+LEN_LOCATION
542

543
544
#define U_OLDPASS	U_ZIPCODE+LEN_ZIPCODE+2
#define U_PHONE  	U_OLDPASS+LEN_OLDPASS  	/* Offset to phone-number */
545
#define U_BIRTH  	U_PHONE+12 		/* Offset to users birthday	*/
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
#define U_MODEM     U_BIRTH+8
#define U_LASTON	U_MODEM+8
#define U_FIRSTON	U_LASTON+8
#define U_EXPIRE    U_FIRSTON+8
#define U_PWMOD     U_EXPIRE+8

#define U_LOGONS    U_PWMOD+8+2
#define U_LTODAY    U_LOGONS+5
#define U_TIMEON    U_LTODAY+5
#define U_TEXTRA  	U_TIMEON+5
#define U_TTODAY    U_TEXTRA+5
#define U_TLAST     U_TTODAY+5
#define U_POSTS     U_TLAST+5
#define U_EMAILS    U_POSTS+5
#define U_FBACKS    U_EMAILS+5
#define U_ETODAY	U_FBACKS+5
#define U_PTODAY	U_ETODAY+5

#define U_ULB       U_PTODAY+5+2
#define U_ULS       U_ULB+10
#define U_DLB       U_ULS+5
#define U_DLS       U_DLB+10
#define U_CDT		U_DLS+5
#define U_MIN		U_CDT+10
570
571
572
573

#define U_LEVEL 	U_MIN+10+2 	/* Offset to Security Level    */
#define U_FLAGS1	U_LEVEL+2  	/* Offset to Flags */
#define U_TL		U_FLAGS1+8 	/* Offset to unused field */
574
575
576
#define U_FLAGS2	U_TL+2
#define U_EXEMPT	U_FLAGS2+8
#define U_REST		U_EXEMPT+8
577
578
#define U_OLDROWS	U_REST+8+2 	/* Number of Rows on user's monitor */
#define U_SEX		U_OLDROWS+2 	/* Sex, Del, ANSI, color etc.		*/
579
580
581
#define U_MISC		U_SEX+1 		/* Miscellaneous flags in 8byte hex */
#define U_OLDXEDIT	U_MISC+8 		/* External editor (Version 1 method  */
#define U_LEECH 	U_OLDXEDIT+2 	/* two hex digits - leech attempt count */
582
583
#define U_CURSUB	U_LEECH+2  	/* Current sub (internal code)  */
#define U_CURXTRN	U_CURSUB+16 /* Current xtrn (internal code) */
584
585
586
#define U_ROWS		U_CURXTRN+8+2
#define U_COLS		U_ROWS+LEN_ROWS
#define U_MAIN_CMD	U_COLS+LEN_COLS	/* unused */
587
588
#define U_PASS		U_MAIN_CMD+LEN_MAIN_CMD
#define U_SCAN_CMD	U_PASS+LEN_PASS+2  				/* unused */
deuce's avatar
deuce committed
589
#define U_IPADDR	U_SCAN_CMD+LEN_SCAN_CMD 		/* unused */
590
#define U_FREECDT	U_IPADDR+LEN_IPADDR+2
591
592
593
594
595
596
597
598
599
#define U_FLAGS3	U_FREECDT+10 	/* Flag set #3 */
#define U_FLAGS4	U_FLAGS3+8 	/* Flag set #4 */
#define U_XEDIT 	U_FLAGS4+8 	/* External editor (code  */
#define U_SHELL 	U_XEDIT+8  	/* Command shell (code  */
#define U_QWK		U_SHELL+8  	/* QWK settings */
#define U_TMPEXT	U_QWK+8 		/* QWK extension */
#define U_CHAT		U_TMPEXT+3 	/* Chat settings */
#define U_NS_TIME	U_CHAT+8 		/* New-file scan date/time */
#define U_PROT		U_NS_TIME+8 	/* Default transfer protocol */
600
#define U_LOGONTIME	U_PROT+1
601
602
603
#define U_CURDIR	U_LOGONTIME+8	/* Current dir (internal code  */
#define U_UNUSED	U_CURDIR+16
#define U_LEN		(U_UNUSED+4+2)
604
605
606
607

/****************************************************************************/
/* Offsets into DIR .DAT file for different fields for each file 			*/
/****************************************************************************/
608
609
610
611
#define F_CDT		0				/* Offset in DIR#.DAT file for cdts		*/
#define F_DESC		(F_CDT+LEN_FCDT)/* Description							*/
#define F_ULER		(F_DESC+LEN_FDESC+2)   /* Uploader						*/
#define F_TIMESDLED (F_ULER+30+2) 	/* Number of times downloaded 			*/
612
613
614
#define F_OPENCOUNT	(F_TIMESDLED+5+2)
#define F_MISC		(F_OPENCOUNT+3+2)
#define F_ALTPATH	(F_MISC+1)		/* Two hex digit alternate path */
615
#define F_LEN		(F_ALTPATH+2+2) /* Total length of all fdat in file		*/
616

617
#define F_IXBSIZE	22				/* Length of each index entry			*/
618

619
#define F_EXBSIZE	512				/* Length of each ext-desc entry		*/
620
621


622
#define SIF_MAXBUF  0x7000			/* Maximum buffer size of SIF data		*/
623

624
/* NOTE: Do not change the values of the following block of defines!		*/
625

626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
#define DELETED 	(1L<<0) 		/* Bit values for user.misc 			*/
#define ANSI		(1L<<1) 		/* Supports ANSI terminal emulation		*/
#define COLOR		(1L<<2) 		/* Send color codes 					*/
#define RIP 		(1L<<3) 		/* Supports RIP terminal emulation		*/
#define UPAUSE		(1L<<4) 		/* Pause on every screen full			*/
#define SPIN		(1L<<5) 		/* Spinning cursor - Same as K_SPIN		*/
#define INACTIVE	(1L<<6) 		/* Inactive user slot					*/
#define EXPERT		(1L<<7) 		/* Expert menu mode 					*/
#define ANFSCAN 	(1L<<8) 		/* Auto New file scan					*/
#define CLRSCRN 	(1L<<9) 		/* Clear screen before each message		*/
#define QUIET		(1L<<10)		/* Quiet mode upon logon				*/
#define BATCHFLAG	(1L<<11)		/* File list allow batch dl flags		*/
#define NETMAIL 	(1L<<12)		/* Forward e-mail to fidonet addr		*/
#define CURSUB		(1L<<13)		/* Remember current sub-board/dir		*/
#define ASK_NSCAN	(1L<<14)		/* Ask for newscanning upon logon		*/
#define NO_EXASCII	(1L<<15)		/* Don't send extended ASCII			*/
#define ASK_SSCAN	(1L<<16)		/* Ask for messages to you at logon		*/
#define AUTOTERM	(1L<<17)		/* Autodetect terminal type 			*/
#define COLDKEYS	(1L<<18)		/* No hot-keys							*/
#define EXTDESC 	(1L<<19)		/* Extended file descriptions			*/
#define AUTOHANG	(1L<<20)		/* Auto-hang-up after transfer			*/
#define WIP 		(1L<<21)		/* Supports WIP terminal emulation		*/
#define AUTOLOGON	(1L<<22)		/* AutoLogon via IP						*/
649
#define HTML		(1L<<23)		/* Using Zuul/HTML terminal				*/
650
#define NOPAUSESPIN	(1L<<24)		/* No spinning cursor at pause prompt	*/
rswindell's avatar
rswindell committed
651
#define PETSCII		(1L<<26)		/* Commodore PET/CBM terminal			*/
652
#define SWAP_DELETE	(1L<<27)		/* Swap Delete and Backspace keys		*/
rswindell's avatar
rswindell committed
653
#define ICE_COLOR	(1L<<28)		/* Bright background color support		*/
654
#define UTF8		(1L<<29)		/* UTF-8 terminal						*/
655
#define MOUSE		(1L<<31)		/* Mouse supported terminal				*/
656

657
#define TERM_FLAGS		(ANSI|COLOR|RIP|WIP|HTML|SWAP_DELETE|ICE_COLOR|MOUSE|CHARSET_FLAGS)
658
659
660
661
662
#define CHARSET_FLAGS	(NO_EXASCII|PETSCII|UTF8)
#define CHARSET_ASCII	NO_EXASCII	// US-ASCII
#define CHARSET_PETSCII	PETSCII		// CBM-ASCII
#define CHARSET_UTF8	UTF8
#define CHARSET_CP437	0
663
664
665
666
667
668
669
670
671
672
673

									/* Special terminal key mappings */
#define TERM_KEY_HOME	CTRL_B
#define TERM_KEY_END	CTRL_E
#define TERM_KEY_UP		CTRL_CARET
#define TERM_KEY_DOWN	CTRL_J
#define TERM_KEY_LEFT	CTRL_CLOSE_BRACKET
#define TERM_KEY_RIGHT	CTRL_F
#define TERM_KEY_INSERT	CTRL_V
#define TERM_KEY_DELETE	DEL
#define TERM_KEY_ABORT	CTRL_C
674
675
#define TERM_KEY_PAGEUP	CTRL_P
#define TERM_KEY_PAGEDN	CTRL_N
676

677
#define TERM_COLS_AUTO		0
rswindell's avatar
rswindell committed
678
#define TERM_COLS_MIN		40
679
#define TERM_COLS_MAX		999
rswindell's avatar
rswindell committed
680
#define TERM_COLS_DEFAULT	80
681
#define TERM_ROWS_AUTO		0
682
#define TERM_ROWS_MIN		8	// Amstrad NC100 has an 8-line display
683
#define TERM_ROWS_MAX		999
rswindell's avatar
rswindell committed
684
685
#define TERM_ROWS_DEFAULT	24

686
687
688
							/* Online status (online)						*/
#define ON_LOCAL	1	 	/* Online locally								*/
#define ON_REMOTE   2  		/* Online remotely								*/
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
							/* Various SYSTEM parameters for sys_status		*/
#define SS_UNUSED	(1L<<0)	/* Unused          								*/
#define SS_INITIAL  (1L<<1)	/* The bbs data has been initialized.			*/
#define SS_TMPSYSOP (1L<<2)	/* Temporary Sysop Status						*/
#define SS_USERON   (1L<<3)	/* A User is logged on to the BBS				*/
#define SS_LCHAT    (1L<<4) /* Local chat in progress						*/
#define SS_CAP		(1L<<5)	/* Capture is on								*/
#define SS_ANSCAP	(1L<<6) /* Capture ANSI codes too						*/
#define SS_FINPUT	(1L<<7) /* Using file for input 						*/
#define SS_COMISR	(1L<<8) /* Com port ISR is installed					*/
#define SS_DAILY	(1L<<9) /* Execute System Daily Event on logoff 		*/
#define SS_INUEDIT	(1L<<10) /* Inside Alt-Useredit section 				*/
#define SS_ABORT	(1L<<11) /* Global abort input or output flag			*/
#define SS_SYSPAGE	(1L<<12) /* Paging sysop								*/
#define SS_SYSALERT (1L<<13) /* Notify sysop when users hangs up			*/
#define SS_GURUCHAT (1L<<14) /* Guru chat in progress						*/
#define SS_UNUSED2	(1L<<15) /* not used in v3 (used to be SS_NODEDAB)		*/
#define SS_EVENT	(1L<<16) /* Time shortened due to upcoming event		*/
#define SS_PAUSEON	(1L<<17) /* Pause on, overriding user default			*/
#define SS_PAUSEOFF (1L<<18) /* Pause off, overriding user default			*/
#define SS_IN_CTRLP (1L<<19) /* Inside ctrl-p send node message func		*/
#define SS_NEWUSER	(1L<<20) /* New User online 							*/
#define SS_MDMDEBUG (1L<<21) /* Modem debug output							*/
#define SS_NEST_PF	(1L<<22) /* Nested in printfile function				*/
#define SS_DCDHIGH	(1L<<23) /* Assume DCD is high always					*/
#define SS_SPLITP	(1L<<24) /* Split-screen private chat					*/
#define SS_NEWDAY	(1L<<25) /* Date changed while online					*/
#define SS_RLOGIN	(1L<<26) /* Current login via BSD RLogin				*/
#define SS_FILEXFER	(1L<<27) /* File transfer in progress, halt spy			*/
deuce's avatar
deuce committed
719
#define SS_SSH		(1L<<28) /* Current login via SSH						*/
720
#define SS_MOFF		(1L<<29) /* Disable automatic messages					*/
721
722
#define SS_QWKLOGON	(1L<<30) /* QWK logon									*/
#define SS_FASTLOGON (1<<31) /* Fast logon									*/
723
724

								/* Bits in 'mode' for getkey and getstr     */
725
#define K_NONE		0			/* Use as a place holder for no mode flags	*/
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
#define K_UPPER 	(1L<<0) 	/* Converts all letters to upper case		*/
#define K_UPRLWR	(1L<<1) 	/* Upper/Lower case automatically			*/
#define K_NUMBER	(1L<<2) 	/* Allow numbers only						*/
#define K_WRAP		(1L<<3) 	/* Allows word wrap 						*/
#define K_MSG		(1L<<4) 	/* Allows ANSI, ^N ^A ^G					*/
#define K_SPIN		(1L<<5) 	/* Spinning cursor (same as SPIN)			*/
#define K_LINE		(1L<<6) 	/* Input line (inverse color)				*/
#define K_EDIT		(1L<<7) 	/* Edit string passed						*/
#define K_CHAT		(1L<<8) 	/* In chat multi-chat						*/
#define K_NOCRLF	(1L<<9) 	/* Don't print CRLF after string input      */
#define K_ALPHA 	(1L<<10)	/* Only allow alphabetic characters 		*/
#define K_GETSTR	(1L<<11)	/* getkey called from getstr()				*/
#define K_LOWPRIO	(1L<<12)	/* low priority input						*/
#define K_NOEXASC	(1L<<13)	/* No extended ASCII allowed				*/
#define K_E71DETECT (1L<<14)	/* Detect E-7-1 terminal type				*/
#define K_AUTODEL	(1L<<15)	/* Auto-delete text (used with K_EDIT)		*/
#define K_COLD		(1L<<16)	/* Possible cold key mode					*/
#define K_NOECHO	(1L<<17)	/* Don't echo input                         */
#define K_TAB		(1L<<18)	/* Treat TAB key as CR						*/
745
746
#define K_LEFTEXIT	(1L<<19)	/* Allow exit by backspacing/arrowing left	*/
#define K_USEOFFSET	(1L<<20)	/* Use getstr_offset for cursor	position	*/
747
#define K_NOSPIN	(1L<<21)	/* Do not honor the user's spinning cursor	*/
748
#define K_ANSI_CPR	(1L<<22)	/* Expect ANSI Cursor Position Report		*/
749
#define K_TRIM		(1L<<23)	/* Trimmed white-space						*/
750
#define K_CTRLKEYS	(1L<<24)	/* No control-key handling/eating in inkey()*/
751
#define K_NUL		(1L<<25)	/* Return NOINP on timeout instead of '\0'	*/
752

753
								/* Bits in 'mode' for putmsg and printfile  */
rswindell's avatar
rswindell committed
754
#define P_NONE		0			/* No mode flags							*/
755
#define P_NOABORT  	(1<<0)		/* Disallows abortion of a message          */
rswindell's avatar
rswindell committed
756
#define P_SAVEATR   (1<<1)		/* Save the new current attributes after	*/
757
758
759
								/* msg has printed. */
#define P_NOATCODES (1<<2)		/* Don't allow @ codes                      */
#define P_OPENCLOSE (1<<3)		/* Open and close the file					*/
760
761
#define P_NOPAUSE	(1<<4)		/* Disable screen pause						*/
#define P_HTML		(1<<5)		/* Message is HTML							*/
762
#define P_NOCRLF	(1<<6)		/* Don't prepend a CRLF	in printfile()		*/
763
#define P_WORDWRAP	(1<<7)		/* Word-wrap long lines for user's terminal	*/
764
#define P_CPM_EOF	(1<<8)		/* Ignore Ctrl-Z chars (CPM End-of-File)	*/
rswindell's avatar
rswindell committed
765
#define	P_TRUNCATE	(1<<9)		/* Truncate (don't display) long lines		*/
766
#define P_NOERROR	(1<<10)		/* Don't report error if file doesn't exist	*/
767
#define P_PETSCII	(1<<11)		/* Message is native PETSCII				*/
rswindell's avatar
rswindell committed
768
#define P_WRAP		(1<<12)		/* Wrap/split long-lines, ungracefully		*/
769
#define P_UTF8		(1<<13)		/* Message is UTF-8							*/
rswindell's avatar
rswindell committed
770
#define P_AUTO_UTF8	(1<<14)		/* Message may be UTF-8, auto-detect		*/
771
#define P_NOXATTRS	(1<<15)		/* No "Extra Attribute Codes" supported		*/
772
773
#define P_MARKUP	(1<<16)		/* Support StyleCodes/Rich/StructuredText	*/
#define P_HIDEMARKS	(1<<17)		/* Hide the mark-up characters				*/
774

775
776
777
778
779
780
781
								/* Bits in 'mode' for listfiles             */
#define FL_ULTIME   (1<<0)		/* List files by upload time                */
#define FL_DLTIME   (1<<1)		/* List files by download time              */
#define FL_NO_HDR   (1<<2)		/* Don't list directory header              */
#define FL_FINDDESC (1<<3)		/* Find text in description                 */
#define FL_EXFIND   (1<<4)		/* Find text in description - extended info */
#define FL_VIEW     (1<<5)		/* View ZIP/ARC/GIF etc. info               */
782

783
								/* Bits in the mode of writemsg and email() */
784
#define WM_NONE		0			/* No bit flags set							*/
785
786
787
788
789
790
791
792
793
#define WM_EXTDESC	(1<<0)		/* Writing extended file description		*/
#define WM_EMAIL	(1<<1)		/* Writing e-mail							*/
#define WM_NETMAIL	(1<<2)		/* Writing NetMail							*/
#define WM_ANON 	(1<<3)		/* Writing anonymous message				*/
#define WM_FILE 	(1<<4)		/* Attaching a file to the message			*/
#define WM_NOTOP	(1<<5)		/* Don't add top because we need top line   */
#define WM_QUOTE	(1<<6)		/* Quote file available 					*/
#define WM_QWKNET	(1<<7)		/* Writing QWK NetMail (25 char title)		*/
#define WM_PRIVATE	(1<<8)		/* Private (for creating MSGINF file)		*/
794
#define WM_SUBJ_RO	(1<<9)		/* Subject/title is read-only				*/
795
#define WM_EDIT		(1<<10)		/* Editing existing message					*/
796
#define WM_FORCEFWD	(1<<11)		/* Force "yes" to ForwardMailQ for email	*/
797
#define WM_NOFWD	(1<<12)		/* Don't forward email to netmail			*/
798

799
800
801
802
803
804
								/* Bits in the mode of loadposts()			*/
#define LP_BYSELF	(1<<0)		/* Include messages sent by self			*/
#define LP_OTHERS	(1<<1)		/* Include messages sent to others			*/
#define LP_UNREAD	(1<<2)		/* Un-read messages only					*/
#define LP_PRIVATE	(1<<3)		/* Include all private messages 			*/
#define LP_REP		(1<<4)		/* Packing REP packet						*/
805
806
#define LP_POLLS	(1<<5)		/* Include polls							*/
#define LP_VOTES	(1<<6)		/* Include votes							*/
807
#define LP_NOMSGS	(1<<7)		/* Don't include regular messages			*/
808

809
810
811
								/* Bits in the mode of loadmail()			*/
#define LM_UNREAD	(1<<0)		/* Include un-read mail only				*/
#define LM_INCDEL	(1<<1)		/* Include deleted mail		 				*/
812
813
#define LM_NOSPAM	(1<<2)		/* Exclude SPAM								*/
#define LM_SPAMONLY	(1<<3)		/* Load SPAM only							*/
814
#define LM_REVERSE	(1<<4)		/* Reverse the index order (newest-first)	*/
815

816
817
818
819
820
enum {							/* readmail and delmailidx which types		*/
	 MAIL_YOUR					/* mail sent to you							*/
	,MAIL_SENT					/* mail you have sent						*/
	,MAIL_ANY					/* mail sent to or from you					*/
	,MAIL_ALL					/* all mail (ignores usernumber arg)		*/
821
822
	};

823
824
								/* Bits in the mode of external()           */
#define EX_SH       (1<<0)		/* Use command shell to load other process  */
825
826
827
#define EX_STDOUT   (1<<1)		/* Copy DOS output to remote                */
#define EX_OUTL 	(1<<2)		/* Use _lputc() for local output (*legacy*)	*/
#define EX_STDIN	(1<<3)		/* Trap int 16h keyboard input requests     */
828
829
830
#define EX_WWIV 	WWIVCOLOR	/* Expand WWIV color codes to ANSI sequence */
#define EX_SWAP 	(1<<5)		/* Swap out for this external (*legacy*)	*/
#define EX_POPEN	(1<<7)		/* Leave COM port open	(*legacy*)			*/
831
832
833
#define EX_OFFLINE	(1<<8)		/* Run this program offline					*/
#define EX_BG		(1<<10)		/* Back-ground/detached process				*/
#define EX_BIN		(1<<11)		/* Binary mode (no Unix LF to CRLF)			*/
834
#define EX_NATIVE	XTRN_NATIVE		/* Native (not MS-DOS) application 			*/
835
836
#define EX_CHKTIME	XTRN_CHKTIME	/* Check time left						*/
#define EX_NOECHO	XTRN_NOECHO		/* Don't echo stdin to stdout 			*/
837
#define EX_STDIO	(EX_STDIN|EX_STDOUT)
838
#define EX_JS_CX	(1<<24)		/* New JavaScript context */
839
#define EX_NOLOG	(1<<30)		/* Don't log intercepted stdio				*/
840
#define EX_CONIO	(1<<31)		/* Intercept Windows console I/O (doorway)	*/
841
#define EX_UNSPECIFIED	-1
842

843
#if defined(__unix__)
844
845
846
847
#define EX_WILDCARD	EX_SH		/* Expand wildcards using 'sh' on Unix		*/
#else
#define EX_WILDCARD	0
#endif
848

849
/* Linux-DOSemu path/drive hackeroo */
850
851
852
853
854
#define DOSEMU_NODE_DRIVE	"D:"
#define DOSEMU_XTRN_DRIVE	"E:"	// Parent of xtrn's startup-dir
#define DOSEMU_CTRL_DRIVE	"F:"
#define DOSEMU_DATA_DRIVE	"G:"
#define DOSEMU_EXEC_DRIVE	"H:"
855
856
857
858
859
860
861
#define DOSEMU_NODE_DIR		DOSEMU_NODE_DRIVE "\\"
#define DOSEMU_XTRN_DIR		DOSEMU_XTRN_DRIVE "\\"
#define DOSEMU_CTRL_DIR		DOSEMU_CTRL_DRIVE "\\"
#define DOSEMU_DATA_DIR		DOSEMU_DATA_DRIVE "\\"
#define DOSEMU_EXEC_DIR		DOSEMU_EXEC_DRIVE "\\"
#define DOSEMU_TEMP_DIR		DOSEMU_NODE_DRIVE "\\TEMP\\"
#define DOSEMU_TEXT_DIR		DOSEMU_CTRL_DRIVE "\\..\\TEXT\\"
862

863
								/* telnet_gate() mode bits					*/
864
865
866
867
868
869
870
871
#define TG_ECHO			(1<<0)	/* Turn on telnet echo						*/
#define TG_CRLF			(1<<1)	/* Expand sole CR to CRLF					*/
#define TG_LINEMODE		(1<<2)	/* Send entire lines only					*/
#define TG_NODESYNC		(1<<3)	/* Call Nodesync, get msgs, etc.			*/
#define TG_CTRLKEYS		(1<<4)	/* Interpret ^P ^U ^T, etc locally			*/
#define TG_PASSTHRU		(1<<5)	/* Pass-through telnet commands/responses	*/
#define TG_RLOGIN		(1<<6)	/* Use BSD RLogin protocol					*/
#define TG_NOCHKTIME	(1<<7)	/* Don't check time left while gated		*/
872
#define TG_NOTERMTYPE	(1<<8)	/* Request client "DONT TERM_TYPE"			*/
873
#define TG_SENDPASS		(1<<9)	/* Send password instead of real name (RLogin) - DEPRECATED	(it sent the password as the server user name) */
874
#define TG_NOLF			(1<<10)	/* Do not send line-feeds (opposite of TG_CRLF) */
875
#define TG_RLOGINSWAP	(1<<11)	/* Swap the RLogin alias/real-names			*/
876

877
878
879
880
881
882
883
884
885
enum {							/* Values for 'mode' in listfileinfo        */
	 FI_INFO            		/* Just list file information               */
	,FI_REMOVE           		/* Remove/Move/Edit file information        */
	,FI_DOWNLOAD         		/* Download files                           */
	,FI_OLD              		/* Search/Remove files not downloaded since */
	,FI_OLDUL	 				/* Search/Remove files uploaded before      */
	,FI_OFFLINE   				/* Search/Remove files not online			*/
	,FI_USERXFER  				/* User Xfer Download                       */
	,FI_CLOSE 	  				/* Close any open records					*/
886
	};
887
888
889
890
891
892
893
894

enum XFER_TYPE {				/* Values for type in xfer_prot_select()	*/
	 XFER_UPLOAD
	,XFER_DOWNLOAD
	,XFER_BATCH_UPLOAD
	,XFER_BATCH_DOWNLOAD
	,XFER_BIDIR
};
895

896
897
#define L_LOGON     1			/* Logon List maintenance                   */
#define LOL_SIZE    81			/* Length of each logon list entry          */
898

899
								/* Bits in mode of scanposts() function 	*/
900
901
902
903
904
905
#define SCAN_CONST		(1<<0)	/* Continuous message scanning				*/
#define SCAN_NEW		(1<<1)	/* New scanning								*/
#define SCAN_BACK		(1<<2)	/* Scan the last message if no new			*/
#define SCAN_TOYOU		(1<<3)	/* Scan for messages to you 				*/
#define SCAN_FIND		(1<<4)	/* Scan for text in messages				*/
#define SCAN_UNREAD		(1<<5)	/* Display un-read messages only			*/
906
#define SCAN_MSGSONLY	(1<<6)	/* Do not do a new file scan even if the
907
								 * user enabled Automatic New File Scan		*/
908
#define SCAN_POLLS		(1<<7)	/* Scan for polls (only)					*/
909
#define SCAN_INDEX		(1<<8)	// List the msg index or exec listmsgs_mod
910

911
912
913
								/* Bits in misc of chan_t					*/
#define CHAN_PW 	(1<<0)		/* Can be password protected				*/
#define CHAN_GURU	(1<<1)		/* Guru joins empty channel 				*/
914

915
916
917
918
enum {							/* Values of mode for userlist function     */
	 UL_ALL						/* List all users in userlist				*/
	,UL_SUB      				/* List all users with access to cursub     */
	,UL_DIR						/* List all users with access to curdir 	*/
919
920
921
	};


922
#define BO_LEN		16			/* backout.dab record length				*/
923

924
#define BO_OPENFILE 0			/* Backout types */
925
926
927
928
929
930

/**********/
/* Macros */
/**********/

#define CRLF			{ outchar(CR); outchar(LF); }
931
932
933
#define SYSOP_LEVEL		90
#define SYSOP			(useron.level>=SYSOP_LEVEL || sys_status & SS_TMPSYSOP)
#define REALSYSOP		(useron.level>=SYSOP_LEVEL)
934
935
#define FLAG(x) 		(ulong)(1UL<<(x-'A'))
#define CLS         	outchar(FF)
936
#define WHERE       	__LINE__,__FUNCTION__,getfname(__FILE__)
937
938
#define SAVELINE		saveline()
#define RESTORELINE 	restoreline()
939
940
941
942
943
#define SYNC			{ getnodedat(cfg.node_num,&thisnode,0); \
						  nodesync(); }
#define ASYNC			{ getnodedat(cfg.node_num,&thisnode,0); \
						  nodesync(); }
#define TM_YEAR(yy)		((yy)%100)
944
945
#define sbbs_beep(f,d)	BEEP(f,d)
#define mswait(x)		SLEEP(x)
946

947
948
949
950
/**************************************/
/* Text Attribute (color) Definitions */
/**************************************/
#define HIGH  0x08      /* High intensity foreground text */
951
#ifndef BLINK
952
#define BLINK 0x80		/* Blinking text */
953
954
955
956
957
958
#endif

#ifndef __COLORS
#define __COLORS

enum COLORS {
959
	BLACK,			/* dark colors (HIGH bit unset) */
960
961
962
963
964
965
966
	BLUE,
	GREEN,
	CYAN,
	RED,
	MAGENTA,
	BROWN,
	LIGHTGRAY,
967
	DARKGRAY,		/* light colors (HIGH bit set) */
968
969
970
971
972
973
974
975
976
	LIGHTBLUE,
	LIGHTGREEN,
	LIGHTCYAN,
	LIGHTRED,
	LIGHTMAGENTA,
	YELLOW,
	WHITE
};

977
978
979
980
#endif	/* __COLORS */

#define ANSI_NORMAL		0x100
#define BG_BLACK		0x200
rswindell's avatar
rswindell committed
981
#define BG_BRIGHT		0x400		// Not an IBM-CGA/ANSI.SYS compatible attribute
982
983
984
985
986
987
988
#define BG_BLUE			(BLUE<<4)
#define BG_GREEN		(GREEN<<4)
#define BG_CYAN			(CYAN<<4)
#define BG_RED			(RED<<4)
#define BG_MAGENTA		(MAGENTA<<4)
#define BG_BROWN		(BROWN<<4)
#define BG_LIGHTGRAY	(LIGHTGRAY<<4)
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026

/********************/
/* Type Definitions */
/********************/

typedef struct {						/* Users information */
	ushort	number, 					/* Number */
			uls,						/* Number of uploads */
			dls,						/* Number of downloads */
			posts,						/* Number of posts */
			emails,						/* Number of emails */
			fbacks,						/* Number of emails sent to sysop */
			etoday,						/* Emails today */
			ptoday,						/* Posts today */
			timeon,						/* Total time on */
			textra,						/* Extra time for today */
			logons,						/* Total logons */
			ttoday,						/* Time on today */
			tlast,						/* Time on last call */
			ltoday, 					/* Logons today */
			xedit,						/* External editor (1 based) */
			shell;						/* Command shell */

	char	alias[LEN_ALIAS+1], 		/* Alias */
			name[LEN_NAME+1],			/* Name - Real */
			handle[LEN_HANDLE+1],		/* Chat handle */
			comp[LEN_COMP+1],			/* Computer type */
			note[LEN_NOTE+1],			/* Public notice about this user */
			address[LEN_ADDRESS+1], 	/* Street Address */
			location[LEN_LOCATION+1],	/* Location of user */
			zipcode[LEN_ZIPCODE+1], 	/* Zip/Postal code */
			pass[LEN_PASS+1],			/* Password - not case sensitive */
			birth[LEN_BIRTH+1], 		/* Birthday in MM/DD/YY format */
			phone[LEN_PHONE+1],			/* Phone number xxx-xxx-xxxx format */
			modem[LEN_MODEM+1],			/* Modem type - 8 chars max */
			netmail[LEN_NETMAIL+1], 	/* NetMail forwarding address */
			tmpext[4],					/* QWK Packet extension */
			comment[LEN_COMMENT+1], 	/* Private comment about user */
1027
1028
			cursub[LEN_EXTCODE+1],		/* Current sub-board internal code */
			curdir[LEN_EXTCODE+1],		/* Current directory internal code */
deuce's avatar
deuce committed
1029
1030
			curxtrn[9],					/* Current external program internal code */
			ipaddr[LEN_IPADDR+1];		/* Last known IP address */
1031
1032
1033
1034
1035
1036

	uchar	level,						/* Security level */
			sex,						/* Sex - M or F */
			prot,						/* Default transfer protocol */
			leech;						/* Leech attempt counter */

1037
1038
1039
	int		rows,               		/* Rows on terminal (0 = auto-detect) */
			cols;						/* Columns on terminal (0 = auto-detect) */

1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
	ulong	misc,						/* Misc. bits - ANSI, Deleted etc. */
			qwk,						/* QWK settings */
			chat,						/* Chat defaults */
			flags1, 					/* Flag set #1 */
			flags2, 					/* Flag set #2 */
			flags3, 					/* Flag set #3 */
			flags4, 					/* Flag set #4 */
			exempt,						/* Exemption Flags */
			rest,						/* Restriction Flags */
			ulb,						/* Total bytes uploaded */
			dlb,						/* Total bytes downloaded */
			cdt,						/* Credits */
			min,						/* Minutes */
			freecdt;					/* Free credits (renewed daily) */
1054
	time32_t firston,					/* Date/Time first called */
1055
1056
1057
			laston, 					/* Last logoff date/time */
			expire, 					/* Expiration date */
			pwmod,						/* Password last modified */
1058
1059
			ns_time,					/* Date/Time of last new file scan */
			logontime;					/* Time of current logon */
1060
1061

} user_t;
1062
1063
1064
1065

typedef struct {						/* File (transfers) Data */
	char    name[13],					/* Name of file FILENAME.EXT */
			desc[LEN_FDESC+1],			/* Uploader's Description */
1066
			uler[LEN_ALIAS+1];			/* User who uploaded */
1067
	uchar	opencount;					/* Times record is currently open */
deuce's avatar
deuce committed
1068
	time32_t  date,						/* File date/time */
1069
1070
			dateuled,					/* Date/Time (Unix) Uploaded */
			datedled;					/* Date/Time (Unix) Last downloaded */
deuce's avatar
deuce committed
1071
	uint16_t	dir,						/* Directory file is in */
1072
1073
1074
			altpath,
			timesdled,					/* Total times downloaded */
			timetodl;					/* How long transfer time */
deuce's avatar
deuce committed
1075
	int32_t	datoffset,					/* Offset into .DAT file */
1076
1077
			size,						/* Size of file */
			misc;						/* Miscellaneous bits */
deuce's avatar
deuce committed
1078
	uint32_t	cdt;						/* Credit value for this file */
1079
1080

} file_t;
1081

1082
1083
1084
typedef struct {
	idxrec_t	idx;					/* defined in smbdefs.h */
	uint32_t	num;					/* 1-based offset */
rswindell's avatar
rswindell committed
1085
1086
1087
1088
1089
1090
1091
	union {
		struct {
			uint32_t	upvotes;
			uint32_t	downvotes;
		};
		uint32_t	votes[MSG_POLL_MAX_ANSWERS];
	};
1092
	uint32_t	total_votes;
1093
} post_t;
1094
1095
typedef idxrec_t mail_t;				/* defined in smbdefs.h */
typedef fidoaddr_t faddr_t;				/* defined in smbdefs.h */
1096
1097

typedef struct {						/* System/Node Statistics */
deuce's avatar
deuce committed
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
	uint32_t	logons,						/* Total Logons on System */
				ltoday,						/* Total Logons Today */
				timeon,						/* Total Time on System */
				ttoday,						/* Total Time Today */
				uls,						/* Total Uploads Today */
				ulb,						/* Total Upload Bytes Today */
				dls,						/* Total Downloads Today */
				dlb,						/* Total Download Bytes Today */
				ptoday,						/* Total Posts Today */
				etoday,						/* Total Emails Today */
				ftoday; 					/* Total Feedbacks Today */
	uint16_t	nusers; 					/* Total New Users Today */
1110
1111

} stats_t;
1112

rswindell's avatar
rswindell committed
1113
typedef struct {						/* Sub-board scan information */
deuce's avatar
deuce committed
1114
1115
1116
1117
1118
1119
	uint16_t	cfg;						/* User's configuration */
	uint32_t	ptr;						/* New-message pointer */
	uint32_t	last;						/* Last read message number */
	uint16_t	sav_cfg;					/* Saved configuration */
	uint32_t	sav_ptr;					/* Saved New-message pointer */
	uint32_t	sav_last;					/* Saved Last read message number */
rswindell's avatar
rswindell committed
1120
} subscan_t;
1121
1122

#endif /* Don't add anything after this #endif statement */