## muDC

### About

muDC is a scripting environment based on the TinyJS ECMAScript interpreter. It uses a plugin-oriented architecture to provide libraries for scripting NMDC and other web services.
Get the latest version from Google Code.

### API reference: Functions

    Base:
    	function mudc_load(file)
    		Evaluates the contents of (file) as a script.
    		The path is relative to the current working directory.

    	function mudc_console(text)
    		Displays (text) on the muDC console.

    	function mudc_reset()
    		Resets the muDC environment and reloads all plugins.

    	function mudc_exit()
    		Closes muDC.

    NMDC Plugin:
    	The library currently keeps one single persistent connection.
    	function nmdc_connect(address, port, nick, pass, share)
    		Connects to a NMDC hub.

    	function nmdc_disconnect()
    		Disconnects from a NMDC hub.

    	function nmdc_say(message)
    		Sends (message) to the main chat of any connected hub.

    	function nmdc_pm(user, message)
    		Sends (message) as a private message to the user (user).

    	function nmdc_connected()
    		Returns 1 if there is a current NMDC connection, or 0 otherwise.

    HTTP Plugin:
    	function http_get(url)
    		Returns the content of (url)
    		This is a blocking operation with a fixed timeout.

    	function http_post(url, data)
    		Returns the content of (url) when (data) is POSTed.
    		(data) should be in the form key1=value1&key2=value2.
    		This is a blocking operation with a fixed timeout.

    	function http_getAuth(domain, port, url, user, pass)
    		Returns the content of http://domain:port/url using authentication.
    		This is a blocking operation with a fixed timeout.

    	function http_escape(text)
    		Returns the result of URL escaping on (text)

    Twitter Library:
    	function twitter_getLatest(user)
    		Returns the latest tweet from the user, or undefined on error.

    uTorrent Library:
    	function utorrent_init(domain, port, user, pass)
    		Prepares for further uTorrent functions.

    	function utorrent_torrents()
    		Retrieves the current list of torrents. See uTorrent for details.

    	function utorrent_addByUrl(url)
    		Adds a torrent by URL.

    SABnzbd Library:
    	function sab_init(host, port, user, pass, apikey)
    		Prepares for further SABnzbd functions.

    	function sab_queue()
    		Retrieves the current SABnzbd queue. See SABnzbd for details.

    	function sab_history()
    		Retrieves the current SABnzbd history. See SABnzbd for details.

    	function sab_addByUrl(url, category)
    		Adds an NZB by URL.

    Cleverbot Library:
    	The library currently keeps one single persistent conversation.
    	function cb_query(message)
    		Sends (message) to cleverbot and awaits a response.

    Standard Library:
    	function md5(data)
    	function eval(data)
    	function trace()
    	function charToInt(char)

### API reference: Callbacks

    Base:
    	To register a function to be called every second:
    		_onTick.push(myScript_function_name);

    NMDC Plugin:
    	To register a function to be called on hub events:
    		function myScript_onMessage(user, text) { ... }
    		_onPublic.push( myScript_onMessage);
    		_onPrivate.push(myScript_onMessage);

### Changelog

    1.3 (2011-10-13)
    ---
      * Add SABnzbd library
      * Add SABnzbd announce support to ut2dc (now DCAnnounce)
      * Add Cleverbot library and sample
      * Add md5(), http_post(), String.fromCharCode()
      * Bugfix: Load plugins from exe directory instead of cwd
      * Bugfix: Always use CRLF in HTTP requests

    1.2 (2011-09-21)
    ---
      * Library autoloading
      * Add uTorrent library and extend base library
      * Added an icon
      * Implemented ut2dc

    1.1 (2011-09-20)
    ---
      * Extract NMDC and HTTP features into DLL plugins
      * Dynamically link with the LGPL TinyJS to preserve licensing

    1.0 (2011-XX-XX)
    ---
      * Completed basic functionality
      * Implemented Array.join, Array.push, String.split for TinyJS
      * First private release

    0.1 (2011-07-06)
    ---
      * Forked from previous projects