
JSJaCConnection (abstract)
===============

This is a somewhat abstract base class. You can't instantiate objects
from it but it provides functionality common to all specific backends
like JSJaCHttpPollingConnection.

boolean: connected()
	checks if connection is connected
	RETURNS: boolean - true if connected, false otherwise

boolean: isPolling()
	whether this connection is using polling
	RETURNS: true if polling is used (thus indicating it makes sense to use
	         setPollInterval)

void: registerHandler(string: event, function: handler)
	register a handler for event. if event happens handler is called.

	PARAMS: event - known events so far: 'message','iq','presence',
                        'ondisconnect', 'onconnect', 'onerror'

	        handler - the function to be called. for events 'message', 'iq'
	                  and 'presence' the handler gets passed an JSJaCPacket 
	                  as argument for processing. 
	                  'onerror' an error node is supplied, e.g.: 
	                  <error code='404' type='cancel'>
	                    <item-not-found xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
	                  </error>

void: send(JSJaCPacket: aJSJaCPacket [, function: callback [, any: arg]])
	appends aJSJaCPacket to send queue. registers callback if given

	PARAMS: aJSJaCPacket - packet to send
	        callback - a callback to call when reply with same id comes in
	                   id is set automatically if none set
	        arg - optional arg to call callback 
	              [callback is called with callback(aJSJaCPacket, arg)]

int: setPollInterval(int: timeout_msec)
	change polling interval to timeout_msec

	PARAMS: timeout_msec
	RETURNS: actual value the polling interval has been set to. 
	         -1 on failure.

JSJaCHttpPollingConnection
==========================
Implements communication with an HTTP Polling Component.

constructor: JSJaCHttpPollingConnection(oArgs[JSON notation!])

	oArgs:= string: httpbase,    # http base address of service to be used
          int:    timerval,     # initial poll interval in msec
          object: oDbg         # typeof Debugger (optional)

void: connect(oArgs[JSON notation!])

	oArgs := string: domain,     # jabber domain
           string: username,   # jabber username
           string: resource,   # resource
           string: pass,       # password

           boolean: register,  # whether to register a new account
                               # (using in-band registration of available) 
                               # [optional]

           string: authtype,   # one of 'sasl' (not implemented), 
                               # 'saslanon' and 'nonsasl' 
                               # [optional, default: nonasl]

           string: anonhost    # hostname of sasl anonymous service 
                               # automagically sets authtype to saslanon
                               # [optional]

void: disconnect()
	disconnects from server

JSJaCHttpBindingConnection
==========================
Implements communication with an HTTP Binding Service (aka Connection Manager).

constructor: JSJaCHttpBindingConnection(oArgs[JSON notation!])

	oArgs:= string: httpbase,    # http base address of service to be used
          int:    timerval,    # initial poll interval in msec
          object: oDbg         # typeof Debugger (optional)

void: connect(oArgs[JSON notation])

	oArgs := string: domain,     # jabber domain
           string: username,   # jabber username
           string: resource,   # resource
           string: pass,       # password

           boolean: register,  # whether to register a new account
                               # (using in-band registration of available) 
                               # [optional, default: false]

           string: host,       # connect host [optional, default: domain]

           int: port,          # port of connect host 
                               # [optional, default: 5222]

           boolean: secure,    # whether to indicate that SSL should be 
                               # used to connect to remote host 
                               # [optional, default: false]

           int: wait           # time in seconds the connection manager 
                               # is allowed to hold an idle request 
                               # [optional, default: 300]


void: disconnect()
	disconnects from server

JSJaCPacket
===========
Abstract base class for jabber packets.

string: pType()
	returns type of top level node (either 'message', 'iq' or 'presence')

JSJaCPacket: setTo(string: to)
JSJaCPacket: setFrom(string: from)
JSJaCPacket: setID(string: id)
JSJaCPacket: setType(string: type)
JSJaCPacket: setXMLLang(string: xmllang)
JSJaCPacket: setXMLNS(string: xmlns)
	setters for common attributes of top level nodes.

	PARAMS: value to set attribute to
	RETURNS: the packet itself again

string: getTo()
string: getFrom()
string: getID()
string: getType()
string: getXMLLang()
string: getXMLNS()
	getters for common attributes of top level nodes

string: xml()
	returns string representation of DOM xml tree

[IMPORTANT NOTE: Usage of getDoc().xml is DEPRECATED as it not
support by browsers other than IE and Mozilla based ones]

DOMDocument: getDoc()
	Returns internal DOMDocument. This is where you can do your own
	stuff like creating new childs and so on. Most notably you would
	use it like follows:

	var iq = new JSJaCIQ();
	iq.setType('get');
	iq.xml() => "<iq type='get'/>"

	query = iq.setQuery('jabber:iq:private');
	iq.xml() => "<iq type='get'><query xmlns='jabber:iq:private' /></iq>'

	query.appendChild(iq.getDoc().createElement('storage')).setAttribute('xmlns','storage:bookmarks');
	iq.xml() => "<iq type='get'><query xmlns='jabber:iq:private'><storage xmlns='storage:bookmarks'></query></iq>'


DOMElement: getNode()
	returns top level node

JSJaCNode: clone()
  returns a (deep) copy of calling packet

JSJaCIQ
=======
An IQ packet

constructor: JSJaCIQ()

JSJaCIQ: setIQ(to,from,type,id)
	convenient method to set some attributes at once

DOMElement: setQuery(string: xmlns)
	creates new query child element. inserts it at top level node and returns it

	PARAMS: xmlns - namespace attribute for query

	RETURNS: DOMElement that has been created

DOMElement: getQuery()
	returns query element

string: getQueryXMLNS()
	returns xmlns attribute of query element

JSJaCPresence
=============
A presence packet

constructor: JSJaCPresence()

JSJaCPresence: setShow(string: show)
	creates 'show' child element and sets its CDATA to show (should be one of 'away','xa','dnd' or 'chat')

JSJaCPresence: setStatus(string: status)
	creates 'status' child element and sets its CDATA to status

JSJaCPresence: setPriority(string: prio)
	creates 'priority' child element and sets its CDATA to prio

JSJaCPresence: setPresence(string: show, string: status, string: prio)
	conveniant method to set some values at once

string: getShow()
string: getStatus()
string: getPriority()
	return value of corresponding element

JSJaCMessage
============
A message packet

JSJaCMessage: setBody(string: body)
	creates 'body' element with value body
JSJaCMessage: setSubject(string: subject)
	creates 'subject' element with value subject

string: getBody()
string: getSubject()
	return value of corresponding element
