Synchronet JavaScript Object Model Reference

Generated for Synchronet v3.11a beta Debug, compiled Dec 6 2003 19:56
Property and Method version numbers (when available) indicate the Synchronet version when the item was added or modified.
  1. [+]  global object
  2. [+]  js object
  3. [+]  system object
  4. [+]  server object
  5. [+]  client object
  6. [+]  user object
  7. [+]  bbs object
  8. [+]  console object
  9. [+]  msg_area object
  10. [+]  file_area object
  11. [+]  xtrn_area object
  12. [+]  MsgBase class
  13. [+]  File class
  14. [+]  Socket class

global object
Top-level functions and properties (common to all servers and services)

global methods
Name Returns Usage Ver Description
logstringlog([level,] value [,value]) 3.11 add a line of text to the server and/or system log, values are typically string constants or variables, level is the debug level/priority (default: LOG_INFO)
readstringread([count]) 3.11 read up to count characters from input stream
readlnstringreadln([count]) 3.11 read a single line, up to count characters, from input stream
writevoidwrite(value [,value]) 3.11 send one or more values (typically strings) to the server output
writelnvoidwriteln(value [,value]) 3.11 send a line of text to the console or event log with automatic line termination (CRLF), values are typically string constants or variables (AKA print)
printfstringprintf(string format [,value][,value]) 3.10 print a formatted string - CAUTION: for experienced C programmers ONLY
alertvoidalert(value) 3.10 print an alert message (ala client-side JS)
promptstringprompt([value]) 3.10 displays a prompt (value) and returns a string of user input (ala clent-side JS)
confirmbooleanconfirm(value) 3.10 displays a Yes/No prompt and returns true or false based on users confirmation (ala client-side JS)
exitvoidexit([number exit_code]) 3.11 stop script execution, optionally setting the global property exit_code to the specified numeric value
loadbooleanload([object scope,] string filename [,args]) 3.11 load and execute a JavaScript module (filename), optionally specifying a target scope object (default: this) and a list of arguments to pass to the module (as argv), returns true if the execution was successful
mswaitvoidmswait([number milliseconds]) 3.10 millisecond wait/sleep routine (AKA sleep)
yieldvoidyield([bool forced]) 3.11 release current thread time-slice, a forced yield will yield to all other pending tasks (lowering CPU utilization), a non-forced yield will yield only to pending tasks of equal or higher priority. forced defaults to true
randomnumberrandom(number max) 3.10 return random integer between 0 and max-1
timenumbertime() 3.10 return current time in Unix (time_t) format (number of seconds since Jan-01-1970)
beepvoidbeep([number freq, duration]) 3.10 produce a tone on the local speaker at specified frequency for specified duration (in milliseconds)
soundbooleansound([string filename]) 3.10 play a waveform (.wav) sound file
ctrlstringctrl(number or string) 3.11 return ASCII control character representing character passed - Example: ctrl('C') returns ''
asciinumberascii([string text] or [number value]) 3.10 convert string to ASCII value or vice-versa (returns number OR string)
ascii_strstringascii_str(string text) 3.10 convert extended-ASCII in string to plain ASCII
strip_ctrlstringstrip_ctrl(string text) 3.10 strip control characters from string
strip_exasciistringstrip_exascii(string text) 3.10 strip extended-ASCII characters from string
truncspstringtruncsp(string text) 3.10 truncate white-space characters off end of string
truncstrstringtruncstr(string text, charset) 3.10 truncate string at first char in charset
lfexpandstringlfexpand(string text) 3.10 expand line-feeds (LF) to carriage-return/line-feeds (CRLF)
file_getnamestringfile_getname(string path) 3.11 returns filename portion of passed path string
file_getextstringfile_getext(string path) 3.11 returns file extension portion of passed path/filename string (including '.') or undefined if no extension is found
file_getcasestringfile_getcase(string filename) 3.11 returns correct case of filename (long version of filename on Win32) or undefined if the file doesn't exist
file_existsbooleanfile_exists(string filename) 3.10 verify a file's existence
file_removebooleanfile_remove(string filename) 3.10 delete a file
file_renamebooleanfile_rename(oldname, newname) 3.11 rename a file, possibly moving it to another directory in the process
file_copybooleanfile_copy(source, destination) 3.11 copy a file from one directory or filename to another
file_backupbooleanfile_backup(string filename [,number level] [,bool rename]) 3.11 backup the specified filename as filename.number.extension where number is the backup number 0 through level-1 (default backup level is 5), if rename is true, the original file is renamed instead of copied (default is false)
file_isdirbooleanfile_isdir(string filename) 3.10 check if specified filename is a directory
file_attribnumberfile_attrib(string filename) 3.10 get a file's permissions/attributes
file_datenumberfile_date(string filename) 3.10 get a file's last modified date/time (in time_t format)
file_sizenumberfile_size(string filename) 3.10 get a file's length (in bytes)
file_utimebooleanfile_utime(string filename [,access_time] [,mod_time]) 3.11 change a file's last accessed and modification date/time (in time_t format), or change to current time
file_touchbooleanfile_touch(string filename) 3.11 updates a file's last modification date/time to current time, creating an empty file if it doesn't already exist
directoryarraydirectory(string pattern [,flags]) 3.10 returns an array of directory entries, pattern is the path and filename or wildcards to search for (e.g. '/subdir/*.txt'), flags is a bitfield of optional glob flags (default is GLOB_MARK)
dir_freespacenumberdir_freespace(string directory [,unit_size]) 3.11 returns the amount of available disk space in the specified directory using the specified unit_size in bytes (default: 1), specify a unit_size of 1024 to return the available space in kilobytes.
socket_selectarraysocket_select([array of socket objects or descriptors] [,number timeout] [,bool write]) 3.11 checks an array of socket objects or descriptors for read or write ability (default is read), default timeout value is 0.0 seconds (immediate timeout), returns an array of 0-based index values into the socket array, representing the sockets that were ready for reading or writing
mkdirbooleanmkdir(string directory) 3.10 make a directory
rmdirbooleanrmdir(string directory) 3.10 remove a directory
strftimestringstrftime(string format [,number time]) 3.10 return a formatted time string (ala C strftime)
formatstringformat(string format [,args]) 3.10 return a formatted string (ala sprintf) - CAUTION: for experienced C programmers ONLY
html_encodestringhtml_encode(string text [,bool ex_ascii] [,bool white_space] [,bool ansi] [,bool ctrl_a]) 3.11 return an HTML-encoded text string (using standard HTML character entities), escaping IBM extended-ASCII, white-space characters, ANSI codes, and CTRL-A codes by default
html_decodestringhtml_decode(string text) 3.11 return a decoded HTML-encoded text string
word_wrapstringword_wrap(string text [,line_length]) 3.11 returns a word-wrapped version of the text string argument, line_length defaults to 79
quote_msgstringquote_msg(string text [,line_length] [,prefix]) 3.11 returns a quoted version of the message text string argumnet, line_length defaults to 79, prefix defaults to " > "
rot13_translatestringrot13_translate(string text) 3.11 returns ROT13-translated version of text string (will encode or decode text)
base64_encodestringbase64_encode(string text) 3.11 returns base64-encoded version of text string or null on error
base64_decodestringbase64_decode(string text) 3.11 returns base64-decoded text string or null on error (not useful for binary data)
crc16_calcnumbercrc16_calc(string text) 3.11 calculate and return 16-bit CRC of text string
crc32_calcnumbercrc32_calc(string text) 3.11 calculate and return 32-bit CRC of text string
chksum_calcnumberchksum_calc(string text) 3.11 calculate and return 32-bit checksum of text string
md5_calcstringmd5_calc(string text [,bool hex]) 3.11 calculate and return 128-bit MD5 digest of text string, result encoded in base64 (default) or hexadecimal
resolve_ipstringresolve_ip(string hostname) 3.11 resolve IP address of specified hostname (AKA gethostbyname)
resolve_hoststringresolve_host(string ip_address) 3.11 resolve hostname of specified IP address (AKA gethostbyaddr)

global properties
Name Type Description
argcnumbernumber of arguments passed to the script
argvarrayarray of argument strings (argv.length == argc)
errnonumberlast system error number
errno_strstringdescription of last system error

js object
JavaScript execution and garbage collection control object - introduced in v3.11

js methods
Name Returns Usage Ver Description
evalstringjs.eval(string script) 3.11 evaluate a JavaScript string in its own (secure) context, returning the result
gcvoidjs.gc(bool forced) 3.11 perform a garbage collection operation (freeing memory for unused allocated objects), if forced is true (the default) a garbage collection is always performed, otherwise it is only performed if deemed appropriate by the JavaScript engine

js properties
Name Type Ver Description
versionstring 3.11 JavaScript engine version information (AKA system.js_version)
auto_terminateboolean 3.11 set to false to disable the automatic termination of the script upon external request
terminatedboolean 3.11 termination has been requested (stop execution as soon as possible)
branch_counternumber 3.11 number of branch operations performed in this runtime
branch_limitnumber 3.11 maximum number of branches, used for infinite-loop detection (0=disabled)
yield_intervalnumber 3.11 interval of periodic time-slice yields (lower number=higher frequency, 0=disabled)
gc_intervalnumber 3.11 interval of periodic garbage collection attempts (lower number=higher frequency, 0=disabled)
gc_attemptsnumber 3.11 number of garbage collections attempted in this runtime - READ ONLY
gc_counternumber 3.11 number of garbage collections performed in this runtime - READ ONLY
gc_last_bytesnumber 3.11 number of heap bytes in use after last garbage collection - READ ONLY
bytesnumber 3.11 number of heap bytes currently in use - READ ONLY
max_bytesnumber 3.11 maximum number of bytes available for heap

system object
Global system-related properties and methods

system methods
Name Returns Usage Ver Description
usernamestringsystem.username(number) 3.11 returns name of user in specified user record number, or empty string if not found
aliasstringsystem.alias(string alias) 3.10 returns name of user that matches alias (if found in ctrl/alias.cfg)
matchusernumbersystem.matchuser(string username [,bool sysop_alias]) 3.10 exact user name matching, returns number of user whose name/alias matches username or 0 if not found, matches well-known sysop aliases by default
matchuserdatanumbersystem.matchuserdata(field, data [,usernumber]) 3.10 search user database for data in a specific field (specified by offset), returns first matching user record number, optional usernumber specifies user record to skip
trashcanbooleansystem.trashcan(string filename, search) 3.10 search text/filename.can for pseudo-regexp
findstrbooleansystem.findstr(string filename, search) 3.10 search any file for pseudo-regexp
zonestrstringsystem.zonestr([timezone]) 3.10 convert time zone integer to string, defaults to system timezone if timezone not specified
timestrstringsystem.timestr([time]) 3.10 convert time_t integer into a time string, defaults to current time if time not specified
datestrstringsystem.datestr([time]) 3.10 convert time_t integer into a date string (in either MM/DD/YY or DD/MM/YY format), defaults to current date if time not specified
secondstrstringsystem.secondstr(seconds) 3.10 convert elapsed time in seconds into a string in hh:mm:ss format
spamlogbooleansystem.spamlog([protocol, action, reason, host, ip, to, from]) 3.10 log a suspected SPAM attempt
hacklogbooleansystem.hacklog([protocol, user, text, host, ip, port]) 3.10 log a suspected hack attempt
filter_ipbooleansystem.filter_ip([protocol, reason, host, ip, username]) 3.11 add an IP address (with comment) to the system's IP filter file
get_node_messagestringsystem.get_node_message(number node) 3.11 read any messages waiting for the specified node and return in a single string
put_node_messagebooleansystem.put_node_message(number node, string message) 3.10 send a node a short text message, delivered immediately
get_telegramstringsystem.get_telegram(number user) 3.11 returns any short text messages waiting for the specified user
put_telegrambooleansystem.put_telegram(number user, string message) 3.10 sends a user a short text message, delivered immediately or during next logon
new_userobjectsystem.new_user(name/alias) 3.10 creates a new user record, returns a new User object representing the new user account
execnumbersystem.exec(command-line) 3.11 executes a native system/shell command-line, returns 0 on success
popenarraysystem.popen(command-line) 3.11 executes a native system/shell command-line, returns array of captured output lines on success (only functional on UNIX systems)
check_syspassbooleansystem.check_syspass(string password) 3.11 compares the supplied password against the system password and return's true if it matches

system properties
Name Type Ver Description
namestring 3.10 BBS name
operatorstring 3.10 operator name
qwk_idstring 3.10 system QWK-ID (for QWK packets)
settingsnumber 3.10 settings bitfield (see SS_* in sbbsdefs.js for bit definitions)
psnamestring 3.10 PostLink name
psnumnumber 3.10 PostLink system number
inet_addrstring 3.11 Internet address (host or domain name)
locationstring 3.10 location (city, state)
timezonenumber 3.10 timezone (use system.zonestr() to get string representation)
pwdaysnumber 3.10 days between forced password changes
deldaysnumber 3.10 days to preserve deleted user records
lastusernumber 3.11 last user record number in user database (includes deleted and inactive user records)
lastuseronstring 3.10 name of last user to logoff
freediskspacenumber 3.10 amount of free disk space (in bytes)
freediskspaceknumber 3.10 amount of free disk space (in kilobytes)
nodesnumber 3.10 total number of BBS nodes
lastnodenumber 3.10 last displayable node number
newuser_passwordstring 3.10 new user password
newuser_magic_wordstring 3.10 new user magic word
newuser_levelnumber 3.10 new user level
newuser_flags1number 3.10 new user flag set #1
newuser_flags2number 3.10 new user flag set #2
newuser_flags3number 3.10 new user flag set #3
newuser_flags4number 3.10 new user flag set #4
newuser_restrictionsnumber 3.10 new user restriction flags
newuser_exemptionsnumber 3.10 new user exemption flags
newuser_creditsnumber 3.10 new user credits
newuser_minutesnumber 3.10 new user extra minutes
newuser_command_shellnumber 3.10 new user command shell
newuser_editorstring 3.10 new user external editor
newuser_settingsnumber 3.10 new user settings
newuser_download_protocolstring 3.10 new user file transfer protocol (command key)
newuser_expiration_daysnumber 3.10 new user expiration days
newuser_questionsnumber 3.10 new user questions bitfield (see UQ_* in sbbsdefs.js for bit definitions)
expired_levelnumber 3.10 expired user level
expired_flags1number 3.10 expired user flag set #1
expired_flags2number 3.10 expired user flag set #2
expired_flags3number 3.10 expired user flag set #3
expired_flags4number 3.10 expired user flag set #4
expired_restrictionsnumber 3.10 expired user restriction flags
expired_exemptionsnumber 3.10 expired user exemption flags
node_dirstring 3.10 node directory
ctrl_dirstring 3.10 control file directory
data_dirstring 3.10 data file directory
text_dirstring 3.10 text file directory
temp_dirstring 3.10 temporary file directory
exec_dirstring 3.10 executable file directory
mods_dirstring 3.10 modified modules directory (optional)
logs_dirstring 3.10 log file directory
devnullstring 3.11 null device filename
clock_ticksnumber 3.11 amount of elapsed processor time in clock 'ticks'
clock_ticks_per_secondnumber 3.11 number of clock ticks per second
local_host_namestring 3.11 private host name that uniquely identifies this system on the local network
host_namestring N/A public host name that uniquely identifies this system on the Internet (usually the same as system.inetaddr)
versionstring N/A Synchronet version number (e.g. '3.10')
revisionstring N/A Synchronet revision letter (e.g. 'k')
beta_versionstring N/A Synchronet alpha/beta designation (e.g. ' beta')
full_versionstring N/A Synchronet full version information (e.g. '3.10k Beta Debug')
version_noticestring N/A Synchronet version notice (includes version and platform)
platformstring N/A platform description (e.g. 'Win32', 'Linux', 'FreeBSD')
socket_libstring N/A socket library version information
msgbase_libstring N/A message base library version information
compiled_withstring N/A compiler used to build Synchronet
compiled_whenstring N/A date and time compiled
copyrightstring N/A Synchronet copyright display
js_versionstring N/A JavaScript engine version information
os_versionstring N/A operating system version information
uptimenumber N/A time/date system was brought online (in time_t format)

system.stats object
System statistics

system.stats properties
Name Type Ver Description
total_logonsnumber 3.10 total logons
logons_todaynumber 3.10 logons today
total_timeonnumber 3.10 total time used
timeon_todaynumber 3.10 time used today
total_filesnumber 3.10 total files in file bases
files_uploaded_todaynumber 3.10 files uploaded today
bytes_uploaded_todaynumber 3.10 bytes uploaded today
files_downloaded_todaynumber 3.10 files downloaded today
bytes_downloaded_todaynumber 3.10 bytes downloaded today
total_messagesnumber 3.10 total messages in message bases
messages_posted_todaynumber 3.10 messages posted today
total_emailnumber 3.10 total messages in mail base
email_sent_todaynumber 3.10 email sent today
total_feedbacknumber 3.10 total feedback messages waiting
feedback_sent_todaynumber 3.10 feedback sent today
total_usersnumber 3.10 total user records (does not include deleted or inactive user records)
new_users_todaynumber 3.10 new users today

system.node_list array
BBS node listing

system.node_list properties
Name Type Ver Description
statusnumber 3.10 status (see nodedefs.js for valid values)
errorsnumber 3.10 error counter
actionnumber 3.10 current user action (see nodedefs.js)
useronnumber 3.10 current user number
connectionnumber 3.10 connection speed (0xffff = Telnet or RLogin)
miscnumber 3.10 miscellaneous bitfield (see nodedefs.js)
auxnumber 3.10 auxillary value
extauxnumber 3.10 extended auxillary value

server object
Server-specifc properties

server properties
Name Type Ver Description
versionstring 3.10 server name and version number
version_detailstring 3.10 detailed version/build information
interface_ip_addressstring 3.11 IP address of bound network interface (0.0.0.0 = ANY)
optionsnumber 3.11 bit-field of server-specific startup options
clientsnumber 3.11 number of active clients (if available)

client object
Represents a TCP/IP client session

client properties
Name Type Ver Description
ip_addressstring 3.10 client's IP address (in dotted-decimal format)
host_namestring 3.10 client's host name (up to 64 characters)
portnumber 3.10 client's TCP or UDP port number
connect_timenumber 3.10 date/time of initial connection (in time_t format)
protocolstring 3.10 protocol description (e.g. 'Telnet', 'FTP', etc.)
user_namestring 3.10 user's name/alias (if logged in)
socketobject N/A instance of Socket class representing client's TCP/IP connection

user object
Instance of User class, representing current user online

To create a new user object: var u = new User(number)

user methods
Name Returns Usage Ver Description
compare_arsbooleanuser.compare_ars(string ars) 3.10 Verify user meets access requirements string

user properties
Name Type Ver Description
numbernumber 3.10 record number (1-based)
aliasstring 3.10 alias/name
namestring 3.10 real name
handlestring 3.10 chat handle
ip_addressstring 3.10 IP address last logged on from
notestring 3.10 AKA ip_address
host_namestring 3.10 host name last logged on from
computerstring 3.10 AKA host_name
commentstring 3.10 sysop's comment
netmailstring 3.10 external e-mail address
emailstring 3.10 local Internet e-mail address - READ ONLY
addressstring 3.10 street address
locationstring 3.10 location (city, state)
zipcodestring 3.10 zip/postal code
phonestring 3.10 phone number
birthdatestring 3.10 birth date
agenumber 3.10 calculated age in years - READ ONLY
connectionstring 3.10 connection type
modemstring 3.10 AKA connection
screen_rowsnumber 3.10 terminal rows (lines)
genderstring 3.10 gender type
cursubstring 3.10 current message sub-board
curdirstring 3.10 current file directory
curxtrnstring 3.10 current external program being run
editorstring 3.10 external message editor
command_shellstring 3.10 command shell
settingsnumber 3.10 settings bitfield
qwk_settingsnumber 3.10 QWK packet settings bitfield
chat_settingsnumber 3.10 chat settings bitfield
temp_file_extstring 3.10 temporary file type (extension)
new_file_timenumber 3.11 new file scan date/time (time_t format)
download_protocolstring 3.10 file transfer protocol (command key)
logontimenumber 3.10 logon time (time_t format)

user.stats object
User statistics (all READ ONLY)

user.stats properties
Name Type Ver Description
laston_datenumber 3.10 date of previous logon
firston_datenumber 3.10 date of first logon
total_logonsnumber 3.10 total number of logons
logons_todaynumber 3.10 total logons today
total_timeonnumber 3.10 total time used (in minutes)
timeon_todaynumber 3.10 time used today
timeon_last_logonnumber 3.10 time used last session
total_postsnumber 3.10 total messages posted
total_emailsnumber 3.10 total e-mails sent
total_feedbacksnumber 3.10 total feedback messages sent
email_todaynumber 3.10 e-mail sent today
posts_todaynumber 3.10 messages posted today
bytes_uploadednumber 3.10 total bytes uploaded
files_uploadednumber 3.10 total files uploaded
bytes_downloadednumber 3.10 total bytes downloaded
files_downloadednumber 3.10 total files downloaded
leech_attemptsnumber 3.10 suspected leech downloads

user.limits object
User limitations based on security level (all READ ONLY) - introduced in v3.11

user.limits properties
Name Type Ver Description
time_per_logonnumber 3.11 time (in minutes) per logon
time_per_daynumber 3.11 time (in minutes) per day
logons_per_daynumber 3.11 logons per day
lines_per_messagenumber 3.11 lines per message (post or email)
email_per_daynumber 3.11 email sent per day
posts_per_daynumber 3.11 messages posted per day
free_credits_per_daynumber 3.11 free credits given per day

user.security object
User security settings

user.security properties
Name Type Ver Description
passwordstring 3.10 password
password_datenumber 3.10 date password last modified (time_t format)
levelnumber 3.10 security level (0-99)
flags1number 3.10 flag set #1 (bitfield)
flags2number 3.10 flag set #2 (bitfield)
flags3number 3.10 flag set #3 (bitfield)
flags4number 3.10 flag set #4 (bitfield)
exemptionsnumber 3.10 exemption flags (bitfield)
restrictionsnumber 3.10 restriction flags (bitfield)
creditsnumber 3.10 credits
free_creditsnumber 3.10 free credits (for today only)
minutesnumber 3.10 extra minutes (time bank)
extra_timenumber 3.10 extra minutes (for today only)
expiration_datenumber 3.10 expiration date/time (time_t format)

bbs object
Controls the Telnet/RLogin BBS experience

bbs methods
Name Returns Usage Ver Description
atcodestringbbs.atcode(string code) 3.10 returns @-code value, specified code string does not include @ character delimiters
textstringbbs.text(number line) 3.10 returns specified text string from text.dat
replace_textbooleanbbs.replace_text(number line, string text) 3.10 replaces specified text string in memory
revert_textbooleanbbs.revert_text([number line]) 3.10 reverts specified text string to original text string; if line unspecified, reverts all text lines
load_textbooleanbbs.load_text(string basefilename) 3.10 load an alternate text.dat from ctrl directory, automatically appends '.dat' to basefilename
newuservoidbbs.newuser() 3.10 interactive new user procedure
loginbooleanbbs.login(string username, password_prompt) 3.10 login with username, displaying password_prompt for password (if required)
logonbooleanbbs.logon() 3.10 interactive logon procedure
logoffvoidbbs.logoff() 3.10 interactive logoff procedure
logoutvoidbbs.logout() 3.10 non-interactive logout procedure
hangupvoidbbs.hangup() 3.10 hangup (disconnect) immediately
nodesyncvoidbbs.nodesync() 3.10 synchronize with node database, checks for messages, interruption, etc. (AKA node_sync)
auto_msgvoidbbs.auto_msg() 3.10 read/create system's auto-message
time_bankvoidbbs.time_bank() 3.10 enter the time banking system
qwk_secvoidbbs.qwk_sec() 3.10 enter the QWK message packet upload/download/config section
text_secvoidbbs.text_sec() 3.10 enter the text files section
xtrn_secvoidbbs.xtrn_sec() 3.10 enter the external programs section
xfer_policyvoidbbs.xfer_policy() 3.10 display the file transfer policy
batch_menuvoidbbs.batch_menu() 3.10 enter the batch file transfer menu
batch_downloadbooleanbbs.batch_download() 3.10 start a batch download
batch_add_listvoidbbs.batch_add_list(filename) 3.10 add file list to batch download queue
temp_xfervoidbbs.temp_xfer() 3.10 enter the temporary file tranfer menu
user_syncvoidbbs.user_sync() 3.10 read the current user data from the database
user_configvoidbbs.user_config() 3.10 enter the user settings configuration menu
sys_infovoidbbs.sys_info() 3.10 display system information
sub_infovoidbbs.sub_info([subboard]) 3.10 display message sub-board information (current subboard, if unspecified)
dir_infovoidbbs.dir_info([directory]) 3.10 display file directory information (current directory, if unspecified)
user_infovoidbbs.user_info() 3.10 display current user information
vervoidbbs.ver() 3.10 display software version information
sys_statsvoidbbs.sys_stats() 3.10 display system statistics
node_statsvoidbbs.node_stats() 3.10 display current node statistics
list_usersvoidbbs.list_users() 3.10 display user list
edit_uservoidbbs.edit_user() 3.10 enter the user editor
change_uservoidbbs.change_user() 3.10 change to a different user
list_logonsvoidbbs.list_logons() 3.10 display the logon list
read_mailvoidbbs.read_mail() 3.10 read private e-mail
emailbooleanbbs.email(number user [,number mode] [,string top] [,string subject]) 3.10 send private e-mail or netmail
netmailbooleanbbs.netmail(string address [,number mode] [,string subject]) 3.10 send private netmail
bulk_mailvoidbbs.bulk_mail([ars]) 3.10 send bulk private e-mail
upload_filebooleanbbs.upload_file(directory) 3.10 upload file to file directory specified by number or internal code
bulk_uploadbooleanbbs.bulk_upload(directory) 3.10 add files (already in local storage path) to file directory specified by number or internal code
resort_dirbooleanbbs.resort_dir(directory) 3.10 re-sort the file directory specified by number or internal code)
list_filesnumberbbs.list_files(directory [,string filespec] [,number mode]) 3.10 list files in the specified file directory, optionally specifying a file specification (wildcards) and mode (bitfield)
list_file_infonumberbbs.list_file_info(directory [,string filespec] [,number mode]) 3.10 list extended file information for files in the specified file directory
post_msgbooleanbbs.post_msg(sub-board [,number mode]) 3.10 post a message in the specified message sub-board (number or internal code) with optinal mode (bitfield)
cfg_msg_scanvoidbbs.cfg_msg_scan([number type]) 3.10 configure message scan (type is either SCAN_CFG_NEW or SCAN_CFG_TOYOU)
cfg_msg_ptrsvoidbbs.cfg_msg_ptrs([number type]) 3.10 change message scan pointer values (type is either SCAN_CFG_NEW or SCAN_CFG_TOYOU)
reinit_msg_ptrsvoidbbs.reinit_msg_ptrs() 3.10 re-initialize new message scan pointers
scan_subsvoidbbs.scan_subs([number mode, boolean all]) 3.10 scan sub-boards for messages
scan_dirsvoidbbs.scan_dirs([number mode, boolean all]) 3.10 scan directories for files
scan_postsbooleanbbs.scan_posts([sub-board, number mode, string find]) 3.10 scan posts in the specified message sub-board (number or internal code), optionally search for 'find' string
menuvoidbbs.menu(base_filename) 3.10 display a menu file from the text/menu directory
log_keybooleanbbs.log_key(key [,boolean comma]) 3.10 log key to node.log (comma optional)
log_strbooleanbbs.log_str(text) 3.10 log string to node.log
findusernumberbbs.finduser(username_or_number) 3.10 find user name (partial name support), interactive
trashcanbooleanbbs.trashcan(base_filename, search_string) 3.10 search file for psuedo-regexp (search string) in trashcan file (text/base_filename.can)
execnumberbbs.exec(cmdline [,number mode] [,string startup_dir]) 3.10 execute a program, optionally changing current directory to startup_dir (see EX_* in sbbsdefs.js for valid mode bits)
exec_xtrnbooleanbbs.exec_xtrn(xtrn_number_or_code) 3.10 execute external program by internal code
user_eventbooleanbbs.user_event(number event_type) 3.10 execute user event by event type (see EVENT_* in sbbsdefs.js for valid values)
telnet_gatevoidbbs.telnet_gate(string address [,number mode]) 3.10 external telnet gateway (see TG_* in sbbsdefs.js for valid mode bits)
check_syspassbooleanbbs.check_syspass() 3.10 prompt for and verify system password
good_passwordstringbbs.good_password(string password) 3.10 check if requested user password meets minimum password requirements (length, uniqueness, etc.)
page_sysopbooleanbbs.page_sysop() 3.10 page the sysop for chat
page_gurubooleanbbs.page_guru() 3.10 page the guru for chat
multinode_chatvoidbbs.multinode_chat() 3.10 enter multi-node chat
private_messagevoidbbs.private_message() 3.10 use the private inter-node message prompt
private_chatvoidbbs.private_chat() 3.10 enter private inter-node chat
get_node_messagevoidbbs.get_node_message() 3.10 receive and display an inter-node message
put_node_messagebooleanbbs.put_node_message(number node, string text) 3.10 send an inter-node message
get_telegramvoidbbs.get_telegram([number usernum]) 3.10 receive and display a telegram
put_telegrambooleanbbs.put_telegram(number user, string text) 3.10 send a telegram to a user
list_nodesvoidbbs.list_nodes() 3.10 list all nodes
whos_onlinevoidbbs.whos_online() 3.10 list active nodes only (who's online)
spyvoidbbs.spy(node_number) 3.10 spy on a node
cmdstrstringbbs.cmdstr(string str [,string fpath] [,string fspec]) 3.10 return expanded command string using Synchronet command-line specifiers
get_filespecstringbbs.get_filespec() 3.10 returns a file specification input by the user (optionally with wildcards)
get_newscantimenumberbbs.get_newscantime(number time) 3.10 confirm or change newscan time, returns new newscan time value (time_t format)
select_shellbooleanbbs.select_shell() 3.10 prompt user to select a new command shell
select_editorbooleanbbs.select_editor() 3.10 prompt user to select a new external message editor

bbs properties
Name Type Ver Description
sys_statusnumber 3.10 system status bitfield (see SS_* in sbbsdefs.js for bit definitions)
startup_optionsnumber 3.10 startup options bitfield (see BBS_OPT_* in sbbsdefs.js for bit definitions)
answer_timenumber 3.10 answer time, in time_t format
logon_timenumber 3.10 logon time, in time_t format
new_file_timenumber 3.10 file newscan time, in time_t format
last_new_file_timenumber 3.10 previous newscan time, in time_t format
onlinenumber 3.10 online (see ON_* in sbbsdefs.js for valid values)
time_leftnumber 3.11 time left (in seconds)
event_timenumber 3.11 time of next exclusive event (in time_t format), or 0 if none
event_codestring 3.11 internal code of next exclusive event
node_numnumber 3.10 current node number
node_settingsnumber 3.10 current node settings bitfield (see NM_* in sbbsdefs.js for bit definitions)
node_actionnumber 3.10 current node action (see nodedefs.js for valid values)
node_val_usernumber 3.10 validation feedback user for this node (or 0 for no validation feedback required)
logon_ulbnumber 3.10 bytes uploaded during this session
logon_dlbnumber 3.10 bytes downloaded during this session
logon_ulsnumber 3.10 files uploaded during this session
logon_dlsnumber 3.10 files downloaded during this session
logon_postsnumber 3.10 messages posted during this session
logon_emailsnumber 3.10 e-mails sent during this session
logon_fbacksnumber 3.10 feedback messages sent during this session
posts_readnumber 3.10 messages read during this session
menu_dirstring 3.10 menu subdirectory (overrides default)
menu_filestring 3.10 menu file (overrides default)
main_cmdsnumber 3.10 total main menu commands received from user during this session
file_cmdsnumber 3.10 total file menu commands received from user during this session
curgrpnumber 3.10 current message group
cursubnumber 3.10 current message sub-board
curlibnumber 3.10 current file library
curdirnumber 3.10 current file directory
connectionstring 3.10 remote connection type
rlogin_namestring 3.10 rlogin name
client_namestring 3.10 client name
alt_ul_dirnumber 3.10 current alternate upload path number
smb_groupstring 3.10 message group name of message being read
smb_group_descstring 3.10 message group description of message being read
smb_group_numbernumber 3.10 message group number of message being read
smb_substring 3.10 sub-board name of message being read
smb_sub_descstring 3.10 sub-board description of message being read
smb_sub_codestring 3.10 sub-board internal code of message being read
smb_sub_numbernumber 3.10 sub-board number of message being read
smb_attrnumber 3.10 message base attributes
smb_last_msgnumber 3.10 highest message number in message base
smb_total_msgsnumber 3.10 total number of messages in message base
smb_msgsnumber 3.10 number of messages loaded from message base
smb_curmsgnumber 3.10 current message number in message base
msg_tostring 3.10 message recipient name
msg_to_extstring 3.10 message recipient extension
msg_to_netstring 3.10 message recipient network type
msg_to_agentnumber 3.10 message recipient agent type
msg_fromstring 3.10 message sender name
msg_from_extstring 3.10 message sender extension
msg_from_netstring 3.10 message sender network type
msg_from_agentnumber 3.10 message sender agent type
msg_replytostring 3.10 message reply-to name
msg_replyto_extstring 3.10 message reply-to extension
msg_replyto_netstring 3.10 message reply-to network type
msg_replyto_agentnumber 3.10 message reply-to agent type
msg_subjectstring 3.10 message subject
msg_datenumber 3.10 message date/time
msg_timezonenumber 3.10 message time zone
msg_date_importednumber 3.10 message date/time imported
msg_attrnumber 3.10 message attributes
msg_auxattrnumber 3.10 message auxillary attributes
msg_netattrnumber 3.10 message network attributes
msg_offsetnumber 3.10 message header offset
msg_numbernumber 3.10 message number
msg_expirationnumber 3.10 message expiration
msg_forwardednumber 3.10 message forwarded
msg_thread_orignumber 3.10 message thread, original message number
msg_thread_nextnumber 3.10 message thread, next message number
msg_thread_firstnumber 3.10 message thread, first reply to this message
msg_idstring 3.10 message identifier
msg_reply_idstring 3.10 message replied-to identifier
msg_delivery_attemptsnumber 3.10 message delivery attempt counter
batch_upload_totalnumber 3.10 number of files in batch upload queue
batch_dnload_totalnumber 3.10 number of files in batch download queue

console object
Controls the user's Telnet/RLogin terminal

console methods
Name Returns Usage Ver Description
inkeystringconsole.inkey([number mode] [,number timeout]) 3.11 get a single key with optional timeout in milliseconds (defaults to 0, for no wait), see K_* in sbbsdefs.js for mode bits
getkeystringconsole.getkey([number mode]) 3.10 get a single key, with wait, see K_* in sbbsdefs.js for mode bits
getstrstringconsole.getstr([string][,maxlen][,mode]) 3.10 get a text string from the user, see K_* in sbbsdefs.js for mode bits
getnumnumberconsole.getnum([maxnum]) 3.10 get a number between 1 and maxnum from the user
getkeysnumberconsole.getkeys(string keys [,maxnum]) 3.10 get one key from of a list of valid command keys, or a number between 1 and maxnum
gettemplatestringconsole.gettemplate(format [,string] [,mode]) 3.10 get a string based on template
ungetstrvoidconsole.ungetstr() 3.10 put a string in the keyboard buffer
yesnobooleanconsole.yesno(string question) 3.10 YES/no question
noyesbooleanconsole.noyes(string question) 3.10 NO/yes question
mnemonicsvoidconsole.mnemonics(string text) 3.10 print a mnemonics string
clearvoidconsole.clear() 3.10 clear screen and home cursor
homevoidconsole.home() 3.11 send cursor to home position (x,y:1,1)
clearlinevoidconsole.clearline() 3.10 clear current line
cleartoeolvoidconsole.cleartoeol() 3.11 clear to end-of-line (ANSI)
crlfvoidconsole.crlf() 3.10 output a carriage-return/line-feed pair (new-line)
pausevoidconsole.pause() 3.10 display pause prompt and wait for key hit
beepvoidconsole.beep([number count]) 3.11 beep for count number of times (default count is 1)
printvoidconsole.print(string text) 3.10 display a string (supports Ctrl-A codes)
writevoidconsole.write(string text) 3.10 display a raw string
putmsgvoidconsole.putmsg(string text [,number mode]) 3.10 display message text (Ctrl-A codes, @-codes, pipe codes, etc), see P_* in sbbsdefs.js for mode bits
centervoidconsole.center(string text) 3.10 display a string centered on the screen
strlennumberconsole.strlen(string text) 3.10 returns the number of characters in text, excluding Ctrl-A codes
printfilevoidconsole.printfile(string text [,number mode]) 3.10 print a message text file with optional mode
printtailvoidconsole.printtail(string text, number lines [,number mode]) 3.10 print last x lines of file with optional mode
editfilevoidconsole.editfile(string filename) 3.10 edit/create a text file using the user's preferred message editor
uselectnumberconsole.uselect([number, string title, string item, string ars]) 3.10 user selection menu, call for each item, then with no args to display select menu
savelinevoidconsole.saveline() 3.10 save last output line
restorelinevoidconsole.restoreline() 3.10 restore last output line
ansistringconsole.ansi(number attribute) 3.10 returns ANSI encoding of specified attribute
pushxyvoidconsole.pushxy() 3.11 save current cursor position (AKA ansi_save)
popxyvoidconsole.popxy() 3.11 restore saved cursor position (AKA ansi_restore)
gotoxyvoidconsole.gotoxy(number x,y) 3.11 Move cursor to a specific screen coordinate (ANSI), arguments can be separate x and y cooridinates or an object with x and y properites (like that returned from console.getxy())
upvoidconsole.up([number rows]) 3.11 Move cursor up one or more rows (ANSI)
downvoidconsole.down([number rows]) 3.11 Move cursor down one or more rows (ANSI)
rightvoidconsole.right([number columns]) 3.11 Move cursor right one or more columns (ANSI)
leftvoidconsole.left([number columns]) 3.11 Move cursor left one or more columns (ANSI)
getlinesvoidconsole.getlines() 3.11 Auto-detect the number of rows/lines on the user's terminal (ANSI)
getxyobjectconsole.getxy() 3.11 Returns the current cursor position as an object (with x and y properties)
lock_inputvoidconsole.lock_input([boolean lock]) 3.10 Lock the user input thread (allowing direct client socket access)
telnet_cmdvoidconsole.telnet_cmd(number cmd [,number option]) 3.10 Send telnet command (with optional command option) to remote client
handle_ctrlkeybooleanconsole.handle_ctrlkey(string key [,number mode]) 3.11 Call internal control key handler for specified control key, returns true if handled

console properties
Name Type Ver Description
statusnumber 3.10 status bitfield (see CON_* in sbbsdefs.js for bit definitions)
line_counternumber 3.10 current line counter (used for automatic screen pause)
attributesnumber 3.10 current display attributes (set with number or string value)
top_of_screennumber 3.10 set to 1 if the terminal cursor is already at the top of the screen
screen_rowsnumber 3.10 number of terminal screen rows (in lines)
screen_columnsnumber 3.11 number of terminal screen columns (in character cells)
autotermnumber 3.10 bitfield of automatically detected terminal settings (see USER_* in sbbsdefs.js for bit definitions)
terminalstring 3.11 terminal type description (e.g. 'ANSI')
timeoutnumber 3.10 user inactivity timeout reference
timeleft_warningnumber 3.10 low timeleft warning flag
abortednumber 3.10 input/output has been aborted
abortablenumber 3.10 output can be aborted with Ctrl-C
telnet_modenumber 3.10 current telnet mode bitfield (see TELNET_MODE_* in sbbsdefs.js for bit definitions)
wordwrapstring 3.10 word-wrap buffer (used by getstr) - READ ONLY
questionstring 3.10 current yes/no question (set by yesno and noyes)
getstr_offsetnumber 3.11 cursor position offset for use with getstr(K_USEOFFSET)
ctrlkey_passthrunumber 3.10 control key pass-through bitmask, set bits represent control key combinations not handled by inkey() method

msg_area object
Message Areas

msg_area.sub object
Associative array of all sub-boards (use internal code as index) - introduced in v3.11

msg_area.grp_list array
Message Groups

msg_area.grp_list properties
Name Type Description
numbernumber group number
namestring group name
descriptionstring group description
arsstring group access requirements

msg_area.grp_list.sub_list array
Message Sub-boards

(all properties are READ ONLY except for scan_ptr, scan_cfg, and last_read)
msg_area.grp_list.sub_list properties
Name Type Description
numbernumber sub-board number
grp_numbernumber group number
codestring sub-board internal code
namestring sub-board name
descriptionstring sub-board description
qwk_namestring sub-board QWK name
newsgroupstring newsgroup name (as configured or dymamically generated)
arsstring sub-board access requirements
read_arsstring sub-board reading requirements
post_arsstring sub-board posting requirements
operator_arsstring sub-board operator requirements
moderated_arsstring sub-board moderated-user requirements (if non-blank)
data_dirstring sub-board data storage location
fidonet_originstring FidoNet origin line
qwknet_taglinestring QWK Network tagline
settingsnumber toggle options (bitfield)
ptridxnumber index into message scan configuration/pointer file
qwk_confnumber QWK conference number
max_crcsnumber configured maximum number of message CRCs to store (for dupe checking)
max_msgsnumber configured maximum number of messages before purging
max_agenumber configured maximum age (in days) of messages before expiration
can_readboolean user has sufficient access to read messages
can_postboolean user has sufficient access to post messages
is_operatorboolean user has operator access to this message area
is_moderatedboolean user's posts are moderated
scan_ptrnumber user's current new message scan pointer (highest-read message number)
scan_cfgnumber user's message scan configuration (bitfield) see SUB_SCAN_* in sbbsdefs.js for valid bits
lead_readnumber user's last-read message number

file_area object
File Transfer Areas

file_area.dir object
Associative array of all directories (use internal code as index) - introduced in v3.11

file_area properties
Name Type Description
min_diskspacenumber
settingsnumber

file_area.lib_list array
File Transfer Libraries

file_area.lib_list properties
Name Type Description
numbernumber library number
namestring library name
descriptionstring library description
arsstring library access requirements
linkstring library link (for HTML index)

file_area.lib_list.dir_list array
File Transfer Directories

file_area.lib_list.dir_list properties
Name Type Description
numbernumber directory number
lib_numbernumber library number
codestring directory internal code
namestring directory name
descriptionstring directory description
pathstring directory file storage location
arsstring directory access requirements
upload_arsstring directory upload requirements
download_arsstring directory download requirements
exempt_arsstring directory exemption requirements
operator_arsstring directory operator requirements
extensionsstring allowed file extensions (comma delimited)
upload_semstring upload semaphore file
data_dirstring directory data storage location
settingsnumber toggle options (bitfield)
seqdevnumber sequential (slow storage) device number
sortnumber sort order (see SORT_* in sbbsdefs.js for valid values)
max_filesnumber configured maximum number of files
max_agenumber configured maximum age (in days) of files before expiration
upload_credit_pctnumber percent of file size awarded uploader in credits upon file upload
download_credit_pctnumber percent of file size awarded uploader in credits upon subsequent downloads
linkstring directory link (for HTML index)
can_uploadboolean user has sufficient access to upload files
can_downloadboolean user has sufficient access to download files
is_exemptboolean user is exempt from download credit costs
is_operatorboolean user has operator access to this directory

xtrn_area object
External Program Areas

xtrn_area.prog object
Associative array of all external programs (use internal code as index) - introduced in v3.11

xtrn_area.sec_list array
Online Program (door) Sections

xtrn_area.sec_list properties
Name Type Description
numbernumber external program section number
codestring external program section internal code
namestring external program section name
arsstring external program section access requirements

xtrn_area.sec_list.prog_list array
Online External Programs (doors)

xtrn_area.sec_list.prog_list properties
Name Type Description
codestring internal code
namestring name
cmdstring command-line
clean_cmdstring clean-up command-line
startup_dirstring startup directory
arsstring access requirements
execution_arsstring execution requirements
settingsnumber toggle options (bitfield)
typenumber drop file type
eventnumber event type (0=none)
textranumber extra time given to users running this program
max_timenumber maximum time allowed in program
costnumber execution cost (credits to run this program)
numbernumber program number
sec_numbernumber program section number
can_runboolean user has sufficient access to run this program

xtrn_area.event object
Associative array of all timed events (use internal code as index) - introduced in v3.11

xtrn_area.event properties
Name Type Description
cmdstring command-line
startup_dirstring startup directory
node_numnumber node number
timenumber time to execute
freqnumber frequency to execute
daysnumber days of week to execute (bitfield)
mdaysnumber days of month to execute (bitfield)
last_runnumber date/time last run (in time_t format)
settingsnumber toggle options (bitfield)

xtrn_area.editor object
Associative array of all external editors (use internal code as index) - introduced in v3.11

xtrn_area.editor properties
Name Type Description
namestring name
cmdstring command-line
arsstring access requirements
settingsnumber toggle options (bitfield)
typenumber drop file type

MsgBase class
Class used for accessing message bases

To create a new MsgBase object: var msgbase = new MsgBase('code')
where code is a sub-board internal code, or mail for the e-mail message base

MsgBase methods
Name Returns Usage Ver Description
openbooleanMsgBase.open() 3.10 open message base
closebooleanMsgBase.close() 3.10 close message base (if open)
get_msg_headerobjectMsgBase.get_msg_header([boolean by_offset,] number_or_id) 3.10 returns a specific message header, null on failure
put_msg_headerbooleanMsgBase.put_msg_header([boolean by_offset,] number, object header) 3.10 write a message header
get_msg_bodystringMsgBase.get_msg_body([boolean by_offset,] number_or_id [,boolean strip_ctrl_a]) 3.10 returns the body text of a specific message, null on failure
get_msg_tailstringMsgBase.get_msg_tail([boolean by_offset,] number_or_id [,boolean strip_ctrl_a]) 3.10 returns the tail text of a specific message, null on failure
get_msg_indexobjectMsgBase.get_msg_index([boolean by_offset,] number) 3.11 returns a specific message index, null on failure. The index object will contain the following properties:
subjectCRC-16 of lowercase message subject
toCRC-16 of lowercase recipient's name (or user number if e-mail)
fromCRC-16 of lowercase sender's name (or user number if e-mail)
attrAttribute bitfield
timeDate/time (in time_t format)
numberMessage number
offsetByte-offset into header file
remove_msgbooleanMsgBase.remove_msg([boolean by_offset,] number_or_id) 3.11 mark message as deleted
save_msgbooleanMsgBase.save_msg(object header, string body_text) 3.10 create a new message in message base, the header object may contain the following properties:
subjectMessage subject (required)
toRecipient's name (required)
to_extRecipient's user number (for local e-mail)
to_orgRecipient's organization
to_net_typeRecipient's network type (default: 0 for local)
to_net_addrRecipient's network address
to_agentRecipient's agent type
fromSender's name (required)
from_extSender's user number
from_orgSender's organization
from_net_typeSender's network type (default: 0 for local)
from_net_addrSender's network address
from_ip_addrSender's IP address (if available, for security tracking)
from_host_nameSender's host name (if available, for security tracking)
replytoReplies should be sent to this name
replyto_extReplies should be sent to this user number
replyto_orgReplies should be sent to organization
replyto_net_typeReplies should be sent to this network type
replyto_net_addrReplies should be sent to this network address
replyto_agentReplies should be sent to this agent type
idMessage's RFC-822 compliant Message-ID
reply_idMessage's RFC-822 compliant Reply-ID
reverse_pathMessage's SMTP sender address
pathMessages's NNTP path
newsgroupsMessage's NNTP newsgroups header
ftn_msgidFidoNet FTS-9 Message-ID
ftn_replyFidoNet FTS-9 Reply-ID
ftn_areaFidoNet FTS-4 echomail AREA tag
ftn_flagsFidoNet FSC-53 FLAGS
ftn_pidFidoNet FSC-46 Program Identifier
ftn_tidFidoNet FSC-46 Tosser Identifier
dateRFC-822 formatted date/time
attrAttribute bitfield
auxattrAuxillary attribute bitfield
netattrNetwork attribute bitfield
when_written_timeDate/time (in time_t format)
when_written_zoneTime zone
when_imported_timeDate/time message was imported
when_imported_zoneTime zone
thread_origReplying to this message number
thread_nextNumber of next message in this thread
thread_firstNumber of first reply to this message
field_list[].typeOther SMB header fields (type)
field_list[].dataOther SMB header fields (data)

MsgBase properties
Name Type Ver Description
errorstring 3.10 last occurred message base error - READ ONLY
filestring 3.10 base path and filename of message base - READ ONLY
retry_timenumber 3.10 message base open/lock retry timeout (in seconds)
retry_delaynumber 3.11 delay between message base open/lock retries (in milliseconds)
first_msgnumber 3.10 first message number - READ ONLY
last_msgnumber 3.10 last message number - READ ONLY
total_msgsnumber 3.10 total number of messages - READ ONLY
max_crcsnumber 3.10 maximum number of message CRCs to store (for dupe checking) - READ ONLY
max_msgsnumber 3.10 maximum number of messages before expiration - READ ONLY
max_agenumber 3.10 maximum age (in days) of messages to store - READ ONLY
attributesnumber 3.10 message base attributes - READ ONLY
subnumnumber 3.10 sub-board number (0-based, -1 for e-mail) - READ ONLY
is_openboolean 3.10 true if the message base has been opened successfully - READ ONLY

MsgBase.cfg object
Configuration parameters for this message area (sub-boards only) - READ ONLY

MsgBase.cfg properties
Name Type Description
numbernumber sub-board number
grp_numbernumber group number
codestring sub-board internal code
namestring sub-board name
descriptionstring sub-board description
qwk_namestring sub-board QWK name
newsgroupstring newsgroup name (as configured or dymamically generated)
arsstring sub-board access requirements
read_arsstring sub-board reading requirements
post_arsstring sub-board posting requirements
operator_arsstring sub-board operator requirements
moderated_arsstring sub-board moderated-user requirements (if non-blank)
data_dirstring sub-board data storage location
fidonet_originstring FidoNet origin line
qwknet_taglinestring QWK Network tagline
settingsnumber toggle options (bitfield)
ptridxnumber index into message scan configuration/pointer file
qwk_confnumber QWK conference number
max_crcsnumber configured maximum number of message CRCs to store (for dupe checking)
max_msgsnumber configured maximum number of messages before purging
max_agenumber configured maximum age (in days) of messages before expiration

File class
Class used for opening, creating, reading, or writing files on the local file system

Special features include:

  1. Exclusive-access files (default) or shared files
    1. optional record-locking
    2. buffered or non-buffered I/O
  2. Support for binary files
    1. native or network byte order (endian)
    2. automatic Unix-to-Unix (UUE), yEncode (yEnc) or Base64 encoding/decoding
  3. Support for ASCII text files
    1. supports line-based I/O
      1. entire file may be read or written as an array of strings
      2. individual lines may be read or written one line at a time
    2. supports fixed-length records
      1. optional end-of-text (etx) character for automatic record padding/termination
      2. Synchronet .dat files use an etx value of 3 (Ctrl-C)
    3. supports .ini formated configuration files
    4. optional ROT13 encoding/translation
  4. Dynamically-calculated industry standard checksums (e.g. CRC-16, CRC-32, MD5)

To create a new File object: var f = new File(filename)

File methods
Name Returns Usage Ver Description
openbooleanFile.open([string mode, boolean shareable, number buflen]) 3.10 open file, shareable defaults to false, buflen defaults to 2048 bytes, mode (default: w+) specifies the type of access requested for the file, as follows:
open for reading; if the file does not exist or cannot be found, the open call fails
open an empty file for writing; if the given file exists, its contents are destroyed
open for writing at the end of the file (appending); creates the file first if it doesn’t exist
r+ open for both reading and writing (the file must exist)
w+ open an empty file for both reading and writing; if the given file exists, its contents are destroyed
a+ open for reading and appending
open in binary (untranslated) mode; translations involving carriage-return and linefeed characters are suppressed (e.g. r+b)
closevoidFile.close() 3.10 close file
removebooleanFile.remove() 3.10 remove the file from the disk
clear_errorbooleanFile.clear_error() 3.10 clears the current error value (AKA clearError)
flushbooleanFile.flush() 3.10 flush/commit buffers to disk
rewindbooleanFile.rewind() 3.11 repositions the file pointer (position) to the beginning of a file and clears error and end-of-file indicators
lockbooleanFile.lock([offset, length]) 3.10 lock file record for exclusive access (file must be opened shareable)
unlockbooleanFile.unlock([offset, length]) 3.10 unlock file record for exclusive access
readstringFile.read([maxlen]) 3.10 read a string from file (optionally unix-to-unix or base64 decoding in the process), maxlen defaults to the current length of the file minus the current file position
readlnstringFile.readln([maxlen]) 3.10 read a line-feed terminated string, maxlen defaults to 512 characters
readBinnumberFile.readBin([bytes]) 3.10 read a binary integer from the file, default number of bytes is 4 (32-bits)
readAllarrayFile.readAll() 3.10 read all lines into an array of strings
writebooleanFile.write(string text [,len]) 3.10 write a string to the file (optionally unix-to-unix or base64 decoding in the process)
writelnbooleanFile.writeln([string text]) 3.10 write a line-feed terminated string to the file
writeBinbooleanFile.writeBin(value [,bytes]) 3.10 write a binary integer to the file, default number of bytes is 4 (32-bits)
writeAllbooleanFile.writeAll(array lines) 3.10 write an array of strings to file
printfnumberFile.printf(string format [,args]) 3.10 write a formatted string to the file (ala fprintf) - CAUTION: for experienced C programmers ONLY
iniGetSectionsarrayFile.iniGetSections([prefix]) 3.11 parse all section names from a .ini file (format = '[section]') and return the section names as an array of strings, optionally, only those section names that begin with the specified prefix
iniGetKeysarrayFile.iniGetKeys(section) 3.11 parse all key names from the specified section in a .ini file and return the key names as an array of strings
iniGetValuestringFile.iniGetValue(section, key [,default]) 3.11 parse a key from a .ini file and return its value (format = 'key = value'). returns the specified default value if the key or value is missing or invalid. will return a bool, number, string, or an array of strings determined by the type of default value specified
iniGetObjectobjectFile.iniGetObject(section) 3.11 parse an entire section from a .ini file and return all of its keys and values as properties of an object
iniGetAllObjectsarrayFile.iniGetAllObjects([name_property] [,prefix]) 3.11 parse all sections from a .ini file and return all sections and keys an array of objects with each section's keys as properties of each section object, name_property is the name of the property to create to contain the section's name (default is "name"), the optional prefix has the same use as in the iniGetSections method, if a prefix is specified, it is removed from each section's name

File properties
Name Type Ver Description
namestring 3.10 filename specified in constructor - READ ONLY
modestring 3.10 mode string specified in open call - READ ONLY
existsboolean 3.10 true if the file exists - READ ONLY
is_openboolean 3.10 true if the file has been opened successfully - READ ONLY
eofboolean 3.10 true if the current file position is at the end of file - READ ONLY
errornumber 3.10 the last occurred error value (use clear_error to clear) - READ ONLY
descriptornumber 3.10 the open file descriptor (advanced use only) - READ ONLY
etxnumber 3.10 end-of-text character (advanced use only), if non-zero used by read, readln, and write
debugboolean 3.10 set to true to enable debug log output
positionnumber 3.10 the current file position (offset in bytes), change value to seek within file
datenumber 3.11 last modified date/time (in time_t format)
lengthnumber 3.10 the current length of the file (in bytes)
attributesnumber 3.10 file mode/attributes
network_byte_orderboolean 3.11 set to true if binary data is to be written and read in Network Byte Order (big end first)
rot13boolean 3.11 set to true to enable automatic ROT13 translatation of text
uueboolean 3.11 set to true to enable automatic Unix-to-Unix encode and decode on read and write calls
yencboolean 3.11 set to true to enable automatic yEnc encode and decode on read and write calls
base64boolean 3.11 set to true to enable automatic Base64 encode and decode on read and write calls
crc16number 3.11 calculated 16-bit CRC of file contents - READ ONLY
crc32number 3.11 calculated 32-bit CRC of file contents - READ ONLY
chksumnumber 3.11 calculated 32-bit checksum of file contents - READ ONLY
md5_hexundefined 3.11 calculated 128-bit MD5 digest of file contents as hexadecimal string - READ ONLY
md5_base64undefined 3.11 calculated 128-bit MD5 digest of file contents as base64-encoded string - READ ONLY

Socket class
Class used for TCP/IP socket communications

To create a new Socket object: load('sockdefs.js'); var s = new Socket(type)
where type = SOCK_STREAM for TCP (default) or SOCK_DGRAM for UDP

Socket methods
Name Returns Usage Ver Description
closevoidSocket.close() 3.10 close (shutdown) the socket immediately
bindbooleanSocket.bind([port] [,ip_address]) 3.11 bind socket to a TCP or UDP port (number or service name), optionally specifying a network interface (via ip_address)
connectbooleanSocket.connect(host, port [,timeout]) 3.11 connect to a remote port (number or service name) on the specified host (IP address or host name), default timeout value is 10.0 (seconds)
listenbooleanSocket.listen() 3.10 place socket in a state to listen for incoming connections (use before an accept)
acceptobjectSocket.accept() 3.10 accept an incoming connection, returns a new Socket object representing the new connection
sendbooleanSocket.send(data) 3.10 send a string (AKA write)
sendtobooleanSocket.sendto(data, address, port) 3.10 send data to a specific host (IP address or host name) and port (number or service name), for UDP sockets
sendfilebooleanSocket.sendfile(filename) 3.10 send an entire file over the socket
sendBinbooleanSocket.sendBin(number value [,number bytes]) 3.11 send a binary integer over the socket, default number of bytes is 4 (32-bits)
recvstringSocket.recv([maxlen]) 3.10 receive a string, default maxlen is 512 characters (AKA read)
peekstringSocket.peek([maxlen]) 3.10 receive a string, default maxlen is 512 characters, leaves string in receive buffer
recvlinestringSocket.recvline([maxlen] [,timeout]) 3.10 receive a line-feed terminated string, default maxlen is 512 characters, default timeout is 30 seconds (AKA readline and readln)
recvfromobjectSocket.recvfrom([bool binary] [,maxlen or int_size]) 3.11 receive data (string or integer) from a socket (typically UDP)

returns object with ip_address and port of sender along with data

binary defaults to false, maxlen defaults to 512 chars, int_size defaults to 4 bytes (32-bits)

recvBinnumberSocket.recvBin([number bytes]) 3.11 receive a binary integer from the socket, default number of bytes is 4 (32-bits)
getoptionnumberSocket.getoption(option) 3.10 get socket option value, option may be socket option name (see sockopts in sockdefs.js) or number
setoptionbooleanSocket.setoption(option, value) 3.10 set socket option value, option may be socket option name (see sockopts in sockdefs.js) or number
ioctlnumberSocket.ioctl(command [,argument]) 3.10 send socket IOCTL (advanced)
pollnumberSocket.poll([number timeout] [,bool write]) 3.10 poll socket for read or write ability (default is read), default timeout value is 0.0 seconds (immediate timeout)

Socket properties
Name Type Ver Description
errornumber 3.11 error status for the last socket operation that failed - READ ONLY
is_connectedboolean 3.10 true if socket is in a connected state - READ ONLY
is_writeableboolean 3.11 true if socket can accept written data - READ ONLY
data_waitingboolean 3.10 true if data is waiting to be read from socket - READ ONLY
nreadnumber 3.10 number of bytes waiting to be read - READ ONLY
debugnumber 3.10 enable debug logging
descriptornumber 3.10 socket descriptor (advanced uses only)
nonblockingboolean 3.10 use non-blocking operation (default is false)
local_ip_addressstring 3.10 local IP address (string in dotted-decimal format)
local_portnumber 3.10 local TCP or UDP port number
remote_ip_addressstring 3.10 remote IP address (string in dotted-decimal format)
remote_portnumber 3.10 remote TCP or UDP port number
typenumber 3.10 socket type, SOCK_STREAM (TCP) or SOCK_DGRAM (UDP)
network_byte_orderboolean 3.11 true if binary data is to be sent in Network Byte Order (big end first), default is true

Totals: 452 properties, 252 methods