Skip to content
Snippets Groups Projects
Commit 56af1818 authored by rswindell's avatar rswindell
Browse files

JavaScript methods and properties added or modified in v3.11.

parent 6d836b6a
No related branches found
No related tags found
No related merge requests found
<html>
<head>
<title>Synchronet JavaScript Object Model Reference</title>
<STYLE>
OL LI { cursor: hand; }
UL LI { display: none;list-style: square; }
.showList LI { display: list-item; }
</STYLE>
</head>
<body>
<font face=arial,helvetica>
<h1>Synchronet JavaScript Object Model Reference</h1>
Generated for <b>Synchronet v3.11a beta Debug</b>, compiled Dec 6 2003 19:56
<br><font size=-1>
Includes Properties and Methods added in Synchronet v3.11 only.
</font>
<ol type=square>
<li onclick = 'this.className = (this.className == "showList") ? "defaultStyles" : "showList";'
onselectstart = 'event.returnValue = false;'>
[+] &nbsp<a href="#global"><b>global</b></a> object
<ul>
<li onclick = 'this.className = (this.className == "showList") ? "defaultStyles" : "showList";'
onselectstart = 'event.returnValue = false;'>
<a href=#global_methods>methods</a>
<li onclick = 'this.className = (this.className == "showList") ? "defaultStyles" : "showList";'
onselectstart = 'event.returnValue = false;'>
<a href=#global_properties>properties</a>
</ul>
<li onclick = 'this.className = (this.className == "showList") ? "defaultStyles" : "showList";'
onselectstart = 'event.returnValue = false;'>
[+] &nbsp<a href="#js"><b>js</b></a> object
<ul>
<li onclick = 'this.className = (this.className == "showList") ? "defaultStyles" : "showList";'
onselectstart = 'event.returnValue = false;'>
<a href=#js_methods>methods</a>
<li onclick = 'this.className = (this.className == "showList") ? "defaultStyles" : "showList";'
onselectstart = 'event.returnValue = false;'>
<a href=#js_properties>properties</a>
</ul>
<li onclick = 'this.className = (this.className == "showList") ? "defaultStyles" : "showList";'
onselectstart = 'event.returnValue = false;'>
[+] &nbsp<a href="#system"><b>system</b></a> object
<ul>
<li onclick = 'this.className = (this.className == "showList") ? "defaultStyles" : "showList";'
onselectstart = 'event.returnValue = false;'>
<a href=#system_methods>methods</a>
<li onclick = 'this.className = (this.className == "showList") ? "defaultStyles" : "showList";'
onselectstart = 'event.returnValue = false;'>
<a href=#system_properties>properties</a>
</ul>
<li onclick = 'this.className = (this.className == "showList") ? "defaultStyles" : "showList";'
onselectstart = 'event.returnValue = false;'>
[+] &nbsp<a href="#server"><b>server</b></a> object
<ul>
<li onclick = 'this.className = (this.className == "showList") ? "defaultStyles" : "showList";'
onselectstart = 'event.returnValue = false;'>
<a href=#server_properties>properties</a>
</ul>
<li onclick = 'this.className = (this.className == "showList") ? "defaultStyles" : "showList";'
onselectstart = 'event.returnValue = false;'>
[+] &nbsp<a href="#client"><b>client</b></a> object
<ul>
</ul>
<li onclick = 'this.className = (this.className == "showList") ? "defaultStyles" : "showList";'
onselectstart = 'event.returnValue = false;'>
[+] &nbsp<a href="#user"><b>user</b></a> object
<ul>
<li onclick = 'this.className = (this.className == "showList") ? "defaultStyles" : "showList";'
onselectstart = 'event.returnValue = false;'>
<a href=#user_methods>methods</a>
<li onclick = 'this.className = (this.className == "showList") ? "defaultStyles" : "showList";'
onselectstart = 'event.returnValue = false;'>
<a href=#user_properties>properties</a>
</ul>
<li onclick = 'this.className = (this.className == "showList") ? "defaultStyles" : "showList";'
onselectstart = 'event.returnValue = false;'>
[+] &nbsp<a href="#bbs"><b>bbs</b></a> object
<ul>
<li onclick = 'this.className = (this.className == "showList") ? "defaultStyles" : "showList";'
onselectstart = 'event.returnValue = false;'>
<a href=#bbs_methods>methods</a>
<li onclick = 'this.className = (this.className == "showList") ? "defaultStyles" : "showList";'
onselectstart = 'event.returnValue = false;'>
<a href=#bbs_properties>properties</a>
</ul>
<li onclick = 'this.className = (this.className == "showList") ? "defaultStyles" : "showList";'
onselectstart = 'event.returnValue = false;'>
[+] &nbsp<a href="#console"><b>console</b></a> object
<ul>
<li onclick = 'this.className = (this.className == "showList") ? "defaultStyles" : "showList";'
onselectstart = 'event.returnValue = false;'>
<a href=#console_methods>methods</a>
<li onclick = 'this.className = (this.className == "showList") ? "defaultStyles" : "showList";'
onselectstart = 'event.returnValue = false;'>
<a href=#console_properties>properties</a>
</ul>
<li onclick = 'this.className = (this.className == "showList") ? "defaultStyles" : "showList";'
onselectstart = 'event.returnValue = false;'>
[+] &nbsp<a href="#msg_area"><b>msg_area</b></a> object
<ul>
</ul>
<li onclick = 'this.className = (this.className == "showList") ? "defaultStyles" : "showList";'
onselectstart = 'event.returnValue = false;'>
[+] &nbsp<a href="#file_area"><b>file_area</b></a> object
<ul>
</ul>
<li onclick = 'this.className = (this.className == "showList") ? "defaultStyles" : "showList";'
onselectstart = 'event.returnValue = false;'>
[+] &nbsp<a href="#xtrn_area"><b>xtrn_area</b></a> object
<ul>
</ul>
<li onclick = 'this.className = (this.className == "showList") ? "defaultStyles" : "showList";'
onselectstart = 'event.returnValue = false;'>
[+] &nbsp<a href="#MsgBase"><b>MsgBase</b></a> class
<ul>
<li onclick = 'this.className = (this.className == "showList") ? "defaultStyles" : "showList";'
onselectstart = 'event.returnValue = false;'>
<a href=#MsgBase_methods>methods</a>
<li onclick = 'this.className = (this.className == "showList") ? "defaultStyles" : "showList";'
onselectstart = 'event.returnValue = false;'>
<a href=#MsgBase_properties>properties</a>
</ul>
<li onclick = 'this.className = (this.className == "showList") ? "defaultStyles" : "showList";'
onselectstart = 'event.returnValue = false;'>
[+] &nbsp<a href="#File"><b>File</b></a> class
<ul>
<li onclick = 'this.className = (this.className == "showList") ? "defaultStyles" : "showList";'
onselectstart = 'event.returnValue = false;'>
<a href=#File_methods>methods</a>
<li onclick = 'this.className = (this.className == "showList") ? "defaultStyles" : "showList";'
onselectstart = 'event.returnValue = false;'>
<a href=#File_properties>properties</a>
</ul>
<li onclick = 'this.className = (this.className == "showList") ? "defaultStyles" : "showList";'
onselectstart = 'event.returnValue = false;'>
[+] &nbsp<a href="#Socket"><b>Socket</b></a> class
<ul>
<li onclick = 'this.className = (this.className == "showList") ? "defaultStyles" : "showList";'
onselectstart = 'event.returnValue = false;'>
<a href=#Socket_methods>methods</a>
<li onclick = 'this.className = (this.className == "showList") ? "defaultStyles" : "showList";'
onselectstart = 'event.returnValue = false;'>
<a href=#Socket_properties>properties</a>
</ul>
</ol>
<h2><a name=global>global object</a>
<br><font size=-1>Top-level functions and properties (common to all servers and services)</font>
</h2>
<table border=1 width=100%>
<caption align=left><b><tt>global</tt>
<a name=global_methods> methods</a>
</b></caption>
<tr bgcolor=gray>
<th align=left width=100>
<font color="white">Name</font>
<th align=left width=100>
<font color="white">Returns</font>
<th align=left width=200>
<font color="white">Usage</font>
<th align=left>
<font color="white">Description</font>
<tr valign=top><td><b>log</b><td>string<td><tt>log([level,] value [,value])
<td>add a line of text to the server and/or system log, <i>values</i> are typically string constants or variables, <i>level</i> is the debug level/priority (default: <tt>LOG_INFO</tt>)
<tr valign=top><td><b>read</b><td>string<td><tt>read([count])
<td>read up to count characters from input stream
<tr valign=top><td><b>readln</b><td>string<td><tt>readln([count])
<td>read a single line, up to count characters, from input stream
<tr valign=top><td><b>write</b><td>void<td><tt>write(value [,value])
<td>send one or more values (typically strings) to the server output
<tr valign=top><td><b>writeln</b><td>void<td><tt>writeln(value [,value])
<td>send a line of text to the console or event log with automatic line termination (CRLF), <i>values</i> are typically string constants or variables (AKA print)
<tr valign=top><td><b>exit</b><td>void<td><tt>exit([number exit_code])
<td>stop script execution, optionally setting the global property <tt>exit_code</tt> to the specified numeric value
<tr valign=top><td><b>load</b><td>boolean<td><tt>load([object scope,] string filename [,args])
<td>load and execute a JavaScript module (<i>filename</i>), optionally specifying a target <i>scope</i> object (default: <i>this</i>) and a list of arguments to pass to the module (as <i>argv</i>), returns <i>true</i> if the execution was successful
<tr valign=top><td><b>yield</b><td>void<td><tt>yield([bool forced])
<td>release current thread time-slice, a <i>forced</i> yield will yield to all other pending tasks (lowering CPU utilization), a non-<i>forced</i> yield will yield only to pending tasks of equal or higher priority. <i>forced</i> defaults to <i>true</i>
<tr valign=top><td><b>ctrl</b><td>string<td><tt>ctrl(number or string)
<td>return ASCII control character representing character passed - Example: <tt>ctrl('C') returns ''</tt>
<tr valign=top><td><b>file_getname</b><td>string<td><tt>file_getname(string path)
<td>returns filename portion of passed path string
<tr valign=top><td><b>file_getext</b><td>string<td><tt>file_getext(string path)
<td>returns file extension portion of passed path/filename string (including '.') or <i>undefined</i> if no extension is found
<tr valign=top><td><b>file_getcase</b><td>string<td><tt>file_getcase(string filename)
<td>returns correct case of filename (long version of filename on Win32) or <i>undefined</i> if the file doesn't exist
<tr valign=top><td><b>file_rename</b><td>boolean<td><tt>file_rename(oldname, newname)
<td>rename a file, possibly moving it to another directory in the process
<tr valign=top><td><b>file_copy</b><td>boolean<td><tt>file_copy(source, destination)
<td>copy a file from one directory or filename to another
<tr valign=top><td><b>file_backup</b><td>boolean<td><tt>file_backup(string filename [,number level] [,bool rename])
<td>backup the specified <i>filename</i> as <tt>filename.<i>number</i>.extension</tt> where <i>number</i> is the backup number 0 through <i>level</i>-1 (default backup <i>level</i> is 5), if <i>rename</i> is <i>true</i>, the original file is renamed instead of copied (default is <i>false</i>)
<tr valign=top><td><b>file_utime</b><td>boolean<td><tt>file_utime(string filename [,access_time] [,mod_time])
<td>change a file's last accessed and modification date/time (in time_t format), or change to current time
<tr valign=top><td><b>file_touch</b><td>boolean<td><tt>file_touch(string filename)
<td>updates a file's last modification date/time to current time, creating an empty file if it doesn't already exist
<tr valign=top><td><b>dir_freespace</b><td>number<td><tt>dir_freespace(string directory [,unit_size])
<td>returns the amount of available disk space in the specified <i>directory</i> using the specified <i>unit_size</i> in bytes (default: 1), specify a <i>unit_size</i> of <tt>1024</tt> to return the available space in <i>kilobytes</i>.
<tr valign=top><td><b>socket_select</b><td>array<td><tt>socket_select([array of socket objects or descriptors] [,number timeout] [,bool write])
<td>checks an array of socket objects or descriptors for read or write ability (default is <i>read</i>), 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
<tr valign=top><td><b>html_encode</b><td>string<td><tt>html_encode(string text [,bool ex_ascii] [,bool white_space] [,bool ansi] [,bool ctrl_a])
<td>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
<tr valign=top><td><b>html_decode</b><td>string<td><tt>html_decode(string text)
<td>return a decoded HTML-encoded text string
<tr valign=top><td><b>word_wrap</b><td>string<td><tt>word_wrap(string text [,line_length])
<td>returns a word-wrapped version of the text string argument, <i>line_length</i> defaults to <i>79</i>
<tr valign=top><td><b>quote_msg</b><td>string<td><tt>quote_msg(string text [,line_length] [,prefix])
<td>returns a quoted version of the message text string argumnet, <i>line_length</i> defaults to <i>79</i>, <i>prefix</i> defaults to <tt>" > "</tt>
<tr valign=top><td><b>rot13_translate</b><td>string<td><tt>rot13_translate(string text)
<td>returns ROT13-translated version of text string (will encode or decode text)
<tr valign=top><td><b>base64_encode</b><td>string<td><tt>base64_encode(string text)
<td>returns base64-encoded version of text string or <i>null</i> on error
<tr valign=top><td><b>base64_decode</b><td>string<td><tt>base64_decode(string text)
<td>returns base64-decoded text string or <i>null</i> on error (not useful for binary data)
<tr valign=top><td><b>crc16_calc</b><td>number<td><tt>crc16_calc(string text)
<td>calculate and return 16-bit CRC of text string
<tr valign=top><td><b>crc32_calc</b><td>number<td><tt>crc32_calc(string text)
<td>calculate and return 32-bit CRC of text string
<tr valign=top><td><b>chksum_calc</b><td>number<td><tt>chksum_calc(string text)
<td>calculate and return 32-bit checksum of text string
<tr valign=top><td><b>md5_calc</b><td>string<td><tt>md5_calc(string text [,bool hex])
<td>calculate and return 128-bit MD5 digest of text string, result encoded in base64 (default) or hexadecimal
<tr valign=top><td><b>resolve_ip</b><td>string<td><tt>resolve_ip(string hostname)
<td>resolve IP address of specified hostname (AKA gethostbyname)
<tr valign=top><td><b>resolve_host</b><td>string<td><tt>resolve_host(string ip_address)
<td>resolve hostname of specified IP address (AKA gethostbyaddr)
</table>
<br>
<table border=1 width=100%>
<caption align=left><b><tt>global</tt>
<a name=global_properties> properties</a>
</b></caption>
<tr bgcolor=gray>
<th align=left width=100>
<font color="white">Name</font>
<th align=left width=100>
<font color="white">Type</font>
<th align=left>
<font color="white">Description</font>
<tr><td><b>argc</b><td>number<td>number of arguments passed to the script</td>
<tr><td><b>argv</b><td>array<td>array of argument strings (argv.length == argc)</td>
<tr><td><b>errno</b><td>number<td>last system error number</td>
<tr><td><b>errno_str</b><td>string<td>description of last system error</td>
</table>
<h2><a name=js>js object</a>
<br><font size=-1>JavaScript execution and garbage collection control object</font>
</h2>
<table border=1 width=100%>
<caption align=left><b><tt>js</tt>
<a name=js_methods> methods</a>
</b></caption>
<tr bgcolor=gray>
<th align=left width=100>
<font color="white">Name</font>
<th align=left width=100>
<font color="white">Returns</font>
<th align=left width=200>
<font color="white">Usage</font>
<th align=left>
<font color="white">Description</font>
<tr valign=top><td><b>eval</b><td>string<td><tt>js.eval(string script)
<td>evaluate a JavaScript string in its own (secure) context, returning the result
<tr valign=top><td><b>gc</b><td>void<td><tt>js.gc(bool forced)
<td>perform a garbage collection operation (freeing memory for unused allocated objects), if <i>forced</i> is <i>true</i> (the default) a garbage collection is always performed, otherwise it is only performed if deemed appropriate by the JavaScript engine
</table>
<br>
<table border=1 width=100%>
<caption align=left><b><tt>js</tt>
<a name=js_properties> properties</a>
</b></caption>
<tr bgcolor=gray>
<th align=left width=100>
<font color="white">Name</font>
<th align=left width=100>
<font color="white">Type</font>
<th align=left>
<font color="white">Description</font>
<tr valign=top><td><b>version</b><td>string
<td>JavaScript engine version information (AKA system.js_version)
<tr valign=top><td><b>auto_terminate</b><td>boolean
<td>set to <i>false</i> to disable the automatic termination of the script upon external request
<tr valign=top><td><b>terminated</b><td>boolean
<td>termination has been requested (stop execution as soon as possible)
<tr valign=top><td><b>branch_counter</b><td>number
<td>number of branch operations performed in this runtime
<tr valign=top><td><b>branch_limit</b><td>number
<td>maximum number of branches, used for infinite-loop detection (0=disabled)
<tr valign=top><td><b>yield_interval</b><td>number
<td>interval of periodic time-slice yields (lower number=higher frequency, 0=disabled)
<tr valign=top><td><b>gc_interval</b><td>number
<td>interval of periodic garbage collection attempts (lower number=higher frequency, 0=disabled)
<tr valign=top><td><b>gc_attempts</b><td>number
<td>number of garbage collections attempted in this runtime - <small>READ ONLY</small>
<tr valign=top><td><b>gc_counter</b><td>number
<td>number of garbage collections performed in this runtime - <small>READ ONLY</small>
<tr valign=top><td><b>gc_last_bytes</b><td>number
<td>number of heap bytes in use after last garbage collection - <small>READ ONLY</small>
<tr valign=top><td><b>bytes</b><td>number
<td>number of heap bytes currently in use - <small>READ ONLY</small>
<tr valign=top><td><b>max_bytes</b><td>number
<td>maximum number of bytes available for heap
</table>
<h2><a name=system>system object</a>
<br><font size=-1>Global system-related properties and methods</font>
</h2>
<table border=1 width=100%>
<caption align=left><b><tt>system</tt>
<a name=system_methods> methods</a>
</b></caption>
<tr bgcolor=gray>
<th align=left width=100>
<font color="white">Name</font>
<th align=left width=100>
<font color="white">Returns</font>
<th align=left width=200>
<font color="white">Usage</font>
<th align=left>
<font color="white">Description</font>
<tr valign=top><td><b>username</b><td>string<td><tt>system.username(number)
<td>returns name of user in specified user record <i>number</i>, or empty string if not found
<tr valign=top><td><b>filter_ip</b><td>boolean<td><tt>system.filter_ip([protocol, reason, host, ip, username])
<td>add an IP address (with comment) to the system's IP filter file
<tr valign=top><td><b>get_node_message</b><td>string<td><tt>system.get_node_message(number node)
<td>read any messages waiting for the specified node and return in a single string
<tr valign=top><td><b>get_telegram</b><td>string<td><tt>system.get_telegram(number user)
<td>returns any short text messages waiting for the specified user
<tr valign=top><td><b>exec</b><td>number<td><tt>system.exec(command-line)
<td>executes a native system/shell command-line, returns <i>0</i> on success
<tr valign=top><td><b>popen</b><td>array<td><tt>system.popen(command-line)
<td>executes a native system/shell command-line, returns array of captured output lines on success (<b>only functional on UNIX systems</b>)
<tr valign=top><td><b>check_syspass</b><td>boolean<td><tt>system.check_syspass(string password)
<td>compares the supplied <i>password</i> against the system password and return's <i>true</i> if it matches
</table>
<br>
<table border=1 width=100%>
<caption align=left><b><tt>system</tt>
<a name=system_properties> properties</a>
</b></caption>
<tr bgcolor=gray>
<th align=left width=100>
<font color="white">Name</font>
<th align=left width=100>
<font color="white">Type</font>
<th align=left>
<font color="white">Description</font>
<tr valign=top><td><b>inet_addr</b><td>string
<td>Internet address (host or domain name)
<tr valign=top><td><b>lastuser</b><td>number
<td>last user record number in user database (includes deleted and inactive user records)
<tr valign=top><td><b>devnull</b><td>string
<td>null device filename
<tr valign=top><td><b>clock_ticks</b><td>number
<td>amount of elapsed processor time in clock 'ticks'
<tr valign=top><td><b>clock_ticks_per_second</b><td>number
<td>number of clock ticks per second
<tr valign=top><td><b>local_host_name</b><td>string
<td>private host name that uniquely identifies this system on the local network
</table>
<h2><a name=server>server object</a>
<br><font size=-1>Server-specifc properties</font>
</h2>
<table border=1 width=100%>
<caption align=left><b><tt>server</tt>
<a name=server_properties> properties</a>
</b></caption>
<tr bgcolor=gray>
<th align=left width=100>
<font color="white">Name</font>
<th align=left width=100>
<font color="white">Type</font>
<th align=left>
<font color="white">Description</font>
<tr valign=top><td><b>interface_ip_address</b><td>string
<td>IP address of bound network interface (<tt>0.0.0.0</tt> = <i>ANY</i>)
<tr valign=top><td><b>options</b><td>number
<td>bit-field of server-specific startup options
<tr valign=top><td><b>clients</b><td>number
<td>number of active clients (if available)
</table>
<h2><a name=client>client object</a>
<br><font size=-1>Represents a TCP/IP client session</font>
</h2>
<h2><a name=user>user object</a>
<br><font size=-1>Instance of <i>User</i> class, representing current user online</font>
</h2>
<p>To create a new user object: <tt>var u = new User(number)</tt></p>
<table border=1 width=100%>
<caption align=left><b><tt>user</tt>
<a name=user_methods> methods</a>
</b></caption>
<tr bgcolor=gray>
<th align=left width=100>
<font color="white">Name</font>
<th align=left width=100>
<font color="white">Returns</font>
<th align=left width=200>
<font color="white">Usage</font>
<th align=left>
<font color="white">Description</font>
</table>
<br>
<table border=1 width=100%>
<caption align=left><b><tt>user</tt>
<a name=user_properties> properties</a>
</b></caption>
<tr bgcolor=gray>
<th align=left width=100>
<font color="white">Name</font>
<th align=left width=100>
<font color="white">Type</font>
<th align=left>
<font color="white">Description</font>
<tr valign=top><td><b>new_file_time</b><td>number
<td>new file scan date/time (time_t format)
</table>
<h2><a name=bbs>bbs object</a>
<br><font size=-1>Controls the Telnet/RLogin BBS experience</font>
</h2>
<table border=1 width=100%>
<caption align=left><b><tt>bbs</tt>
<a name=bbs_methods> methods</a>
</b></caption>
<tr bgcolor=gray>
<th align=left width=100>
<font color="white">Name</font>
<th align=left width=100>
<font color="white">Returns</font>
<th align=left width=200>
<font color="white">Usage</font>
<th align=left>
<font color="white">Description</font>
</table>
<br>
<table border=1 width=100%>
<caption align=left><b><tt>bbs</tt>
<a name=bbs_properties> properties</a>
</b></caption>
<tr bgcolor=gray>
<th align=left width=100>
<font color="white">Name</font>
<th align=left width=100>
<font color="white">Type</font>
<th align=left>
<font color="white">Description</font>
<tr valign=top><td><b>time_left</b><td>number
<td>time left (in seconds)
<tr valign=top><td><b>event_time</b><td>number
<td>time of next exclusive event (in time_t format), or 0 if none
<tr valign=top><td><b>event_code</b><td>string
<td>internal code of next exclusive event
</table>
<h2><a name=console>console object</a>
<br><font size=-1>Controls the user's Telnet/RLogin terminal</font>
</h2>
<table border=1 width=100%>
<caption align=left><b><tt>console</tt>
<a name=console_methods> methods</a>
</b></caption>
<tr bgcolor=gray>
<th align=left width=100>
<font color="white">Name</font>
<th align=left width=100>
<font color="white">Returns</font>
<th align=left width=200>
<font color="white">Usage</font>
<th align=left>
<font color="white">Description</font>
<tr valign=top><td><b>inkey</b><td>string<td><tt>console.inkey([number mode] [,number timeout])
<td>get a single key with optional <i>timeout</i> in milliseconds (defaults to 0, for no wait), see <tt>K_*</tt> in <tt>sbbsdefs.js</tt> for <i>mode</i> bits
<tr valign=top><td><b>home</b><td>void<td><tt>console.home()
<td>send cursor to home position (x,y:1,1)
<tr valign=top><td><b>cleartoeol</b><td>void<td><tt>console.cleartoeol()
<td>clear to end-of-line (ANSI)
<tr valign=top><td><b>beep</b><td>void<td><tt>console.beep([number count])
<td>beep for count number of times (default count is 1)
<tr valign=top><td><b>pushxy</b><td>void<td><tt>console.pushxy()
<td>save current cursor position (AKA ansi_save)
<tr valign=top><td><b>popxy</b><td>void<td><tt>console.popxy()
<td>restore saved cursor position (AKA ansi_restore)
<tr valign=top><td><b>gotoxy</b><td>void<td><tt>console.gotoxy(number x,y)
<td>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 <tt>console.getxy()</tt>)
<tr valign=top><td><b>up</b><td>void<td><tt>console.up([number rows])
<td>Move cursor up one or more rows (ANSI)
<tr valign=top><td><b>down</b><td>void<td><tt>console.down([number rows])
<td>Move cursor down one or more rows (ANSI)
<tr valign=top><td><b>right</b><td>void<td><tt>console.right([number columns])
<td>Move cursor right one or more columns (ANSI)
<tr valign=top><td><b>left</b><td>void<td><tt>console.left([number columns])
<td>Move cursor left one or more columns (ANSI)
<tr valign=top><td><b>getlines</b><td>void<td><tt>console.getlines()
<td>Auto-detect the number of rows/lines on the user's terminal (ANSI)
<tr valign=top><td><b>getxy</b><td>object<td><tt>console.getxy()
<td>Returns the current cursor position as an object (with x and y properties)
<tr valign=top><td><b>handle_ctrlkey</b><td>boolean<td><tt>console.handle_ctrlkey(string key [,number mode])
<td>Call internal control key handler for specified control key, returns true if handled
</table>
<br>
<table border=1 width=100%>
<caption align=left><b><tt>console</tt>
<a name=console_properties> properties</a>
</b></caption>
<tr bgcolor=gray>
<th align=left width=100>
<font color="white">Name</font>
<th align=left width=100>
<font color="white">Type</font>
<th align=left>
<font color="white">Description</font>
<tr valign=top><td><b>screen_columns</b><td>number
<td>number of terminal screen columns (in character cells)
<tr valign=top><td><b>terminal</b><td>string
<td>terminal type description (e.g. 'ANSI')
<tr valign=top><td><b>getstr_offset</b><td>number
<td>cursor position offset for use with <tt>getstr(K_USEOFFSET)</tt>
</table>
<h2><a name=msg_area>msg_area object</a>
<br><font size=-1>Message Areas</font>
</h2>
<h2><a name=file_area>file_area object</a>
<br><font size=-1>File Transfer Areas</font>
</h2>
<h2><a name=xtrn_area>xtrn_area object</a>
<br><font size=-1>External Program Areas</font>
</h2>
<h2><a name=MsgBase>MsgBase class</a>
<br><font size=-1>Class used for accessing message bases</font>
</h2>
<p>To create a new MsgBase object: <tt>var msgbase = new MsgBase('<i>code</i>')</tt><br>where <i>code</i> is a sub-board internal code, or <tt>mail</tt> for the e-mail message base</p>
<table border=1 width=100%>
<caption align=left><b><tt>MsgBase</tt>
<a name=MsgBase_methods> methods</a>
</b></caption>
<tr bgcolor=gray>
<th align=left width=100>
<font color="white">Name</font>
<th align=left width=100>
<font color="white">Returns</font>
<th align=left width=200>
<font color="white">Usage</font>
<th align=left>
<font color="white">Description</font>
<tr valign=top><td><b>get_msg_index</b><td>object<td><tt>MsgBase.get_msg_index([boolean by_offset,] number)
<td>returns a specific message index, <i>null</i> on failure. The index object will contain the following properties:<br><table><tr><td><tt>subject</tt><td>CRC-16 of lowercase message subject<tr><td><tt>to</tt><td>CRC-16 of lowercase recipient's name (or user number if e-mail)<tr><td><tt>from</tt><td>CRC-16 of lowercase sender's name (or user number if e-mail)<tr><td><tt>attr</tt><td>Attribute bitfield<tr><td><tt>time</tt><td>Date/time (in time_t format)<tr><td><tt>number</tt><td>Message number<tr><td><tt>offset</tt><td>Byte-offset into header file</table>
<tr valign=top><td><b>remove_msg</b><td>boolean<td><tt>MsgBase.remove_msg([boolean by_offset,] number_or_id)
<td>mark message as deleted
</table>
<br>
<table border=1 width=100%>
<caption align=left><b><tt>MsgBase</tt>
<a name=MsgBase_properties> properties</a>
</b></caption>
<tr bgcolor=gray>
<th align=left width=100>
<font color="white">Name</font>
<th align=left width=100>
<font color="white">Type</font>
<th align=left>
<font color="white">Description</font>
<tr valign=top><td><b>retry_delay</b><td>number
<td>delay between message base open/lock retries (in milliseconds)
</table>
<h2><a name=File>File class</a>
<br><font size=-1>Class used for opening, creating, reading, or writing files on the local file system<p>Special features include:</h2><ol type=disc><li>Exclusive-access files (default) or shared files<ol type=circle><li>optional record-locking<li>buffered or non-buffered I/O</ol><li>Support for binary files<ol type=circle><li>native or network byte order (endian)<li>automatic Unix-to-Unix (<i>UUE</i>), yEncode (<i>yEnc</i>) or Base64 encoding/decoding</ol><li>Support for ASCII text files<ol type=circle><li>supports line-based I/O<ol type=square><li>entire file may be read or written as an array of strings<li>individual lines may be read or written one line at a time</ol><li>supports fixed-length records<ol type=square><li>optional end-of-text (<i>etx</i>) character for automatic record padding/termination<li>Synchronet <tt>.dat</tt> files use an <i>etx</i> value of 3 (Ctrl-C)</ol><li>supports <tt>.ini</tt> formated configuration files<li>optional ROT13 encoding/translation</ol><li>Dynamically-calculated industry standard checksums (e.g. CRC-16, CRC-32, MD5)</ol></font>
</h2>
<p>To create a new File object: <tt>var f = new File(filename)</tt></p>
<table border=1 width=100%>
<caption align=left><b><tt>File</tt>
<a name=File_methods> methods</a>
</b></caption>
<tr bgcolor=gray>
<th align=left width=100>
<font color="white">Name</font>
<th align=left width=100>
<font color="white">Returns</font>
<th align=left width=200>
<font color="white">Usage</font>
<th align=left>
<font color="white">Description</font>
<tr valign=top><td><b>rewind</b><td>boolean<td><tt>File.rewind()
<td>repositions the file pointer (<i>position</i>) to the beginning of a file and clears error and end-of-file indicators
<tr valign=top><td><b>iniGetSections</b><td>array<td><tt>File.iniGetSections([prefix])
<td>parse all section names from a <tt>.ini</tt> file (format = '<tt>[section]</tt>') and return the section names as an <i>array of strings</i>, optionally, only those section names that begin with the specified <i>prefix</i>
<tr valign=top><td><b>iniGetKeys</b><td>array<td><tt>File.iniGetKeys(section)
<td>parse all key names from the specified <i>section</i> in a <tt>.ini</tt> file and return the key names as an <i>array of strings</i>
<tr valign=top><td><b>iniGetValue</b><td>string<td><tt>File.iniGetValue(section, key [,default])
<td>parse a key from a <tt>.ini</tt> file and return its value (format = '<tt>key = value</tt>'). returns the specified <i>default</i> value if the key or value is missing or invalid. will return a <i>bool</i>, <i>number</i>, <i>string</i>, or an <i>array of strings</i> determined by the type of <i>default</i> value specified
<tr valign=top><td><b>iniGetObject</b><td>object<td><tt>File.iniGetObject(section)
<td>parse an entire section from a .ini file and return all of its keys and values as properties of an object
<tr valign=top><td><b>iniGetAllObjects</b><td>array<td><tt>File.iniGetAllObjects([name_property] [,prefix])
<td>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, <i>name_property</i> is the name of the property to create to contain the section's name (default is <tt>"name"</tt>), the optional <i>prefix</i> has the same use as in the <tt>iniGetSections</tt> method, if a <i>prefix</i> is specified, it is removed from each section's name
</table>
<br>
<table border=1 width=100%>
<caption align=left><b><tt>File</tt>
<a name=File_properties> properties</a>
</b></caption>
<tr bgcolor=gray>
<th align=left width=100>
<font color="white">Name</font>
<th align=left width=100>
<font color="white">Type</font>
<th align=left>
<font color="white">Description</font>
<tr valign=top><td><b>date</b><td>number
<td>last modified date/time (in time_t format)
<tr valign=top><td><b>network_byte_order</b><td>boolean
<td>set to <i>true</i> if binary data is to be written and read in Network Byte Order (big end first)
<tr valign=top><td><b>rot13</b><td>boolean
<td>set to <i>true</i> to enable automatic ROT13 translatation of text
<tr valign=top><td><b>uue</b><td>boolean
<td>set to <i>true</i> to enable automatic Unix-to-Unix encode and decode on <tt>read</tt> and <tt>write</tt> calls
<tr valign=top><td><b>yenc</b><td>boolean
<td>set to <i>true</i> to enable automatic yEnc encode and decode on <tt>read</tt> and <tt>write</tt> calls
<tr valign=top><td><b>base64</b><td>boolean
<td>set to <i>true</i> to enable automatic Base64 encode and decode on <tt>read</tt> and <tt>write</tt> calls
<tr valign=top><td><b>crc16</b><td>number
<td>calculated 16-bit CRC of file contents - <small>READ ONLY</small>
<tr valign=top><td><b>crc32</b><td>number
<td>calculated 32-bit CRC of file contents - <small>READ ONLY</small>
<tr valign=top><td><b>chksum</b><td>number
<td>calculated 32-bit checksum of file contents - <small>READ ONLY</small>
<tr valign=top><td><b>md5_hex</b><td>undefined
<td>calculated 128-bit MD5 digest of file contents as hexadecimal string - <small>READ ONLY</small>
<tr valign=top><td><b>md5_base64</b><td>undefined
<td>calculated 128-bit MD5 digest of file contents as base64-encoded string - <small>READ ONLY</small>
</table>
<h2><a name=Socket>Socket class</a>
<br><font size=-1>Class used for TCP/IP socket communications</font>
</h2>
<p>To create a new Socket object: <tt>load('sockdefs.js'); var s = new Socket(<i>type</i>)</tt><br>where <i>type</i> = <tt>SOCK_STREAM</tt> for TCP (default) or <tt>SOCK_DGRAM</tt> for UDP</p>
<table border=1 width=100%>
<caption align=left><b><tt>Socket</tt>
<a name=Socket_methods> methods</a>
</b></caption>
<tr bgcolor=gray>
<th align=left width=100>
<font color="white">Name</font>
<th align=left width=100>
<font color="white">Returns</font>
<th align=left width=200>
<font color="white">Usage</font>
<th align=left>
<font color="white">Description</font>
<tr valign=top><td><b>bind</b><td>boolean<td><tt>Socket.bind([port] [,ip_address])
<td>bind socket to a TCP or UDP <i>port</i> (number or service name), optionally specifying a network interface (via <i>ip_address</i>)
<tr valign=top><td><b>connect</b><td>boolean<td><tt>Socket.connect(host, port [,timeout])
<td>connect to a remote port (number or service name) on the specified host (IP address or host name), default <i>timeout</i> value is <i>10.0</i> (seconds)
<tr valign=top><td><b>sendBin</b><td>boolean<td><tt>Socket.sendBin(number value [,number bytes])
<td>send a binary integer over the socket, default number of bytes is 4 (32-bits)
<tr valign=top><td><b>recvfrom</b><td>object<td><tt>Socket.recvfrom([bool binary] [,maxlen or int_size])
<td>receive data (string or integer) from a socket (typically UDP)<p>returns object with <i>ip_address</i> and <i>port</i> of sender along with <i>data</i><p><i>binary</i> defaults to <i>false</i>, <i>maxlen</i> defaults to 512 chars, <i>int_size</i> defaults to 4 bytes (32-bits)
<tr valign=top><td><b>recvBin</b><td>number<td><tt>Socket.recvBin([number bytes])
<td>receive a binary integer from the socket, default number of bytes is 4 (32-bits)
</table>
<br>
<table border=1 width=100%>
<caption align=left><b><tt>Socket</tt>
<a name=Socket_properties> properties</a>
</b></caption>
<tr bgcolor=gray>
<th align=left width=100>
<font color="white">Name</font>
<th align=left width=100>
<font color="white">Type</font>
<th align=left>
<font color="white">Description</font>
<tr valign=top><td><b>error</b><td>number
<td>error status for the last socket operation that failed - <small>READ ONLY</small>
<tr valign=top><td><b>is_writeable</b><td>boolean
<td><i>true</i> if socket can accept written data - <small>READ ONLY</small>
<tr valign=top><td><b>network_byte_order</b><td>boolean
<td><i>true</i> if binary data is to be sent in Network Byte Order (big end first), default is <i>true</i>
</table>
<p><small>
Totals: 43 properties, 68 methods
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment