xmpp4js-commit Mailing List for xmpp4js: javascript xmpp/jabber library (Page 3)
Status: Beta
Brought to you by:
h-iverson
You can subscribe to this list here.
2008 |
Jan
|
Feb
(18) |
Mar
(1) |
Apr
|
May
(4) |
Jun
(6) |
Jul
(47) |
Aug
(7) |
Sep
|
Oct
|
Nov
|
Dec
|
---|
From: <h-i...@us...> - 2008-07-05 04:52:40
|
Revision: 718 http://xmpp4js.svn.sourceforge.net/xmpp4js/?rev=718&view=rev Author: h-iverson Date: 2008-07-04 21:52:49 -0700 (Fri, 04 Jul 2008) Log Message: ----------- fixed inheritance Modified Paths: -------------- branches/ext-to-dojo/trunk/src/main/javascript/XmppConnection.js branches/ext-to-dojo/trunk/src/main/javascript/transport/BOSH.js Modified: branches/ext-to-dojo/trunk/src/main/javascript/XmppConnection.js =================================================================== --- branches/ext-to-dojo/trunk/src/main/javascript/XmppConnection.js 2008-07-01 20:54:13 UTC (rev 717) +++ branches/ext-to-dojo/trunk/src/main/javascript/XmppConnection.js 2008-07-05 04:52:49 UTC (rev 718) @@ -241,5 +241,5 @@ } } -YAHOO.extend( YAHOO.xmpp4js.Connection, YAHOO.util.Event, YAHOO.xmpp4js.Connection.prototype ); +YAHOO.extend( YAHOO.xmpp4js.Connection, YAHOO.util.EventProvider, YAHOO.xmpp4js.Connection.prototype ); Modified: branches/ext-to-dojo/trunk/src/main/javascript/transport/BOSH.js =================================================================== --- branches/ext-to-dojo/trunk/src/main/javascript/transport/BOSH.js 2008-07-01 20:54:13 UTC (rev 717) +++ branches/ext-to-dojo/trunk/src/main/javascript/transport/BOSH.js 2008-07-05 04:52:49 UTC (rev 718) @@ -522,4 +522,4 @@ } } -YAHOO.extend( YAHOO.xmpp4js.transport.BOSH, YAHOO.util.Event, YAHOO.xmpp4js.transport.BOSH.prototype ); +YAHOO.extend( YAHOO.xmpp4js.transport.BOSH, YAHOO.util.EventProvider, YAHOO.xmpp4js.transport.BOSH.prototype ); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <h-i...@us...> - 2008-07-01 20:54:10
|
Revision: 717 http://xmpp4js.svn.sourceforge.net/xmpp4js/?rev=717&view=rev Author: h-iverson Date: 2008-07-01 13:54:13 -0700 (Tue, 01 Jul 2008) Log Message: ----------- removed old assembly stuff that was refactored to sample client launcher, and reformatted pom.xml Modified Paths: -------------- trunk/pom.xml Removed Paths: ------------- trunk/src/assembler/src.xml Modified: trunk/pom.xml =================================================================== --- trunk/pom.xml 2008-07-01 20:51:21 UTC (rev 716) +++ trunk/pom.xml 2008-07-01 20:54:13 UTC (rev 717) @@ -1,10 +1,8 @@ <?xml version="1.0"?> - <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> - <modelVersion>4.0.0</modelVersion> <groupId>com.soashable.lib</groupId> <artifactId>xmpp4js</artifactId> @@ -16,7 +14,6 @@ on resuability and extensibility, and is naturally heavilly tested. </description> <url>http://xmpp4js.sourceforge.net</url> - <dependencies> <dependency> <groupId>com.prototype</groupId> @@ -24,30 +21,25 @@ <type>javascript</type> <version>1.5.1-SNAPSHOT</version> </dependency> - <dependency> <groupId>com.extjs</groupId> <artifactId>extjs-debug</artifactId> <type>javascript</type> <version>2.0-SNAPSHOT</version> </dependency> - <dependency> <groupId>uk.org.pajhome</groupId> <artifactId>crypto</artifactId> <type>javascript</type> <version>1.0-SNAPSHOT</version> </dependency> - <dependency> <groupId>net.sf.xml4script</groupId> <artifactId>xml4script</artifactId> <type>javascript</type> <version>3.1-SNAPSHOT</version> </dependency> - </dependencies> - <build> <extensions> <extension> @@ -64,10 +56,6 @@ <extensions>true</extensions> <configuration> <descriptor>${basedir}/src/assembler/xmpp4js.xml</descriptor> - <!-- - <compressor>shrinksafe</compressor> - <strip>;;;</strip> - --> <includes> <include>*Test.html</include> </includes> @@ -80,40 +68,10 @@ </browsers> </configuration> <executions> - <!-- - <execution> - <id>compress</id> - <phase>compile</phase> - <goals> - <goal>attach-compressed</goal> - </goals> - </execution> - --> </executions> </plugin> - - <plugin> - <artifactId>maven-assembly-plugin</artifactId> - <configuration> - <attach>false</attach> - <descriptors> - <descriptor>src/assembler/src.xml</descriptor> - </descriptors> - </configuration> - <executions> - <execution> - <id>make-assembly</id> - <phase>package</phase> - <goals> - <goal>assembly</goal> - </goals> - </execution> - - </executions> - </plugin> </plugins> </build> - <reporting> <plugins> <plugin> @@ -137,7 +95,6 @@ --> </plugins> </reporting> - <distributionManagement> <repository> <id>mvn.soashable.com</id> @@ -156,25 +113,21 @@ <url>scp://shell.sourceforge.net/home/groups/x/xm/xmpp4js/htdocs</url> </site> </distributionManagement> - <scm> <connection>scm:svn:http://xmpp4js.svn.sourceforge.net/svnroot/xmpp4js/trunk</connection> <developerConnection>scm:svn:https://xmpp4js.svn.sourceforge.net/svnroot/xmpp4js/trunk</developerConnection> <url>http://xmpp4js.svn.sourceforge.net/viewvc/xmpp4js/</url> </scm> - <licenses> <license> <name>GNU Lesser Public License (LGPL)</name> <url>http://www.gnu.org/licenses/lgpl-3.0.txt</url> </license> </licenses> - <issueManagement> <system>Google Code Issues</system> <url>http://code.google.com/p/soashable/issues/list</url> </issueManagement> - <developers> <developer> <id>h.iverson</id> @@ -183,14 +136,12 @@ <url>http://blog.devspan.com</url> </developer> </developers> - <contributors> <contributor> <name>Matthew Purland</name> <email>m.purland at gmail dot com</email> </contributor> </contributors> - <repositories> <repository> <id>soashable-libs-snapshots</id> @@ -201,10 +152,8 @@ <checksumPolicy>fail</checksumPolicy> </releases> <snapshots> - <updatePolicy>always</updatePolicy> <checksumPolicy>warn</checksumPolicy> </snapshots> </repository> </repositories> - </project> Deleted: trunk/src/assembler/src.xml =================================================================== --- trunk/src/assembler/src.xml 2008-07-01 20:51:21 UTC (rev 716) +++ trunk/src/assembler/src.xml 2008-07-01 20:54:13 UTC (rev 717) @@ -1,26 +0,0 @@ -<assembly> - <id>with-dependencies</id> - <formats> - <format>zip</format> - <format>tar.gz</format> - </formats> - <includeBaseDirectory>true</includeBaseDirectory> - <dependencySets> - <dependencySet> - <outputDirectory>lib</outputDirectory> - <outputFileNameMapping></outputFileNameMapping> - <unpack>true</unpack> - <scope>runtime</scope> - </dependencySet> - </dependencySets> - <fileSets> - <fileSet> - <directory>target/classes</directory> - <outputDirectory></outputDirectory> - </fileSet> - <fileSet> - <directory>src/main/sample</directory> - <outputDirectory>sample</outputDirectory> - </fileSet> - </fileSets> -</assembly> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <h-i...@us...> - 2008-07-01 20:51:15
|
Revision: 716 http://xmpp4js.svn.sourceforge.net/xmpp4js/?rev=716&view=rev Author: h-iverson Date: 2008-07-01 13:51:21 -0700 (Tue, 01 Jul 2008) Log Message: ----------- refactored most of BOSH out into Base and extend BOSH and Script from it Modified Paths: -------------- trunk/src/assembler/xmpp4js.xml trunk/src/main/javascript/transport/BOSH.js trunk/src/main/javascript/transport/Script.js.js Added Paths: ----------- trunk/src/main/javascript/transport/Base.js Modified: trunk/src/assembler/xmpp4js.xml =================================================================== --- trunk/src/assembler/xmpp4js.xml 2008-07-01 18:41:26 UTC (rev 715) +++ trunk/src/assembler/xmpp4js.xml 2008-07-01 20:51:21 UTC (rev 716) @@ -32,6 +32,7 @@ <include>io/PacketCollector.js</include> <include>io/HttpBindingStream.js</include> --> + <include>transport/Base.js</include> <include>transport/BOSH.js</include> <include>transport/Script.js</include> Modified: trunk/src/main/javascript/transport/BOSH.js =================================================================== --- trunk/src/main/javascript/transport/BOSH.js 2008-07-01 18:41:26 UTC (rev 715) +++ trunk/src/main/javascript/transport/BOSH.js 2008-07-01 20:51:21 UTC (rev 716) @@ -36,74 +36,8 @@ * sends empty body if both are empty */ Xmpp4Js.Transport.BOSH = function(config) { - /** - * The domain of the server you're connecting to. * @private - */ - this.domain = config.domain; - /** - * The hostname or IP of the server to route to. defaults to domain. - * @private - */ - this.server = config.server || config.domain; - /** - * The port to route to. defaults to 5222 - * @private - */ - this.port = config.port || 5222; - /** - * The time to wait for a response from the server, in seconds. defaults to 60 and can be adjusted by server. - * @private - */ - this.wait = config.wait || 60; - - /** - * Picked up by Observable. - * @private - */ - this.listeners = config.listeners; - - - /** - * This is set to true when the session creation response is - * received and it was successful. - * - * @private - */ - this.isSessionOpen = false; - - /** - * @type Ext.util.TaskRunner - * @private - */ - this.taskRunner = new Ext.util.TaskRunner(); - - /** - * @private - */ - this.sendQueueTask = { - scope: this, - run: this.sendQueue, - interval: 500 - }; - - /** - * @private - */ - this.sendPollTask = { - scope: this, - run: this.sendPoll, - interval: 500 - }; - - /** - * @private - */ - this.queue = []; - - /** - * @private * @type String */ this.endpoint = config.endpoint; @@ -120,100 +54,8 @@ */ this.openRequestCount = 0; - /** - * The session ID sent by the server. - * @private - */ - this.sid = null; + var superConfig = config; - /** - * The request ID set in beginSession, and cleared in endSession - * @private - */ - this.rid = null; - - /** - * The keysequence object - * @private - */ - this.keySeq = null; - - /** - * The max number of requests that can be open at once, sent by the server - * @private - */ - this.maxRequests = null; - - /** - * The max number of requests that the server will keep open, sent by the server. - * Typically this is maxRequests - 1. - * @private - */ - this.hold = null; - - var superConfig = Ext.apply( config, { - - }); - - - this.addEvents({ - /** - * @event recv - * @param {DomElement} the body element of the node received. - * - * A packet node has been received. Typically cline code will register - * its recv handlers in response to the sessionStarted event and remove - * them in response to the sessionEnded and termerror events. - */ - recv : true, - - - /** - * @event write - * @param {DomElement} the body element of the node about to be written. - * - * A packet node is about to be written. It includes all frame data, but - * the event is fired just before the open request count is incremented. - */ - write : true, - - - /** - * @event error - * @param {DomElement} the body element of the node received. - * - * A non-terminal error has occured. Connection is not necisarily closed. - */ - error : true, - - /** - * @event termerror - * @param {String} title - * @param {String} message - * @param {DomElement} the body element of the node received. - * - * Raised when the session is been forcibly closed due to an error. - * Client code should remove any recv handlers here (should we remove?) - */ - termerror : true, - - /** - * @event sessionStarted - * - * Raised when the session has successfully be started. Clients should - * register recv handlers here. - */ - beginsession : true, - - /** - * @event sessionEnded - * - * Raised when the session has been closed (voluntarily). Client code - * should remove any recv handlers here (should we forcibly remove all?). - */ - endsession: true - }); - Xmpp4Js.Transport.BOSH.superclass.constructor.call( this, superConfig ); } @@ -237,110 +79,7 @@ }); }, - /** - * Send a session creation request, and if it is successfully responded to - * then mark the session open and start the sendQueueTask. - */ - beginSession: function() { - this.rid = this.createInitialRid(); - - var packetNode = this.createPacketNode(); - packetNode.setAttribute( "wait", this.wait ); - packetNode.setAttribute( "to", this.domain ); - packetNode.setAttribute( "route", "xmpp:" + this.server + ":" + this.port); - packetNode.setAttribute( "ver", "1.6"); - packetNode.setAttribute( "xml:lang", "en"); - packetNode.setAttribute( "xmlns:xmpp", "urn:xmpp:xbosh"); - packetNode.setAttribute( "xmpp:version", "1.0" ); - - - this.on("recv", this.onBeginSessionResponse, this, {single:true}); - - this.write( packetNode ); - }, - - /** - * Callback to the beginSession packet (recv event). - * - * @param {DomElement} packetNode - * @private - */ - onBeginSessionResponse: function(packetNode) { - // HACK single doesn't seem to work... - //this.un("recv", arguments.callee /* the current function */, this ); - - - this.sid = packetNode.getAttribute( "sid" ).toString(); - this.maxRequests = packetNode.getAttribute( "requests" ).toString(); - - if( packetNode.hasAttribute("hold") ) { - this.hold = packetNode.getAttribute("hold").toString(); - } else { - // sensible default - this.hold = packetNode.maxRequests - 1; - } - - if( packetNode.hasAttribute("wait") ) { - // FIXME ideally xhr's timeout should be updated - this.wait = packetNode.getAttribute("wait").toString(); - } - - this.startup(); - - this.fireEvent( "beginsession" ); - }, - - /** - * Set isSessionOpen to true and start sendQueue and sendPoll tasks - * @private - */ - startup: function() { - this.isSessionOpen = true; - this.taskRunner.start( this.sendQueueTask ); - this.taskRunner.start( this.sendPollTask ); - - }, - - /** - * Send a terminate message, mark the sesion as closed, and stop the polling task. - */ - endSession: function() { - var packetNode = this.createPacketNode(); - packetNode.setAttribute( "type", "terminate" ); - - // TODO we could be civil and append any remaining packets in the queue here. - - this.shutdown(); - - this.write( packetNode ); - - this.fireEvent( "endsession" ); - }, - - /** - * Set isSessionOpen to false and stop sendQueue and sendPoll tasks - * @private - */ - shutdown: function() { - this.isSessionOpen = false; - this.taskRunner.stop( this.sendQueueTask ); - this.taskRunner.stop( this.sendPollTask ); - }, - - /** - * Send a packet as soon as possible. If the session is not currently open, - * packets will queue up until it is. - * - * Should it throw an error if not currently open? - * - * @param {DomElement} node - */ - send: function(node) { - this.queue.push( node ); - }, - - /** * Immediately write a raw packet node to the wire. Adds frame data including * RID, SID and Key if they are present. * @@ -352,14 +91,9 @@ * @param {DomElement} packetNode */ write: function(packetNode) { + this.prepareWrite( packetNode ); - this.addFrameData( packetNode ); - var xml = packetNode.toString(); - - this.fireEvent( "write", packetNode ); - - this.openRequestCount++; this.xhr.request({ xmlData: xml, @@ -445,130 +179,7 @@ } else { this.fireEvent( "recv", packetNode ); } - }, - - /** - * Create an empty packet node in the httpbind namespace. - * @private - * @return {DomElement} a body element with the correct namespace and basic attributes - */ - createPacketNode: function() { - var packetNode = DomBuilder.node( "body", { - xmlns: "http://jabber.org/protocol/httpbind" - } - ); - - return packetNode; - }, - - /** - * Write a blank node if there is no data waiting and no requests open. - * @private - */ - sendPoll: function() { - if( this.openRequestCount == 0 && this.queue.length == 0 ) { - var packetNode = this.createPacketNode(); - this.write( packetNode ); - } - }, - - /** - * Pull all packets off the queue; first-in, first-out; and send them - * within the body of a single packet. Don't send if # open requests - * is greater than max requests. - * - * @private - */ - sendQueue: function() { - // don't send anything if there is no work to do. - if( this.queue.length == 0 || this.openRequestCount > this.maxRequests ) { - return; - } - - var packetNode = this.createPacketNode(); - - while( this.queue.length > 0 ) { - var node = this.queue.shift(); - var importedNode = packetNode.ownerDocument.importNode( node, true ); - - packetNode.appendChild( importedNode ); - } - - this.write( packetNode ); - }, - - /** - * Add sid attribute to a packet, if there is one. - * @param {Element} packetNode - * @private - */ - addSid: function( packetNode ) { - if( this.sid !== null ) { - packetNode.setAttribute( "sid", this.sid ); - } - }, - - /** - * Add rid attribute to a packet, if there is one. - * @param {Element} packetNode - * @private - */ - addRid: function( packetNode ) { - if( this.rid !== null ) { - packetNode.setAttribute( "rid", this.rid++ ); - } - }, - - /** - * Add the key attribute to the request, and if needed, - * generate a new sequence and add the newkey attribute. - * @param {Element} packetNode - * @private - */ - addKey: function( packetNode ) { - if( this.keySeq instanceof KeySequence ) { - var keySeq = this.keySeq; - - var isFirstKey = keySeq.isFirstKey(); - var isLastKey = keySeq.isLastKey(); - var key = keySeq.getNextKey(); - - // if it's the first key, use ONLY the newkey attribute. - if( isFirstKey ) { - packetNode.setAttribute( "newkey", key ); - } else { - packetNode.setAttribute( "key", key ); - } - - // if it's the last key, reset the KeySequence and add a newkey attribute. - if( isLastKey ) { -;;; console.info( "Resetting KeySequence" ); - keySeq.reset(); - - var newKey = keySeq.getNextKey(); - packetNode.setAttribute( "newkey", newKey ); - } - } - - }, - - /** - * Add RID, SID and Key to a packet node. Calls each respective function. - * @private - */ - addFrameData: function(packetNode) { - this.addRid( packetNode ); - this.addSid( packetNode ); - this.addKey( packetNode ); - }, - - /** - * Generate a random number to be used as the initial request ID. - * @private - */ - createInitialRid: function() { - return Math.floor( Math.random() * 10000 ); } } -Ext.extend( Xmpp4Js.Transport.BOSH, Ext.util.Observable, Xmpp4Js.Transport.BOSH.prototype ); +Ext.extend( Xmpp4Js.Transport.BOSH, Xmpp4Js.Transport.Base, Xmpp4Js.Transport.BOSH.prototype ); Added: trunk/src/main/javascript/transport/Base.js =================================================================== --- trunk/src/main/javascript/transport/Base.js (rev 0) +++ trunk/src/main/javascript/transport/Base.js 2008-07-01 20:51:21 UTC (rev 716) @@ -0,0 +1,462 @@ +Ext.namespace( "Xmpp4Js.Transport" ); + +/** + * Functionality that needs testing: + * write: + * sid + * no sid on first request + * always present after session has started + * rid + * always present + * starts random + * sequential + * rollover at int limit + * key + * present / not present if it should be + * first, middle, last, first (init with length 3) + * + * beginSession: + * rid, no sid, correct attributes + * error if called when open + * event is raised + * + * endSession: + * terminate type and correct attributes are present + * error if called while not open + * event is raised + * + * send: + * error before beginSession or after endSession + * multible nodes are combined to make one request + * number of open requests > max open requets + * + * polling: + * doesn't send if there is an open request + * doesn't send if there are items in the queue + * sends empty body if both are empty + */ +Xmpp4Js.Transport.Base = function(config) { + + /** + * The domain of the server you're connecting to. + * @private + */ + this.domain = config.domain; + /** + * The hostname or IP of the server to route to. defaults to domain. + * @private + */ + this.server = config.server || config.domain; + /** + * The port to route to. defaults to 5222 + * @private + */ + this.port = config.port || 5222; + /** + * The time to wait for a response from the server, in seconds. defaults to 60 and can be adjusted by server. + * @private + */ + this.wait = config.wait || 60; + + /** + * Picked up by Observable. + * @private + */ + this.listeners = config.listeners; + + + /** + * This is set to true when the session creation response is + * received and it was successful. + * + * @private + */ + this.isSessionOpen = false; + + /** + * @type Ext.util.TaskRunner + * @private + */ + this.taskRunner = new Ext.util.TaskRunner(); + + /** + * @private + */ + this.sendQueueTask = { + scope: this, + run: this.sendQueue, + interval: 500 + }; + + /** + * @private + */ + this.sendPollTask = { + scope: this, + run: this.sendPoll, + interval: 500 + }; + + /** + * @private + */ + this.queue = []; + + /** + * The session ID sent by the server. + * @private + */ + this.sid = null; + + /** + * The request ID set in beginSession, and cleared in endSession + * @private + */ + this.rid = null; + + /** + * The keysequence object + * @private + */ + this.keySeq = null; + + /** + * The max number of requests that can be open at once, sent by the server + * @private + */ + this.maxRequests = null; + + /** + * The max number of requests that the server will keep open, sent by the server. + * Typically this is maxRequests - 1. + * @private + */ + this.hold = null; + + var superConfig = config; + + + this.addEvents({ + /** + * @event recv + * @param {DomElement} the body element of the node received. + * + * A packet node has been received. Typically cline code will register + * its recv handlers in response to the sessionStarted event and remove + * them in response to the sessionEnded and termerror events. + */ + recv : true, + + + /** + * @event write + * @param {DomElement} the body element of the node about to be written. + * + * A packet node is about to be written. It includes all frame data, but + * the event is fired just before the open request count is incremented. + */ + write : true, + + + /** + * @event error + * @param {DomElement} the body element of the node received. + * + * A non-terminal error has occured. Connection is not necisarily closed. + */ + error : true, + + /** + * @event termerror + * @param {String} title + * @param {String} message + * @param {DomElement} the body element of the node received. + * + * Raised when the session is been forcibly closed due to an error. + * Client code should remove any recv handlers here (should we remove?) + */ + termerror : true, + + /** + * @event sessionStarted + * + * Raised when the session has successfully be started. Clients should + * register recv handlers here. + */ + beginsession : true, + + /** + * @event sessionEnded + * + * Raised when the session has been closed (voluntarily). Client code + * should remove any recv handlers here (should we forcibly remove all?). + */ + endsession: true + }); + + Xmpp4Js.Transport.Base.superclass.constructor.call( this, superConfig ); + +} + +Xmpp4Js.Transport.Base.prototype = { + + + /** + * Send a session creation request, and if it is successfully responded to + * then mark the session open and start the sendQueueTask. + */ + beginSession: function() { + this.rid = this.createInitialRid(); + + var packetNode = this.createPacketNode(); + packetNode.setAttribute( "wait", this.wait ); + packetNode.setAttribute( "to", this.domain ); + packetNode.setAttribute( "route", "xmpp:" + this.server + ":" + this.port); + packetNode.setAttribute( "ver", "1.6"); + packetNode.setAttribute( "xml:lang", "en"); + packetNode.setAttribute( "xmlns:xmpp", "urn:xmpp:xbosh"); + packetNode.setAttribute( "xmpp:version", "1.0" ); + + + this.on("recv", this.onBeginSessionResponse, this, {single:true}); + + this.write( packetNode ); + }, + + /** + * Callback to the beginSession packet (recv event). + * + * @param {DomElement} packetNode + * @private + */ + onBeginSessionResponse: function(packetNode) { + // HACK single doesn't seem to work... + //this.un("recv", arguments.callee /* the current function */, this ); + + + this.sid = packetNode.getAttribute( "sid" ).toString(); + this.maxRequests = packetNode.getAttribute( "requests" ).toString(); + + if( packetNode.hasAttribute("hold") ) { + this.hold = packetNode.getAttribute("hold").toString(); + } else { + // sensible default + this.hold = packetNode.maxRequests - 1; + } + + if( packetNode.hasAttribute("wait") ) { + // FIXME ideally xhr's timeout should be updated + this.wait = packetNode.getAttribute("wait").toString(); + } + + this.startup(); + + this.fireEvent( "beginsession" ); + }, + + /** + * Set isSessionOpen to true and start sendQueue and sendPoll tasks + * @private + */ + startup: function() { + this.isSessionOpen = true; + this.taskRunner.start( this.sendQueueTask ); + this.taskRunner.start( this.sendPollTask ); + + }, + + /** + * Send a terminate message, mark the sesion as closed, and stop the polling task. + */ + endSession: function() { + var packetNode = this.createPacketNode(); + packetNode.setAttribute( "type", "terminate" ); + + // TODO we could be civil and append any remaining packets in the queue here. + + this.shutdown(); + + this.write( packetNode ); + + this.fireEvent( "endsession" ); + }, + + /** + * Set isSessionOpen to false and stop sendQueue and sendPoll tasks + * @private + */ + shutdown: function() { + this.isSessionOpen = false; + this.taskRunner.stop( this.sendQueueTask ); + this.taskRunner.stop( this.sendPollTask ); + }, + + /** + * Send a packet as soon as possible. If the session is not currently open, + * packets will queue up until it is. + * + * Should it throw an error if not currently open? + * + * @param {DomElement} node + */ + send: function(node) { + this.queue.push( node ); + }, + + prepareWrite: function(packetNode) { + this.addFrameData( packetNode ); + this.fireEvent( "write", packetNode ); + + this.openRequestCount++; + }, + + /** + * Immediately write a raw packet node to the wire. Adds frame data including + * RID, SID and Key if they are present. + * + * Also increments the openRequestCount, which is then decremented in the + * onWriteResponse method. + * + * A possible addition could be to add a "no headers" flag. + * + * @param {DomElement} packetNode + */ + write: function(packetNode) { + throw new Error( "write: Not Implemented" ); + }, + + /** + * Handles the response to a write call. + * + * Decrements the openRequestCount that was incremented in write. + * @private + */ + onWriteResponse: function() { + throw new Error( "onWriteResponse: Not Implemented" ); + }, + + /** + * Create an empty packet node in the httpbind namespace. + * @private + * @return {DomElement} a body element with the correct namespace and basic attributes + */ + createPacketNode: function() { + var packetNode = DomBuilder.node( "body", { + xmlns: "http://jabber.org/protocol/httpbind" + } + ); + + return packetNode; + }, + + /** + * Write a blank node if there is no data waiting and no requests open. + * @private + */ + sendPoll: function() { + if( this.openRequestCount == 0 && this.queue.length == 0 ) { + var packetNode = this.createPacketNode(); + this.write( packetNode ); + } + }, + + /** + * Pull all packets off the queue; first-in, first-out; and send them + * within the body of a single packet. Don't send if # open requests + * is greater than max requests. + * + * @private + */ + sendQueue: function() { + // don't send anything if there is no work to do. + if( this.queue.length == 0 || this.openRequestCount > this.maxRequests ) { + return; + } + + var packetNode = this.createPacketNode(); + + while( this.queue.length > 0 ) { + var node = this.queue.shift(); + var importedNode = packetNode.ownerDocument.importNode( node, true ); + + packetNode.appendChild( importedNode ); + } + + this.write( packetNode ); + }, + + /** + * Add sid attribute to a packet, if there is one. + * @param {Element} packetNode + * @private + */ + addSid: function( packetNode ) { + if( this.sid !== null ) { + packetNode.setAttribute( "sid", this.sid ); + } + }, + + /** + * Add rid attribute to a packet, if there is one. + * @param {Element} packetNode + * @private + */ + addRid: function( packetNode ) { + if( this.rid !== null ) { + packetNode.setAttribute( "rid", this.rid++ ); + } + }, + + /** + * Add the key attribute to the request, and if needed, + * generate a new sequence and add the newkey attribute. + * @param {Element} packetNode + * @private + */ + addKey: function( packetNode ) { + if( this.keySeq instanceof KeySequence ) { + var keySeq = this.keySeq; + + var isFirstKey = keySeq.isFirstKey(); + var isLastKey = keySeq.isLastKey(); + var key = keySeq.getNextKey(); + + // if it's the first key, use ONLY the newkey attribute. + if( isFirstKey ) { + packetNode.setAttribute( "newkey", key ); + } else { + packetNode.setAttribute( "key", key ); + } + + // if it's the last key, reset the KeySequence and add a newkey attribute. + if( isLastKey ) { +;;; console.info( "Resetting KeySequence" ); + keySeq.reset(); + + var newKey = keySeq.getNextKey(); + packetNode.setAttribute( "newkey", newKey ); + } + } + + }, + + /** + * Add RID, SID and Key to a packet node. Calls each respective function. + * @private + */ + addFrameData: function(packetNode) { + this.addRid( packetNode ); + this.addSid( packetNode ); + this.addKey( packetNode ); + }, + + /** + * Generate a random number to be used as the initial request ID. + * @private + */ + createInitialRid: function() { + return Math.floor( Math.random() * 10000 ); + } +} + +Ext.extend( Xmpp4Js.Transport.Base, Ext.util.Observable, Xmpp4Js.Transport.Base.prototype ); Modified: trunk/src/main/javascript/transport/Script.js.js =================================================================== --- trunk/src/main/javascript/transport/Script.js.js 2008-07-01 18:41:26 UTC (rev 715) +++ trunk/src/main/javascript/transport/Script.js.js 2008-07-01 20:51:21 UTC (rev 716) @@ -54,15 +54,8 @@ */ write: function(packetNode) { - this.addFrameData( packetNode ); + this.prepareWrite( packetNode ); - var xml = packetNode.toString(); - - this.fireEvent( "write", packetNode ); - - this.openRequestCount++; - - // TODO check for max length constraints in browsers var requestUrl = "http://"+this.server+":"+this.port+"/"+this.endpoint+"?body="+xml; var scriptElem = document.createElement( "script" ); @@ -93,4 +86,4 @@ } } -Ext.extend( Xmpp4Js.Transport.Script, Xmpp4Js.Transport.BOSH, Xmpp4Js.Transport.Script.prototype ); +Ext.extend( Xmpp4Js.Transport.Script, Xmpp4Js.Transport.Base, Xmpp4Js.Transport.Script.prototype ); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <h-i...@us...> - 2008-07-01 18:41:22
|
Revision: 715 http://xmpp4js.svn.sourceforge.net/xmpp4js/?rev=715&view=rev Author: h-iverson Date: 2008-07-01 11:41:26 -0700 (Tue, 01 Jul 2008) Log Message: ----------- started migrating events Modified Paths: -------------- branches/ext-to-dojo/trunk/src/main/javascript/BayeuxXmppClient.js branches/ext-to-dojo/trunk/src/main/javascript/XmppConnection.js branches/ext-to-dojo/trunk/src/main/javascript/chat/ChatManager.js branches/ext-to-dojo/trunk/src/main/javascript/transport/BOSH.js Modified: branches/ext-to-dojo/trunk/src/main/javascript/BayeuxXmppClient.js =================================================================== --- branches/ext-to-dojo/trunk/src/main/javascript/BayeuxXmppClient.js 2008-06-30 17:07:42 UTC (rev 714) +++ branches/ext-to-dojo/trunk/src/main/javascript/BayeuxXmppClient.js 2008-07-01 18:41:26 UTC (rev 715) @@ -55,7 +55,7 @@ listener(packet); } }; - this.on( "recv", wrappedListener, this); + this.subscribe( "recv", wrappedListener, this, true); return wrappedListener; }, Modified: branches/ext-to-dojo/trunk/src/main/javascript/XmppConnection.js =================================================================== --- branches/ext-to-dojo/trunk/src/main/javascript/XmppConnection.js 2008-06-30 17:07:42 UTC (rev 714) +++ branches/ext-to-dojo/trunk/src/main/javascript/XmppConnection.js 2008-07-01 18:41:26 UTC (rev 715) @@ -25,32 +25,9 @@ }); - this.addEvents({ - /** - * The connection is open and ready for normal packets to be exchanged. - */ - connect: true, - /** - * The connection was clsoed either forcibly or voluntarily. error - * will be fired preceeding close if it was an forced termination. - */ - close: true, - /** - * An error was received from the server. If the error is terminal, - * the close event will be fired in succession - * - * TODO I don't like changing the order of the last three params - * from termerror, or that regular error doesn't have them. Then - * again, the goal is to not propagate recoverable error this far - * anyway. - * - * @param {Boolean} terminal - * @param {DomElement} packetNode - * @param {String} title - * @param {String} message - */ - error: true - }); + this.createEvent( "connect" ); + this.createEvent( "close" ); + this.createEvent( "error" ); /** * Picked up by Observable. @@ -243,10 +220,7 @@ startup: function() { this.connected = true; - this.transport.on({ - scope: this, - recv: this.onRecv - }); + this.transport.subscribe("recv", this.onRecv, this, true); this.fireEvent( "connect" ); }, @@ -267,5 +241,5 @@ } } -YAHOO.extend( YAHOO.xmpp4js.Connection, Ext.util.Observable, YAHOO.xmpp4js.Connection.prototype ); +YAHOO.extend( YAHOO.xmpp4js.Connection, YAHOO.util.Event, YAHOO.xmpp4js.Connection.prototype ); Modified: branches/ext-to-dojo/trunk/src/main/javascript/chat/ChatManager.js =================================================================== --- branches/ext-to-dojo/trunk/src/main/javascript/chat/ChatManager.js 2008-06-30 17:07:42 UTC (rev 714) +++ branches/ext-to-dojo/trunk/src/main/javascript/chat/ChatManager.js 2008-07-01 18:41:26 UTC (rev 715) @@ -119,7 +119,7 @@ this.fireEvent("chatStarted", chat); if( listener instanceof Function ) { - chat.on( "messageReceived", listener ); + chat.subscribe( "messageReceived", listener ); } return chat; Modified: branches/ext-to-dojo/trunk/src/main/javascript/transport/BOSH.js =================================================================== --- branches/ext-to-dojo/trunk/src/main/javascript/transport/BOSH.js 2008-06-30 17:07:42 UTC (rev 714) +++ branches/ext-to-dojo/trunk/src/main/javascript/transport/BOSH.js 2008-07-01 18:41:26 UTC (rev 715) @@ -157,63 +157,12 @@ }); - this.addEvents({ - /** - * @event recv - * @param {DomElement} the body element of the node received. - * - * A packet node has been received. Typically cline code will register - * its recv handlers in response to the sessionStarted event and remove - * them in response to the sessionEnded and termerror events. - */ - recv : true, - - - /** - * @event write - * @param {DomElement} the body element of the node about to be written. - * - * A packet node is about to be written. It includes all frame data, but - * the event is fired just before the open request count is incremented. - */ - write : true, - - - /** - * @event error - * @param {DomElement} the body element of the node received. - * - * A non-terminal error has occured. Connection is not necisarily closed. - */ - error : true, - - /** - * @event termerror - * @param {String} title - * @param {String} message - * @param {DomElement} the body element of the node received. - * - * Raised when the session is been forcibly closed due to an error. - * Client code should remove any recv handlers here (should we remove?) - */ - termerror : true, - - /** - * @event sessionStarted - * - * Raised when the session has successfully be started. Clients should - * register recv handlers here. - */ - beginsession : true, - - /** - * @event sessionEnded - * - * Raised when the session has been closed (voluntarily). Client code - * should remove any recv handlers here (should we forcibly remove all?). - */ - endsession: true - }); + this.createEvent( "recv" ); + this.createEvent( "write" ); + this.createEvent( "error" ); + this.createEvent( "termerror" ); + this.createEvent( "beginsession" ); + this.createEvent( "endsession" ); YAHOO.xmpp4js.transport.BOSH.superclass.constructor.call( this, superConfig ); @@ -256,7 +205,8 @@ packetNode.setAttribute( "xmpp:version", "1.0" ); - this.on("recv", this.onBeginSessionResponse, this, {single:true}); + // FIXME single:true + this.on("recv", this.onBeginSessionResponse, this, true); this.write( packetNode ); }, @@ -572,4 +522,4 @@ } } -YAHOO.extend( YAHOO.xmpp4js.transport.BOSH, Ext.util.Observable, YAHOO.xmpp4js.transport.BOSH.prototype ); +YAHOO.extend( YAHOO.xmpp4js.transport.BOSH, YAHOO.util.Event, YAHOO.xmpp4js.transport.BOSH.prototype ); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <h-i...@us...> - 2008-06-22 09:35:48
|
Revision: 711 http://xmpp4js.svn.sourceforge.net/xmpp4js/?rev=711&view=rev Author: h-iverson Date: 2008-06-21 19:06:44 -0700 (Sat, 21 Jun 2008) Log Message: ----------- added start of Alternative Script Syntax transport... does not work. Modified Paths: -------------- trunk/src/assembler/xmpp4js.xml Added Paths: ----------- trunk/src/main/javascript/transport/Script.js.js Modified: trunk/src/assembler/xmpp4js.xml =================================================================== --- trunk/src/assembler/xmpp4js.xml 2008-06-14 19:03:15 UTC (rev 710) +++ trunk/src/assembler/xmpp4js.xml 2008-06-22 02:06:44 UTC (rev 711) @@ -33,6 +33,7 @@ <include>io/HttpBindingStream.js</include> --> <include>transport/BOSH.js</include> + <include>transport/Script.js</include> <!-- packet filter --> <include>PacketFilter.js</include> Added: trunk/src/main/javascript/transport/Script.js.js =================================================================== --- trunk/src/main/javascript/transport/Script.js.js (rev 0) +++ trunk/src/main/javascript/transport/Script.js.js 2008-06-22 02:06:44 UTC (rev 711) @@ -0,0 +1,96 @@ +Ext.namespace( "Xmpp4Js.Transport" ); + +/** + * Functionality that needs testing: + * write: + * sid + * no sid on first request + * always present after session has started + * rid + * always present + * starts random + * sequential + * rollover at int limit + * key + * present / not present if it should be + * first, middle, last, first (init with length 3) + * + * beginSession: + * rid, no sid, correct attributes + * error if called when open + * event is raised + * + * endSession: + * terminate type and correct attributes are present + * error if called while not open + * event is raised + * + * send: + * error before beginSession or after endSession + * multible nodes are combined to make one request + * number of open requests > max open requets + * + * polling: + * doesn't send if there is an open request + * doesn't send if there are items in the queue + * sends empty body if both are empty + */ +Xmpp4Js.Transport.Script = function(config) { + Xmpp4Js.Transport.Script.superclass.constructor.call( this, config ); +} + +Xmpp4Js.Transport.Script.prototype = { + + /** + * Immediately write a raw packet node to the wire. Adds frame data including + * RID, SID and Key if they are present. + * + * Also increments the openRequestCount, which is then decremented in the + * onWriteResponse method. + * + * A possible addition could be to add a "no headers" flag. + * + * @param {DomElement} packetNode + */ + write: function(packetNode) { + + this.addFrameData( packetNode ); + + var xml = packetNode.toString(); + + this.fireEvent( "write", packetNode ); + + this.openRequestCount++; + + + // TODO check for max length constraints in browsers + var requestUrl = "http://"+this.server+":"+this.port+"/"+this.endpoint+"?body="+xml; + var scriptElem = document.createElement( "script" ); + scriptElem.setAttribute( "type", "text/javascript" ); + scriptElem.setAttribute( "src", requestUrl ); + + // TODO handle multiple connections... + window._BOSH_ = function(xml) { + this.handleResponse(); + }.bind(this); + + document.body.appendChild( scriptElem ); + }, + + /** + * Handles the response to a write call. + * + * Decrements the openRequestCount that was incremented in write. + * @private + */ + onWriteResponse: function( xml ) { + this.openRequestCount--; + + // TODO character replacement (18.3)? + + var packetNode = new DOMImplementation().loadXML( xml ).documentElement; + this.fireEvent( "recv", packetNode ); + } +} + +Ext.extend( Xmpp4Js.Transport.Script, Xmpp4Js.Transport.BOSH, Xmpp4Js.Transport.Script.prototype ); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <h-i...@us...> - 2008-06-22 07:52:14
|
Revision: 713 http://xmpp4js.svn.sourceforge.net/xmpp4js/?rev=713&view=rev Author: h-iverson Date: 2008-06-21 19:30:01 -0700 (Sat, 21 Jun 2008) Log Message: ----------- Creating experimental Dojo port branch Added Paths: ----------- branches/ext-to-dojo/trunk/ Copied: branches/ext-to-dojo/trunk (from rev 712, trunk) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <h-i...@us...> - 2008-06-22 03:06:32
|
Revision: 712 http://xmpp4js.svn.sourceforge.net/xmpp4js/?rev=712&view=rev Author: h-iverson Date: 2008-06-21 19:29:55 -0700 (Sat, 21 Jun 2008) Log Message: ----------- [Netbeans SVN client generated message: create a new folder for the copy]: ' Creating experimental Dojo port branch ' Added Paths: ----------- branches/ext-to-dojo/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <h-i...@us...> - 2008-06-14 19:03:10
|
Revision: 710 http://xmpp4js.svn.sourceforge.net/xmpp4js/?rev=710&view=rev Author: h-iverson Date: 2008-06-14 12:03:15 -0700 (Sat, 14 Jun 2008) Log Message: ----------- added code samples Modified Paths: -------------- trunk/src/site/site.xml Added Paths: ----------- trunk/src/site/xdoc/ trunk/src/site/xdoc/code-samples.xml Modified: trunk/src/site/site.xml =================================================================== --- trunk/src/site/site.xml 2008-06-12 05:42:12 UTC (rev 709) +++ trunk/src/site/site.xml 2008-06-14 19:03:15 UTC (rev 710) @@ -47,7 +47,7 @@ <item name="Download" href="https://sourceforge.net/project/showfiles.php?group_id=209465"/> </menu> <menu name="Developer Docs"> - + <item name="Code Samples" href="code-samples.html"/> <item name="BOSH Environment" href="bosh-environment.html"/> <item name="The HACKING File" href="hacking.html"/> <item name="XEP-0124 (BOSH)" href="http://www.xmpp.org/extensions/xep-0124.html"/> Added: trunk/src/site/xdoc/code-samples.xml =================================================================== --- trunk/src/site/xdoc/code-samples.xml (rev 0) +++ trunk/src/site/xdoc/code-samples.xml 2008-06-14 19:03:15 UTC (rev 710) @@ -0,0 +1,256 @@ +<document> + <properties> + <author email="h.i...@gm...">Harlan Iverson</author> + <title>Code Samples</title> + </properties> + + <body> + <!-- The body of the document contains a number of sections --> + <section name="Core"> + + +<subsection name="Create a connection"> +<pre name="code" class="javascript"><![CDATA[ +var con = new JabberConnection( "/http-bind/", "soashable.com" ); +con.beginSession(); +]]></pre> +</subsection> + +<subsection name="Close a connection"> +<pre name="code" class="javascript"><![CDATA[ +con.endSession(); +]]></pre> +</subsection> + +<subsection name="Login"> +<pre name="code" class="javascript"><![CDATA[ +con.authenticateMd5( "username", "password", "resource" ); +]]></pre> +</subsection> + +<subsection name="Register"> +<pre name="code" class="javascript"><![CDATA[ +var reg = new Packet.Registration(); +reg.setNode( "myjid" ); +reg.setPassword( "mypass" ); +reg.setEmail( "som...@so..." ); +reg.setName( "My Name" ); + +con.send( reg ); +]]></pre> +</subsection> + +<subsection name="Send an IM"> +<pre name="code" class="javascript"><![CDATA[ +var msg = new Packet.Message("som...@so...", "hello"); +con.send( msg ); +]]></pre> +</subsection> + +<subsection name="Suspend a connection"> +<p>... can't do it yet ...</p> +</subsection> + +<subsection name="Resume a connection"> +<p>... can't do it yet ...</p> +</subsection> + + + + </section> + <section name="Privacy, Presence"> + + +<subsection name="Change my presence"> +<pre name="code" class="javascript"><![CDATA[ +var pres = new Packet.Presence( "available", "dnd" ); +]]></pre> +</subsection> + +<subsection name="Change my presence for only a specific buddy"> +<pre name="code" class="javascript"><![CDATA[ +var pres = new Packet.Presence( "available", "dnd" ); +pres.setTo( "bu...@so..." ); +]]></pre> +</subsection> + +<subsection name="Capture others' presence"> +<pre name="code" class="javascript"><![CDATA[ +con.addPacketListener( function(presence) { + var from = presence.getFrom(); + var type = presence.getType(); + var status = presence.getStatus(); + var awayMsg = presence.getShow(); + if( type == "available" ) { + alert( from + " is " + status + "; show=" + awayMsg ); + } else { + alert( from + " is offline." ); + } +}, new PacketTypeFilter( Packet.Presence ) ); +]]></pre> +</subsection> + +<subsection name="Add a buddy"> +<pre name="code" class="javascript"><![CDATA[ +var roster = con.getRoster(); +roster.createEntry( "my...@so...", "My Buddy", ["group a", "group b"] ); +]]></pre> +</subsection> + +<subsection name="Remove a buddy"> +<p>... there is no way right now. ouch...</p> +</subsection> + +<subsection name="Confirm/Deny a request to be added as a buddy"> +<pre name="code" class="javascript"><![CDATA[ +con.addPacketListener( function(presence) { + if( presence.getType() == "subscribe" ) { + var allowed = confirm( "Do you want to let " + presence.getTo() + " subscribe to your presence?"); + var outPres = new Packet.Presence( "subscribed" ); + outPres.setTo( presence.getFrom() ); + con.send( outPres ); + } +}, new PacketTypeFilter( Packet.Presence ) ); +]]></pre> +</subsection> + + </section> + <section name="Events, Listeners"> + +<subsection name="Be notified of message events (composing) "> +<pre name="code" class="javascript"><![CDATA[ +con.addPacketListener( + function(msg) { + // load extensions that are present in the packet using our ExtensionProvider + msg.loadExtensions(extensionProvider); + + var msgEvent = msg.getExtension( MessageEventExtension.XMLNS ); + alert( "Message Event: " + msg.getTo() + " - " + msgEvent .getEvent() ); + + }, + // capture only Message packets with MessageEventExtension + new AndFilter( + new PacketTypeFilter( Packet.Message ), + new ExtensionFilter( MessageEventExtension.XMLNS ) + ) +); +]]></pre> +</subsection> + +<subsection name="Respond to version requests"> +<pre name="code" class="javascript"><![CDATA[ +con.addPacketListener( function(iq) { + var versionIq = new Packet.IQ( iq.getFrom(), "set", "jabber:iq:version" ); + versionIq.getQuery().textContent = "Rockin' Jabber Client"; + con.send( versionIq ); +}, new IQQueryNSFilter ( "jabber:iq:version" ) ); +]]></pre> +</subsection> + + + </section> + <section name="Extensions"> + + +<subsection name="Sign in to AIM"> +<pre name="code" class="javascript"><![CDATA[ +TransportHelper.registerForAim( "aim.im.soashable.com", "screen name", "password" ); +]]></pre> + +<p>-or-</p> + +<pre name="code" class="javascript"><![CDATA[ +var reg = new Packet.Registration(); +reg.setTo( "aim.soashable.com" ); +reg.setNode( "aimscreenname" ); +reg.setPassword( "mypass" ); + +con.send( reg ); +]]></pre> + +</subsection> + +<subsection name="Store private data"> +<pre name="code" class="javascript"><![CDATA[ +var ds = con.getDataStorage(); +ds.set( "mycompany:greeting", "Hello", "greeting" ); +]]></pre> +</subsection> + +<subsection name="Retrieve private data"> +<pre name="code" class="javascript"><![CDATA[ +var ds = con.getDataStorage(); +ds.get( "mycompany:greeting", function(responseNodes ) { + var greeting = responseNodes[0].textContent; + alert( greeting ); +}, "greeting" ); +]]></pre> +</subsection> + + + </section> + <section name="Conference"> + +<subsection name="Join a Multi-User Chat (MUC) "> +<pre name="code" class="javascript"><![CDATA[ +var extProvider = ...; +var mucMan = MucManager.getInstanceFor( con, "conference.soashable.com", extProvider ); + +// get info about a room and create a state to act with +var room = mucMan.getRoom( "soashable" ).createState(); + +// join with the nick "harlan2" +room.join( "harlan2" ); +]]></pre> +</subsection> + +<subsection name="Get the status of a Join "> +<pre name="code" class="javascript"><![CDATA[ +// use extjs's Ext.util.Observable for registering events +room.on({ + join: function(room, participant, packet) { }, + error: function(room, participant, packet) { + console.dirxml( packet.getExtension( ErrorExtension.XMLNS ).getNode() ); + }, +}); + +room.join( "harlan2" ); +]]></pre> +</subsection> + +<subsection name="Send Message to a MUC "> +<pre name="code" class="javascript"><![CDATA[ +room.sendText( "Hello, MUC!" ); +]]></pre> +</subsection> + +<subsection name="List Occupants "> +<pre name="code" class="javascript"><![CDATA[ +// getting participants happens asynchronously, so it +// does NOT simply return a list. +room.getParticipants(function(room, participants) { + console.dir( participants ); +}); +]]></pre> +</subsection> + +<subsection name="Leave a MUC "> +<pre name="code" class="javascript"><![CDATA[ +room.part(); +]]></pre> +</subsection> + + +<subsection name="Getting a list of MUCs "> +<pre name="code" class="javascript"><![CDATA[ +mucMan.getRoomList(function(mucMan, rooms) { + console.dir( rooms ); +}); +]]></pre> +</subsection> + + + </section> + + </body> +</document> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <h-i...@us...> - 2008-06-12 05:42:05
|
Revision: 709 http://xmpp4js.svn.sourceforge.net/xmpp4js/?rev=709&view=rev Author: h-iverson Date: 2008-06-11 22:42:12 -0700 (Wed, 11 Jun 2008) Log Message: ----------- lies... they aren't in the theme. but they are instead links rather than menu items Modified Paths: -------------- trunk/src/site/site.xml Modified: trunk/src/site/site.xml =================================================================== --- trunk/src/site/site.xml 2008-06-12 05:39:36 UTC (rev 708) +++ trunk/src/site/site.xml 2008-06-12 05:42:12 UTC (rev 709) @@ -35,6 +35,13 @@ </poweredBy> <body> + <links> + <item name="Soashable" href="http://soashable.sourceforge.net"/> + <item name="Xmpp4Js" href="http://xmpp4js.sourceforge.net"/> + <item name="Live Demo" href="http://www.soashable.com/" /> + <item name="Blog" href="http://soashable.blogspot.com/" /> + </links> + <menu name="About Xmpp4Js"> <item name="Introduction" href="index.html"/> <item name="Download" href="https://sourceforge.net/project/showfiles.php?group_id=209465"/> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <h-i...@us...> - 2008-06-12 05:39:28
|
Revision: 708 http://xmpp4js.svn.sourceforge.net/xmpp4js/?rev=708&view=rev Author: h-iverson Date: 2008-06-11 22:39:36 -0700 (Wed, 11 Jun 2008) Log Message: ----------- removed project links to reflect them being in the skin Modified Paths: -------------- trunk/src/site/site.xml Modified: trunk/src/site/site.xml =================================================================== --- trunk/src/site/site.xml 2008-05-24 18:19:17 UTC (rev 707) +++ trunk/src/site/site.xml 2008-06-12 05:39:36 UTC (rev 708) @@ -35,12 +35,6 @@ </poweredBy> <body> - - <menu name="Projects"> - <item name="Soashable" href="http://soashable.sourceforge.net"/> - <item name="Xmpp4Js" href="http://xmpp4js.sourceforge.net"/> - </menu> - <menu name="About Xmpp4Js"> <item name="Introduction" href="index.html"/> <item name="Download" href="https://sourceforge.net/project/showfiles.php?group_id=209465"/> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <h-i...@us...> - 2008-05-24 18:19:09
|
Revision: 707 http://xmpp4js.svn.sourceforge.net/xmpp4js/?rev=707&view=rev Author: h-iverson Date: 2008-05-24 11:19:17 -0700 (Sat, 24 May 2008) Log Message: ----------- was getting error about attaching two artifacts, so I removed the compressed one Modified Paths: -------------- trunk/pom.xml Modified: trunk/pom.xml =================================================================== --- trunk/pom.xml 2008-05-18 19:39:40 UTC (rev 706) +++ trunk/pom.xml 2008-05-24 18:19:17 UTC (rev 707) @@ -80,6 +80,7 @@ </browsers> </configuration> <executions> + <!-- <execution> <id>compress</id> <phase>compile</phase> @@ -87,6 +88,7 @@ <goal>attach-compressed</goal> </goals> </execution> + --> </executions> </plugin> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <h-i...@us...> - 2008-05-18 19:39:44
|
Revision: 706 http://xmpp4js.svn.sourceforge.net/xmpp4js/?rev=706&view=rev Author: h-iverson Date: 2008-05-18 12:39:40 -0700 (Sun, 18 May 2008) Log Message: ----------- fixed distribution management Modified Paths: -------------- trunk/pom.xml Modified: trunk/pom.xml =================================================================== --- trunk/pom.xml 2008-05-17 19:41:03 UTC (rev 705) +++ trunk/pom.xml 2008-05-18 19:39:40 UTC (rev 706) @@ -140,13 +140,13 @@ <repository> <id>mvn.soashable.com</id> <url> - http://mvn.soashable.com/artifactory/libs-releases + http://mvn.soashable.com:8180/artifactory/libs-snapshots </url> </repository> <snapshotRepository> <id>mvn.soashable.com</id> <url> - http://mvn.soashable.com/artifactory/libs-snapshots + http://mvn.soashable.com:8180/artifactory/libs-snapshots </url> </snapshotRepository> <site> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <h-i...@us...> - 2008-05-17 19:41:10
|
Revision: 705 http://xmpp4js.svn.sourceforge.net/xmpp4js/?rev=705&view=rev Author: h-iverson Date: 2008-05-17 12:41:03 -0700 (Sat, 17 May 2008) Log Message: ----------- make use of the soashable project theme Modified Paths: -------------- trunk/src/site/site.xml Modified: trunk/src/site/site.xml =================================================================== --- trunk/src/site/site.xml 2008-05-07 03:01:32 UTC (rev 704) +++ trunk/src/site/site.xml 2008-05-17 19:41:03 UTC (rev 705) @@ -16,13 +16,31 @@ --> <project name="${project.name}"> - <bannerRight> - <name>SourceForge.net Logo</name> - <src>http://sflogo.sourceforge.net/sflogo.php?group_id=209465&type=5</src> - <href>http://sourceforge.net</href> - </bannerRight> + + <skin> + <groupId>com.soashable</groupId> + <artifactId>soashable-site-theme</artifactId> + <version>1.0-SNAPSHOT</version> + </skin> + + <poweredBy> + <logo + name="SourceForge.net Logo" + img="http://sflogo.sourceforge.net/sflogo.php?group_id=217403&type=1" + href="http://sourceforge.net"/> + <logo + name="Built By Maven" + img="images/logos/maven-feather.png" + href="http://maven.apache.org/"/> + </poweredBy> + + <body> - <body> + <menu name="Projects"> + <item name="Soashable" href="http://soashable.sourceforge.net"/> + <item name="Xmpp4Js" href="http://xmpp4js.sourceforge.net"/> + </menu> + <menu name="About Xmpp4Js"> <item name="Introduction" href="index.html"/> <item name="Download" href="https://sourceforge.net/project/showfiles.php?group_id=209465"/> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <h-i...@us...> - 2008-05-07 03:01:28
|
Revision: 704 http://xmpp4js.svn.sourceforge.net/xmpp4js/?rev=704&view=rev Author: h-iverson Date: 2008-05-06 20:01:32 -0700 (Tue, 06 May 2008) Log Message: ----------- accept untyped messages (default = normal) Modified Paths: -------------- trunk/src/main/javascript/chat/ChatManager.js Modified: trunk/src/main/javascript/chat/ChatManager.js =================================================================== --- trunk/src/main/javascript/chat/ChatManager.js 2008-03-28 06:18:09 UTC (rev 703) +++ trunk/src/main/javascript/chat/ChatManager.js 2008-05-07 03:01:32 UTC (rev 704) @@ -83,7 +83,7 @@ */ _handleMessageReceived : function( messagePacket ) { - if( messagePacket.getType() != "normal" && messagePacket.getType() != "chat" ) { + if( messagePacket.getType() != "" && messagePacket.getType() != "normal" && messagePacket.getType() != "chat" ) { return; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <h-i...@us...> - 2008-03-28 06:18:03
|
Revision: 703 http://xmpp4js.svn.sourceforge.net/xmpp4js/?rev=703&view=rev Author: h-iverson Date: 2008-03-27 23:18:09 -0700 (Thu, 27 Mar 2008) Log Message: ----------- use domain in textbox rather than soashable.com. oops. Modified Paths: -------------- xmpp4js-launcher/src/main/webapp/simpleclient.html Modified: xmpp4js-launcher/src/main/webapp/simpleclient.html =================================================================== --- xmpp4js-launcher/src/main/webapp/simpleclient.html 2008-02-29 03:42:08 UTC (rev 702) +++ xmpp4js-launcher/src/main/webapp/simpleclient.html 2008-03-28 06:18:09 UTC (rev 703) @@ -81,7 +81,7 @@ // actually connec to soashable.com. it doesn't matter what your BOSH // server is. - this.con.connect( "soashable.com" ); + this.con.connect( this.loginForm.domain.value ); this.logMessage( "Connecting..." ); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <h-i...@us...> - 2008-02-29 03:42:12
|
Revision: 702 http://xmpp4js.svn.sourceforge.net/xmpp4js/?rev=702&view=rev Author: h-iverson Date: 2008-02-28 19:42:08 -0800 (Thu, 28 Feb 2008) Log Message: ----------- changed output filename Modified Paths: -------------- xmpp4js-launcher/src/assembler/src.xml Modified: xmpp4js-launcher/src/assembler/src.xml =================================================================== --- xmpp4js-launcher/src/assembler/src.xml 2008-02-28 21:19:57 UTC (rev 701) +++ xmpp4js-launcher/src/assembler/src.xml 2008-02-29 03:42:08 UTC (rev 702) @@ -1,5 +1,4 @@ <assembly> - <id>launcher</id> <includeBaseDirectory>true</includeBaseDirectory> <baseDirectory>xmpp4js-launcher</baseDirectory> <formats> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <h-i...@us...> - 2008-02-28 21:19:56
|
Revision: 701 http://xmpp4js.svn.sourceforge.net/xmpp4js/?rev=701&view=rev Author: h-iverson Date: 2008-02-28 13:19:57 -0800 (Thu, 28 Feb 2008) Log Message: ----------- added README and changed version to 0.2-SNAPSHOT Modified Paths: -------------- xmpp4js-launcher/pom.xml xmpp4js-launcher/src/assembler/src.xml Added Paths: ----------- xmpp4js-launcher/README Property Changed: ---------------- xmpp4js-launcher/ Property changes on: xmpp4js-launcher ___________________________________________________________________ Name: svn:ignore + target Added: xmpp4js-launcher/README =================================================================== --- xmpp4js-launcher/README (rev 0) +++ xmpp4js-launcher/README 2008-02-28 21:19:57 UTC (rev 701) @@ -0,0 +1,5 @@ +This project provides a Jetty runtime to experiment with Xmpp4Js. + +To begin, execute run.bat and point your browser to http://localhost:8080 + +The simpleclient.html is editable in-place without restarting Jetty. \ No newline at end of file Modified: xmpp4js-launcher/pom.xml =================================================================== --- xmpp4js-launcher/pom.xml 2008-02-28 18:09:23 UTC (rev 700) +++ xmpp4js-launcher/pom.xml 2008-02-28 21:19:57 UTC (rev 701) @@ -8,7 +8,7 @@ <modelVersion>4.0.0</modelVersion> <groupId>com.soashable.lib</groupId> <artifactId>xmpp4js-launcher</artifactId> - <version>1.0-SNAPSHOT</version> + <version>0.2-SNAPSHOT</version> <packaging>war</packaging> <name>Xmpp4Js Sample Client Launcher</name> Modified: xmpp4js-launcher/src/assembler/src.xml =================================================================== --- xmpp4js-launcher/src/assembler/src.xml 2008-02-28 18:09:23 UTC (rev 700) +++ xmpp4js-launcher/src/assembler/src.xml 2008-02-28 21:19:57 UTC (rev 701) @@ -1,8 +1,9 @@ <assembly> - <id>with-dependencies</id> - <includeBaseDirectory>false</includeBaseDirectory> + <id>launcher</id> + <includeBaseDirectory>true</includeBaseDirectory> + <baseDirectory>xmpp4js-launcher</baseDirectory> <formats> - <format>dir<!-- for debugging, zip/tar.gz for release --></format> + <format>zip</format> </formats> <dependencySets> @@ -22,14 +23,17 @@ <directory>src/main/launcher</directory> <outputDirectory></outputDirectory> </fileSet> + <fileSet> + <directory>target/${artifactId}-${version}</directory> + <outputDirectory>webapps/root</outputDirectory> + </fileSet> </fileSets> + <files> - <file> - <source>target/xmpp4js-launcher-1.0-SNAPSHOT.war</source> - <outputDirectory>webapps</outputDirectory> - <destName>root.war</destName> - </file> + <file> + <source>README</source> + <outputDirectory></outputDirectory> + </file> </files> - </assembly> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <h-i...@us...> - 2008-02-28 18:09:26
|
Revision: 700 http://xmpp4js.svn.sourceforge.net/xmpp4js/?rev=700&view=rev Author: h-iverson Date: 2008-02-28 10:09:23 -0800 (Thu, 28 Feb 2008) Log Message: ----------- Initial import. Added Paths: ----------- xmpp4js-launcher/.project xmpp4js-launcher/pom.xml xmpp4js-launcher/src/ xmpp4js-launcher/src/assembler/ xmpp4js-launcher/src/assembler/src.xml xmpp4js-launcher/src/main/ xmpp4js-launcher/src/main/javascript/ xmpp4js-launcher/src/main/launcher/ xmpp4js-launcher/src/main/launcher/etc/ xmpp4js-launcher/src/main/launcher/etc/jetty.xml xmpp4js-launcher/src/main/launcher/etc/webdefault.xml xmpp4js-launcher/src/main/launcher/logs/ xmpp4js-launcher/src/main/launcher/run.bat xmpp4js-launcher/src/main/webapp/ xmpp4js-launcher/src/main/webapp/WEB-INF/ xmpp4js-launcher/src/main/webapp/WEB-INF/web.xml xmpp4js-launcher/src/main/webapp/simpleclient.html Added: xmpp4js-launcher/.project =================================================================== --- xmpp4js-launcher/.project (rev 0) +++ xmpp4js-launcher/.project 2008-02-28 18:09:23 UTC (rev 700) @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>xmpp4js-launcher</name> + <comment></comment> + <projects> + <project>xmpp4js</project> + </projects> + <buildSpec> + </buildSpec> + <natures> + </natures> +</projectDescription> Added: xmpp4js-launcher/pom.xml =================================================================== --- xmpp4js-launcher/pom.xml (rev 0) +++ xmpp4js-launcher/pom.xml 2008-02-28 18:09:23 UTC (rev 700) @@ -0,0 +1,93 @@ +<?xml version="1.0"?> + +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 +http://maven.apache.org/maven-v4_0_0.xsd"> + + <modelVersion>4.0.0</modelVersion> + <groupId>com.soashable.lib</groupId> + <artifactId>xmpp4js-launcher</artifactId> + <version>1.0-SNAPSHOT</version> + <packaging>war</packaging> + + <name>Xmpp4Js Sample Client Launcher</name> + <description>Xmpp4Js Sample Client Launcher</description> + <url>http://xmpp4js.sourceforge.net</url> + + <build> + <extensions> + <extension> + <groupId>org.codehaus.mojo.javascript</groupId> + <artifactId>javascript-maven-extensions</artifactId> + <version>1.0-alpha-1-SNAPSHOT</version> + </extension> + </extensions> + <plugins> + <plugin> + <artifactId>maven-assembly-plugin</artifactId> + <configuration> + <attach>false</attach> + <descriptors> + <descriptor>src/assembler/src.xml</descriptor> + </descriptors> + </configuration> + <executions> + <execution> + <id>make-assembly</id> + <phase>package</phase> + <goals> + <goal>assembly</goal> + </goals> + </execution> + </executions> + </plugin> + <plugin> + <groupId>org.codehaus.mojo.javascript</groupId> + <artifactId>javascript-maven-plugin</artifactId> + <version>1.0-alpha-1-SNAPSHOT</version> + <extensions>true</extensions> + <executions> + <execution> + <goals> + <goal>war-package</goal> + </goals> + </execution> + </executions> + </plugin> + </plugins> + </build> + + <dependencies> + <dependency> + <groupId>org.mortbay.jetty</groupId> + <artifactId>jetty</artifactId> + <version>6.1.7</version> + </dependency> + <dependency> + <groupId>org.mortbay.jetty</groupId> + <artifactId>start</artifactId> + <version>6.1.7</version> + </dependency> + <dependency> + <groupId>org.mortbay.jetty</groupId> + <artifactId>jetty-util</artifactId> + <version>6.1.7</version> + </dependency> + + <dependency> + <groupId>com.soashable.lib</groupId> + <artifactId>xmpp4js</artifactId> + <version>0.2-SNAPSHOT</version> + <type>javascript</type> + </dependency> + <dependency> + <groupId>org.jabber.JabberHTTPBind</groupId> + <artifactId>jhb</artifactId> + <version>1.0-SNAPSHOT</version> + </dependency> + </dependencies> + + + +</project> Added: xmpp4js-launcher/src/assembler/src.xml =================================================================== --- xmpp4js-launcher/src/assembler/src.xml (rev 0) +++ xmpp4js-launcher/src/assembler/src.xml 2008-02-28 18:09:23 UTC (rev 700) @@ -0,0 +1,35 @@ +<assembly> + <id>with-dependencies</id> + <includeBaseDirectory>false</includeBaseDirectory> + <formats> + <format>dir<!-- for debugging, zip/tar.gz for release --></format> + </formats> + + <dependencySets> + <dependencySet> + <outputDirectory>lib</outputDirectory> + <useTransitiveFiltering>true</useTransitiveFiltering> + <includes> + <include>org.mortbay.jetty:jetty</include> + <include>org.mortbay.jetty:jetty-util</include> + <include>org.mortbay.jetty:start</include> + </includes> + <outputFileNameMapping>${artifactId}.${extension}</outputFileNameMapping> + </dependencySet> + </dependencySets> + <fileSets> + <fileSet> + <directory>src/main/launcher</directory> + <outputDirectory></outputDirectory> + </fileSet> + </fileSets> + <files> + <file> + <source>target/xmpp4js-launcher-1.0-SNAPSHOT.war</source> + <outputDirectory>webapps</outputDirectory> + <destName>root.war</destName> + </file> + </files> + + +</assembly> \ No newline at end of file Added: xmpp4js-launcher/src/main/launcher/etc/jetty.xml =================================================================== --- xmpp4js-launcher/src/main/launcher/etc/jetty.xml (rev 0) +++ xmpp4js-launcher/src/main/launcher/etc/jetty.xml 2008-02-28 18:09:23 UTC (rev 700) @@ -0,0 +1,187 @@ +<?xml version="1.0"?> +<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd"> + +<!-- =============================================================== --> +<!-- Configure the Jetty Server --> +<!-- --> +<!-- Documentation of this file format can be found at: --> +<!-- http://docs.codehaus.org/display/JETTY/jetty.xml --> +<!-- --> +<!-- =============================================================== --> + + +<Configure id="Server" class="org.mortbay.jetty.Server"> + + <!-- =========================================================== --> + <!-- Server Thread Pool --> + <!-- =========================================================== --> + <Set name="ThreadPool"> + <!-- Default bounded blocking threadpool + --> + <New class="org.mortbay.thread.BoundedThreadPool"> + <Set name="minThreads">10</Set> + <Set name="maxThreads">250</Set> + <Set name="lowThreads">25</Set> + </New> + + <!-- Optional Java 5 bounded threadpool with job queue + <New class="org.mortbay.thread.concurrent.ThreadPool"> + <Set name="corePoolSize">250</Set> + <Set name="maximumPoolSize">250</Set> + </New> + --> + </Set> + + + + <!-- =========================================================== --> + <!-- Set connectors --> + <!-- =========================================================== --> + <!-- One of each type! --> + <!-- =========================================================== --> + + <!-- Use this connector for many frequently idle connections + and for threadless continuations. + --> + <Call name="addConnector"> + <Arg> + <New class="org.mortbay.jetty.nio.SelectChannelConnector"> + <Set name="host"><SystemProperty name="jetty.host" /></Set> + <Set name="port"><SystemProperty name="jetty.port" default="8080"/></Set> + <Set name="maxIdleTime">30000</Set> + <Set name="Acceptors">2</Set> + <Set name="statsOn">false</Set> + <Set name="confidentialPort">8443</Set> + <Set name="lowResourcesConnections">5000</Set> + <Set name="lowResourcesMaxIdleTime">5000</Set> + </New> + </Arg> + </Call> + + <!-- Use this connector if NIO is not available. + <Call name="addConnector"> + <Arg> + <New class="org.mortbay.jetty.bio.SocketConnector"> + <Set name="port">8081</Set> + <Set name="maxIdleTime">50000</Set> + <Set name="lowResourceMaxIdleTime">1500</Set> + </New> + </Arg> + </Call> + --> + + <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - --> + <!-- To add a HTTPS SSL listener --> + <!-- see jetty-ssl.xml to add an ssl connector. use --> + <!-- java -jar start.jar etc/jetty.xml etc/jetty-ssl.xml --> + <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - --> + + <!-- =========================================================== --> + <!-- Set up global session ID manager --> + <!-- =========================================================== --> + <!-- + <Set name="sessionIdManager"> + <New class="org.mortbay.jetty.servlet.HashSessionIdManager"> + <Set name="workerName">node1</Set> + </New> + </Set> + --> + + <!-- =========================================================== --> + <!-- Set handler Collection Structure --> + <!-- =========================================================== --> + <Set name="handler"> + <New id="Handlers" class="org.mortbay.jetty.handler.HandlerCollection"> + <Set name="handlers"> + <Array type="org.mortbay.jetty.Handler"> + <Item> + <New id="Contexts" class="org.mortbay.jetty.handler.ContextHandlerCollection"/> + </Item> + <Item> + <New id="DefaultHandler" class="org.mortbay.jetty.handler.DefaultHandler"/> + </Item> + <Item> + <New id="RequestLog" class="org.mortbay.jetty.handler.RequestLogHandler"/> + </Item> + </Array> + </Set> + </New> + </Set> + + <!-- =========================================================== --> + <!-- Configure the context deployer --> + <!-- A context deployer will deploy contexts described in --> + <!-- configuration files discovered in a directory. --> + <!-- The configuration directory can be scanned for hot --> + <!-- deployments at the configured scanInterval. --> + <!-- --> + <!-- This deployer is configured to deploy contexts configured --> + <!-- in the $JETTY_HOME/contexts directory --> + <!-- --> + <!-- =========================================================== --> + <Call name="addLifeCycle"> + <Arg> + <New class="org.mortbay.jetty.deployer.ContextDeployer"> + <Set name="contexts"><Ref id="Contexts"/></Set> + <Set name="configurationDir"><SystemProperty name="jetty.home" default="."/>/contexts</Set> + <Set name="scanInterval">1</Set> + </New> + </Arg> + </Call> + + <!-- =========================================================== --> + <!-- Configure the webapp deployer. --> + <!-- A webapp deployer will deploy standard webapps discovered --> + <!-- in a directory at startup, without the need for additional --> + <!-- configuration files. It does not support hot deploy or --> + <!-- non standard contexts (see ContextDeployer above). --> + <!-- --> + <!-- This deployer is configured to deploy webapps from the --> + <!-- $JETTY_HOME/webapps directory --> + <!-- --> + <!-- Normally only one type of deployer need be used. --> + <!-- --> + <!-- =========================================================== --> + <Call name="addLifeCycle"> + <Arg> + <New class="org.mortbay.jetty.deployer.WebAppDeployer"> + <Set name="contexts"><Ref id="Contexts"/></Set> + <Set name="webAppDir"><SystemProperty name="jetty.home" default="."/>/webapps</Set> + <Set name="parentLoaderPriority">false</Set> + <Set name="extract">true</Set> + <Set name="allowDuplicates">false</Set> + <Set name="defaultsDescriptor"><SystemProperty name="jetty.home" default="."/>/etc/webdefault.xml</Set> + </New> + </Arg> + </Call> + + <!-- =========================================================== --> + <!-- Configure Request Log --> + <!-- Request logs may be configured for the entire server here, --> + <!-- or they can be configured for a specific web app in a --> + <!-- contexts configuration (see $(jetty.home)/contexts/test.xml --> + <!-- for an example). --> + <!-- =========================================================== --> + <Ref id="RequestLog"> + <Set name="requestLog"> + <New id="RequestLogImpl" class="org.mortbay.jetty.NCSARequestLog"> + <Set name="filename"><SystemProperty name="jetty.logs" default="./logs"/>/yyyy_mm_dd.request.log</Set> + <Set name="filenameDateFormat">yyyy_MM_dd</Set> + <Set name="retainDays">90</Set> + <Set name="append">true</Set> + <Set name="extended">true</Set> + <Set name="logCookies">false</Set> + <Set name="LogTimeZone">GMT</Set> + </New> + </Set> + </Ref> + + <!-- =========================================================== --> + <!-- extra options --> + <!-- =========================================================== --> + <Set name="stopAtShutdown">true</Set> + <Set name="sendServerVersion">true</Set> + <Set name="sendDateHeader">true</Set> + <Set name="gracefulShutdown">1000</Set> + +</Configure> Added: xmpp4js-launcher/src/main/launcher/etc/webdefault.xml =================================================================== --- xmpp4js-launcher/src/main/launcher/etc/webdefault.xml (rev 0) +++ xmpp4js-launcher/src/main/launcher/etc/webdefault.xml 2008-02-28 18:09:23 UTC (rev 700) @@ -0,0 +1,402 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> + +<!-- ===================================================================== --> +<!-- This file contains the default descriptor for web applications. --> +<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - --> +<!-- The intent of this descriptor is to include jetty specific or common --> +<!-- configuration for all webapps. If a context has a webdefault.xml --> +<!-- descriptor, it is applied before the contexts own web.xml file --> +<!-- --> +<!-- A context may be assigned a default descriptor by: --> +<!-- + Calling WebApplicationContext.setDefaultsDescriptor --> +<!-- + Passed an arg to addWebApplications --> +<!-- --> +<!-- This file is used both as the resource within the jetty.jar (which is --> +<!-- used as the default if no explicit defaults descriptor is set) and it --> +<!-- is copied to the etc directory of the Jetty distro and explicitly --> +<!-- by the jetty.xml file. --> +<!-- --> +<!-- ===================================================================== --> +<web-app + xmlns="http://java.sun.com/xml/ns/javaee" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" + metadata-complete="true" + version="2.5"> + + <description> + Default web.xml file. + This file is applied to a Web application before it's own WEB_INF/web.xml file + </description> + + + <!-- ==================================================================== --> + <!-- Context params to control Session Cookies --> + <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - --> + <!-- UNCOMMENT TO ACTIVATE + <context-param> + <param-name>org.mortbay.jetty.servlet.SessionDomain</param-name> + <param-value>127.0.0.1</param-value> + </context-param> + + <context-param> + <param-name>org.mortbay.jetty.servlet.SessionPath</param-name> + <param-value>/</param-value> + </context-param> + + <context-param> + <param-name>org.mortbay.jetty.servlet.MaxAge</param-name> + <param-value>-1</param-value> + </context-param> + --> + + <context-param> + <param-name>org.mortbay.jetty.webapp.NoTLDJarPattern</param-name> + <param-value>start.jar|ant-.*\.jar|dojo-.*\.jar|jetty-.*\.jar|jsp-api-.*\.jar|junit-.*\.jar|servlet-api-.*\.jar|dnsns\.jar|rt\.jar|jsse\.jar|tools\.jar|sunpkcs11\.jar|sunjce_provider\.jar|xerces.*\.jar</param-value> + </context-param> + + + + <!-- ==================================================================== --> + <!-- The default servlet. --> + <!-- This servlet, normally mapped to /, provides the handling for static --> + <!-- content, OPTIONS and TRACE methods for the context. --> + <!-- The following initParameters are supported: --> + <!-- --> + <!-- acceptRanges If true, range requests and responses are --> + <!-- supported --> + <!-- --> + <!-- dirAllowed If true, directory listings are returned if no --> + <!-- welcome file is found. Else 403 Forbidden. --> + <!-- --> + <!-- redirectWelcome If true, redirect welcome file requests --> + <!-- else use request dispatcher forwards --> + <!-- --> + <!-- gzip If set to true, then static content will be served--> + <!-- as gzip content encoded if a matching resource is --> + <!-- found ending with ".gz" --> + <!-- --> + <!-- resoureBase Can be set to replace the context resource base --> + <!-- --> + <!-- relativeResourceBase --> + <!-- Set with a pathname relative to the base of the --> + <!-- servlet context root. Useful for only serving --> + <!-- static content from only specific subdirectories. --> + <!-- --> + <!-- useFileMappedBuffer --> + <!-- If set to true (the default), a memory mapped --> + <!-- file buffer will be used to serve static content --> + <!-- when using an NIO connector. Setting this value --> + <!-- to false means that a direct buffer will be used --> + <!-- instead. If you are having trouble with Windows --> + <!-- file locking, set this to false. --> + <!-- --> + <!-- cacheControl If set, all static content will have this value --> + <!-- set as the cache-control header. --> + <!-- --> + <!-- maxCacheSize Maximum size of the static resource cache --> + <!-- --> + <!-- maxCachedFileSize Maximum size of any single file in the cache --> + <!-- --> + <!-- maxCachedFiles Maximum number of files in the cache --> + <!-- --> + <!-- cacheType "nio", "bio" or "both" to determine the type(s) --> + <!-- of resource cache. A bio cached buffer may be used--> + <!-- by nio but is not as efficient as a nio buffer. --> + <!-- An nio cached buffer may not be used by bio. --> + <!-- --> + <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - --> + <servlet> + <servlet-name>default</servlet-name> + <servlet-class>org.mortbay.jetty.servlet.DefaultServlet</servlet-class> + <init-param> + <param-name>acceptRanges</param-name> + <param-value>true</param-value> + </init-param> + <init-param> + <param-name>dirAllowed</param-name> + <param-value>true</param-value> + </init-param> + <init-param> + <param-name>redirectWelcome</param-name> + <param-value>false</param-value> + </init-param> + <init-param> + <param-name>maxCacheSize</param-name> + <param-value>256000000</param-value> + </init-param> + <init-param> + <param-name>maxCachedFileSize</param-name> + <param-value>10000000</param-value> + </init-param> + <init-param> + <param-name>maxCachedFiles</param-name> + <param-value>1000</param-value> + </init-param> + <init-param> + <param-name>cacheType</param-name> + <param-value>both</param-value> + </init-param> + <init-param> + <param-name>gzip</param-name> + <param-value>true</param-value> + </init-param> + <init-param> + <param-name>useFileMappedBuffer</param-name> + <param-value>true</param-value> + </init-param> + <!-- + <init-param> + <param-name>cacheControl</param-name> + <param-value>max-age=3600,public</param-value> + </init-param> + --> + <load-on-startup>0</load-on-startup> + </servlet> + + <servlet-mapping> <servlet-name>default</servlet-name> <url-pattern>/</url-pattern> </servlet-mapping> + + + <!-- ==================================================================== --> + <!-- JSP Servlet --> + <!-- This is the jasper JSP servlet from the jakarta project --> + <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - --> + <!-- The JSP page compiler and execution servlet, which is the mechanism --> + <!-- used by Glassfish to support JSP pages. Traditionally, this servlet --> + <!-- is mapped to URL patterh "*.jsp". This servlet supports the --> + <!-- following initialization parameters (default values are in square --> + <!-- brackets): --> + <!-- --> + <!-- checkInterval If development is false and reloading is true, --> + <!-- background compiles are enabled. checkInterval --> + <!-- is the time in seconds between checks to see --> + <!-- if a JSP page needs to be recompiled. [300] --> + <!-- --> + <!-- compiler Which compiler Ant should use to compile JSP --> + <!-- pages. See the Ant documenation for more --> + <!-- information. [javac] --> + <!-- --> + <!-- classdebuginfo Should the class file be compiled with --> + <!-- debugging information? [true] --> + <!-- --> + <!-- classpath What class path should I use while compiling --> + <!-- generated servlets? [Created dynamically --> + <!-- based on the current web application] --> + <!-- Set to ? to make the container explicitly set --> + <!-- this parameter. --> + <!-- --> + <!-- development Is Jasper used in development mode (will check --> + <!-- for JSP modification on every access)? [true] --> + <!-- --> + <!-- enablePooling Determines whether tag handler pooling is --> + <!-- enabled [true] --> + <!-- --> + <!-- fork Tell Ant to fork compiles of JSP pages so that --> + <!-- a separate JVM is used for JSP page compiles --> + <!-- from the one Tomcat is running in. [true] --> + <!-- --> + <!-- ieClassId The class-id value to be sent to Internet --> + <!-- Explorer when using <jsp:plugin> tags. --> + <!-- [clsid:8AD9C840-044E-11D1-B3E9-00805F499D93] --> + <!-- --> + <!-- javaEncoding Java file encoding to use for generating java --> + <!-- source files. [UTF-8] --> + <!-- --> + <!-- keepgenerated Should we keep the generated Java source code --> + <!-- for each page instead of deleting it? [true] --> + <!-- --> + <!-- logVerbosityLevel The level of detailed messages to be produced --> + <!-- by this servlet. Increasing levels cause the --> + <!-- generation of more messages. Valid values are --> + <!-- FATAL, ERROR, WARNING, INFORMATION, and DEBUG. --> + <!-- [WARNING] --> + <!-- --> + <!-- mappedfile Should we generate static content with one --> + <!-- print statement per input line, to ease --> + <!-- debugging? [false] --> + <!-- --> + <!-- --> + <!-- reloading Should Jasper check for modified JSPs? [true] --> + <!-- --> + <!-- suppressSmap Should the generation of SMAP info for JSR45 --> + <!-- debugging be suppressed? [false] --> + <!-- --> + <!-- dumpSmap Should the SMAP info for JSR45 debugging be --> + <!-- dumped to a file? [false] --> + <!-- False if suppressSmap is true --> + <!-- --> + <!-- scratchdir What scratch directory should we use when --> + <!-- compiling JSP pages? [default work directory --> + <!-- for the current web application] --> + <!-- --> + <!-- tagpoolMaxSize The maximum tag handler pool size [5] --> + <!-- --> + <!-- xpoweredBy Determines whether X-Powered-By response --> + <!-- header is added by generated servlet [false] --> + <!-- --> + <!-- If you wish to use Jikes to compile JSP pages: --> + <!-- Set the init parameter "compiler" to "jikes". Define --> + <!-- the property "-Dbuild.compiler.emacs=true" when starting Jetty --> + <!-- to cause Jikes to emit error messages in a format compatible with --> + <!-- Jasper. --> + <!-- If you get an error reporting that jikes can't use UTF-8 encoding, --> + <!-- try setting the init parameter "javaEncoding" to "ISO-8859-1". --> + <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - --> + <servlet id="jsp"> + <servlet-name>jsp</servlet-name> + <servlet-class>org.apache.jasper.servlet.JspServlet</servlet-class> + <init-param> + <param-name>logVerbosityLevel</param-name> + <param-value>DEBUG</param-value> + </init-param> + <init-param> + <param-name>fork</param-name> + <param-value>false</param-value> + </init-param> + <init-param> + <param-name>xpoweredBy</param-name> + <param-value>false</param-value> + </init-param> + <!-- + <init-param> + <param-name>classpath</param-name> + <param-value>?</param-value> + </init-param> + --> + <load-on-startup>0</load-on-startup> + </servlet> + + <servlet-mapping> + <servlet-name>jsp</servlet-name> + <url-pattern>*.jsp</url-pattern> + <url-pattern>*.jspf</url-pattern> + <url-pattern>*.jspx</url-pattern> + <url-pattern>*.xsp</url-pattern> + <url-pattern>*.JSP</url-pattern> + <url-pattern>*.JSPF</url-pattern> + <url-pattern>*.JSPX</url-pattern> + <url-pattern>*.XSP</url-pattern> + </servlet-mapping> + + <!-- ==================================================================== --> + <!-- Dynamic Servlet Invoker. --> + <!-- This servlet invokes anonymous servlets that have not been defined --> + <!-- in the web.xml or by other means. The first element of the pathInfo --> + <!-- of a request passed to the envoker is treated as a servlet name for --> + <!-- an existing servlet, or as a class name of a new servlet. --> + <!-- This servlet is normally mapped to /servlet/* --> + <!-- This servlet support the following initParams: --> + <!-- --> + <!-- nonContextServlets If false, the invoker can only load --> + <!-- servlets from the contexts classloader. --> + <!-- This is false by default and setting this --> + <!-- to true may have security implications. --> + <!-- --> + <!-- verbose If true, log dynamic loads --> + <!-- --> + <!-- * All other parameters are copied to the --> + <!-- each dynamic servlet as init parameters --> + <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - --> + <!-- Uncomment for dynamic invocation + <servlet> + <servlet-name>invoker</servlet-name> + <servlet-class>org.mortbay.jetty.servlet.Invoker</servlet-class> + <init-param> + <param-name>verbose</param-name> + <param-value>false</param-value> + </init-param> + <init-param> + <param-name>nonContextServlets</param-name> + <param-value>false</param-value> + </init-param> + <init-param> + <param-name>dynamicParam</param-name> + <param-value>anyValue</param-value> + </init-param> + <load-on-startup>0</load-on-startup> + </servlet> + + <servlet-mapping> <servlet-name>invoker</servlet-name> <url-pattern>/servlet/*</url-pattern> </servlet-mapping> + --> + + + + <!-- ==================================================================== --> + <session-config> + <session-timeout>30</session-timeout> + </session-config> + + <!-- ==================================================================== --> + <!-- Default MIME mappings --> + <!-- The default MIME mappings are provided by the mime.properties --> + <!-- resource in the org.mortbay.jetty.jar file. Additional or modified --> + <!-- mappings may be specified here --> + <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - --> + <!-- UNCOMMENT TO ACTIVATE + <mime-mapping> + <extension>mysuffix</extension> + <mime-type>mymime/type</mime-type> + </mime-mapping> + --> + + <!-- ==================================================================== --> + <welcome-file-list> + <welcome-file>index.html</welcome-file> + <welcome-file>index.htm</welcome-file> + <welcome-file>index.jsp</welcome-file> + </welcome-file-list> + + <!-- ==================================================================== --> + <locale-encoding-mapping-list> + <locale-encoding-mapping><locale>ar</locale><encoding>ISO-8859-6</encoding></locale-encoding-mapping> + <locale-encoding-mapping><locale>be</locale><encoding>ISO-8859-5</encoding></locale-encoding-mapping> + <locale-encoding-mapping><locale>bg</locale><encoding>ISO-8859-5</encoding></locale-encoding-mapping> + <locale-encoding-mapping><locale>ca</locale><encoding>ISO-8859-1</encoding></locale-encoding-mapping> + <locale-encoding-mapping><locale>cs</locale><encoding>ISO-8859-2</encoding></locale-encoding-mapping> + <locale-encoding-mapping><locale>da</locale><encoding>ISO-8859-1</encoding></locale-encoding-mapping> + <locale-encoding-mapping><locale>de</locale><encoding>ISO-8859-1</encoding></locale-encoding-mapping> + <locale-encoding-mapping><locale>el</locale><encoding>ISO-8859-7</encoding></locale-encoding-mapping> + <locale-encoding-mapping><locale>en</locale><encoding>ISO-8859-1</encoding></locale-encoding-mapping> + <locale-encoding-mapping><locale>es</locale><encoding>ISO-8859-1</encoding></locale-encoding-mapping> + <locale-encoding-mapping><locale>et</locale><encoding>ISO-8859-1</encoding></locale-encoding-mapping> + <locale-encoding-mapping><locale>fi</locale><encoding>ISO-8859-1</encoding></locale-encoding-mapping> + <locale-encoding-mapping><locale>fr</locale><encoding>ISO-8859-1</encoding></locale-encoding-mapping> + <locale-encoding-mapping><locale>hr</locale><encoding>ISO-8859-2</encoding></locale-encoding-mapping> + <locale-encoding-mapping><locale>hu</locale><encoding>ISO-8859-2</encoding></locale-encoding-mapping> + <locale-encoding-mapping><locale>is</locale><encoding>ISO-8859-1</encoding></locale-encoding-mapping> + <locale-encoding-mapping><locale>it</locale><encoding>ISO-8859-1</encoding></locale-encoding-mapping> + <locale-encoding-mapping><locale>iw</locale><encoding>ISO-8859-8</encoding></locale-encoding-mapping> + <locale-encoding-mapping><locale>ja</locale><encoding>Shift_JIS</encoding></locale-encoding-mapping> + <locale-encoding-mapping><locale>ko</locale><encoding>EUC-KR</encoding></locale-encoding-mapping> + <locale-encoding-mapping><locale>lt</locale><encoding>ISO-8859-2</encoding></locale-encoding-mapping> + <locale-encoding-mapping><locale>lv</locale><encoding>ISO-8859-2</encoding></locale-encoding-mapping> + <locale-encoding-mapping><locale>mk</locale><encoding>ISO-8859-5</encoding></locale-encoding-mapping> + <locale-encoding-mapping><locale>nl</locale><encoding>ISO-8859-1</encoding></locale-encoding-mapping> + <locale-encoding-mapping><locale>no</locale><encoding>ISO-8859-1</encoding></locale-encoding-mapping> + <locale-encoding-mapping><locale>pl</locale><encoding>ISO-8859-2</encoding></locale-encoding-mapping> + <locale-encoding-mapping><locale>pt</locale><encoding>ISO-8859-1</encoding></locale-encoding-mapping> + <locale-encoding-mapping><locale>ro</locale><encoding>ISO-8859-2</encoding></locale-encoding-mapping> + <locale-encoding-mapping><locale>ru</locale><encoding>ISO-8859-5</encoding></locale-encoding-mapping> + <locale-encoding-mapping><locale>sh</locale><encoding>ISO-8859-5</encoding></locale-encoding-mapping> + <locale-encoding-mapping><locale>sk</locale><encoding>ISO-8859-2</encoding></locale-encoding-mapping> + <locale-encoding-mapping><locale>sl</locale><encoding>ISO-8859-2</encoding></locale-encoding-mapping> + <locale-encoding-mapping><locale>sq</locale><encoding>ISO-8859-2</encoding></locale-encoding-mapping> + <locale-encoding-mapping><locale>sr</locale><encoding>ISO-8859-5</encoding></locale-encoding-mapping> + <locale-encoding-mapping><locale>sv</locale><encoding>ISO-8859-1</encoding></locale-encoding-mapping> + <locale-encoding-mapping><locale>tr</locale><encoding>ISO-8859-9</encoding></locale-encoding-mapping> + <locale-encoding-mapping><locale>uk</locale><encoding>ISO-8859-5</encoding></locale-encoding-mapping> + <locale-encoding-mapping><locale>zh</locale><encoding>GB2312</encoding></locale-encoding-mapping> + <locale-encoding-mapping><locale>zh_TW</locale><encoding>Big5</encoding></locale-encoding-mapping> + </locale-encoding-mapping-list> + + <security-constraint> + <web-resource-collection> + <web-resource-name>Disable TRACE</web-resource-name> + <url-pattern>/</url-pattern> + <http-method>TRACE</http-method> + </web-resource-collection> + <auth-constraint/> + </security-constraint> + +</web-app> + Added: xmpp4js-launcher/src/main/launcher/run.bat =================================================================== --- xmpp4js-launcher/src/main/launcher/run.bat (rev 0) +++ xmpp4js-launcher/src/main/launcher/run.bat 2008-02-28 18:09:23 UTC (rev 700) @@ -0,0 +1 @@ +java -jar lib/start.jar \ No newline at end of file Added: xmpp4js-launcher/src/main/webapp/WEB-INF/web.xml =================================================================== --- xmpp4js-launcher/src/main/webapp/WEB-INF/web.xml (rev 0) +++ xmpp4js-launcher/src/main/webapp/WEB-INF/web.xml 2008-02-28 18:09:23 UTC (rev 700) @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8"?> +<web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http:/java.sun.com/dtd/web-app_2_3.dtd"> + + <welcome-file-list> + <welcome-file>simpleclient.html</welcome-file> + </welcome-file-list> + + <servlet> + <servlet-name>Jabber HTTP Binding Servlet</servlet-name> + <servlet-class>org.jabber.JabberHTTPBind.JHBServlet</servlet-class> + </servlet> + + <servlet-mapping> + <servlet-name>Jabber HTTP Binding Servlet</servlet-name> + <url-pattern>/http-bind/*</url-pattern> + </servlet-mapping> +</web-app> Added: xmpp4js-launcher/src/main/webapp/simpleclient.html =================================================================== --- xmpp4js-launcher/src/main/webapp/simpleclient.html (rev 0) +++ xmpp4js-launcher/src/main/webapp/simpleclient.html 2008-02-28 18:09:23 UTC (rev 700) @@ -0,0 +1,292 @@ +<html> + <head> + <title>Xmpp4Js Sample Client</title> + <script type="text/javascript" src="scripts/lib/prototype.js"> </script> + <script type="text/javascript" src="scripts/lib/extjs2.js"></script> + <script type="text/javascript" src="scripts/lib/dom-all.js"></script> + <script type="text/javascript" src="scripts/lib/crypto.js"></script> + <script type="text/javascript" src="scripts/lib/xmpp4js.js"></script> + </head> + + <body> + <div id="login-panel"> + <form onsubmit="return client.login(this)"> + <dl> + <dt>Domain</dt> + <dd><input type="text" name="domain" value="soashable.com"/></dd> + + <dt>Username</dt> + <dd><input type="text" name="username"/></dd> + + <dt>Password</dt> + <dd><input type="password" name="password"/></dd> + + <dt></dt> + <dd><button type="submit">Login</button></dd> + </dl> + </form> + </div> + + <div id="message-panel"> + <div id="message-area"> + + </div> + <form id="message-form" onsubmit="return client.sendMessage(this)"> + <dl> + <dt>To</dt> + <dd> + <input type="text" name="to" size="30" value="ha...@so..."/> + </dd> + <dt>Message</dt> + <dd> + <textarea name="message" rows="4" cols="60"></textarea> + </dd> + <dt></dt> + <dd><button type="submit">Send</button></dd> + </dl> + </form> + </div> + + <div id="control-panel"> + <button onclick="client.close()">Disconnect.</button> + </div> + + <script type="text/javascript"> +<!-- +function SimpleClient() { + /** + * @type Xmpp4Js.Connection + */ + this.con = null; +} + +SimpleClient.prototype = { + CHAT_OPTIONS : { + ignoreResource: true, + ignoreThread: true + }, + + /** + * Connect and set handler that will attempt login + */ + login: function(form) { + // set up the connection + this.init(); + + // store this for onConnectForLogin + this.loginForm = form; + + // set a listener to call onConnectForLogin once when connected + this.con.on("connect", this.onConnectForLogin, this, {single: true} ); + + // actually connec to soashable.com. it doesn't matter what your BOSH + // server is. + this.con.connect( "soashable.com" ); + + this.logMessage( "Connecting..." ); + + // return false so the form doesn't submit + return false; + }, + + close: function() { + this.con.close(); + + // return false so the form doesn't submit + return false; + }, + + sendMessage: function(form) { + var to = form.to.value; + var messageText = form.message.value; + + var msgPacket = new Xmpp4Js.Packet.Message( to, "chat", messageText ); + + this.con.send( msgPacket ); + + this.logMessage( this.con.getJid().toString()+": "+messageText, "outgoing-chat" ); + + // return false so the form doesn't submit + return false; + }, + + /** + * Append a message to message-area. + */ + logMessage: function(msg, cssClasses) { + var msgArea = Ext.get( "message-area" ); + + this.logMessageTemplate.append( msgArea, {cssClasses: cssClasses, msg: msg} ); + + msgArea.scroll("down", 5000, true); + }, + + + /** + * Initialize the connection + * + * @private + */ + init: function() { + var stanzaProvider = new Xmpp4Js.Packet.StanzaProvider(); + stanzaProvider.registerDefaultProviders(); + + this.con = new Xmpp4Js.Connection({ + transport: { + clazz: Xmpp4Js.Transport.BOSH, + endpoint: "/http-bind/" // where your BOSH server is running. + // NOTE: same origin policy means you need some sort of proxt, or a servlet. + }, + stanzaProvider: stanzaProvider, + listeners: { + scope : this, + error : this.onError, + close : this.onClose + } + }); + + this.chatManager = Xmpp4Js.Chat.ChatManager.getInstanceFor( this.con ); + this.chatManager.setOptions(this.CHAT_OPTIONS); + + this.chatManager.on({ + scope : this, + chatStarted : this.onChatStarted, + messageReceived : this.onChatMessageReceived + }); + }, + + /** + * This is called when we connect. It performs a login. + * @private + */ + onConnectForLogin: function() { + var domain = this.loginForm.domain.value; + var username = this.loginForm.username.value; + var password = this.loginForm.password.value; + + // start the login flow + var loginFlow = new Xmpp4Js.Workflow.Login({ + con: this.con, + listeners: { + scope: this, + success: this.onLoginCompleted, + failure: this.onAuthError + } + }); + + this.logMessage( "Loggin in..." ); + + var type = username ? "plaintext" : "anon"; + loginFlow.start( type, username, password ); + }, + + /** + * We're now authenticated + * @private + */ + onLoginCompleted : function() { + + // send the initial presence packet. + this.con.send(this.con.getPacketHelper().createPresence()); + + this.logMessage( "Logged in.", "login-success" ); + + document.getElementById( "login-panel" ).style.display = "none"; + document.getElementById( "message-form" ).style.display = "block"; + document.getElementById( "control-panel" ).style.display = "block"; + }, + + /** + * + * @private + */ + onAuthError: function() { + this.logMessage( "There was authentication error. Try again.", "error" ); + }, + + /** + * @private + */ + onError : function( isTerminal, packetNode, title, message ) { + this.logMessage( "There was an error(fatal="+isTerminal+"): "+message, "error" ); + }, + + /** + * + * @private + */ + onClose : function( con ) { + this.logMessage( "Connection to "+this.con.domain+" closed." ); + + document.getElementById( "login-panel" ).style.display = "block"; + document.getElementById( "message-form" ).style.display = "none"; + document.getElementById( "control-panel" ).style.display = "none"; + + // clean house. + delete this.con; + }, + + /** + * + * @private + */ + onChatStarted : function(chat) { + this.logMessage( "Chat with " + chat.getParticipant().toString() + " started", "chat-started" ); + }, + + /** + * + * @private + */ + onChatMessageReceived : function(chat, messagePacket) { + if( messagePacket.hasContent() ) { + this.logMessage( messagePacket.getFrom() + ": " + messagePacket.getBody(), "incoming-chat" ); + } + + // else, some extension sending a message. + }, + + /** + * The template to use for log messages. + * @private + */ + logMessageTemplate: new Ext.Template( "<div class='message {cssClasses}'>{msg}</div>" ) +} + +var client = null; +Ext.onReady(function() { + client = new SimpleClient(); + + if( !Ext.isOpera && !Ext.isGecko && !Ext.isIE7 && !Ext.isSafari ) { + client.logMessage( "You're using an untested browser. Please let me know how it goes. <a href='mailto:h.i...@gm...'>h.i...@gm...</a>" ); + } + + client.logMessage( "Client ready." ); +}); + +--> + </script> + <style type="text/css"> +<!-- + +#message-area { + height: 15em; + width: 50em; + overflow: auto; + scoll: auto; + +} + +#message-form { + display: none; +} + +#control-panel { + display: none; +} + +--> + </style> + + </body> +</html> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <h-i...@us...> - 2008-02-28 17:58:14
|
Revision: 699 http://xmpp4js.svn.sourceforge.net/xmpp4js/?rev=699&view=rev Author: h-iverson Date: 2008-02-28 09:58:06 -0800 (Thu, 28 Feb 2008) Log Message: ----------- Initial import. Added Paths: ----------- xmpp4js-launcher/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <h-i...@us...> - 2008-02-26 05:45:28
|
Revision: 698 http://xmpp4js.svn.sourceforge.net/xmpp4js/?rev=698&view=rev Author: h-iverson Date: 2008-02-25 21:45:33 -0800 (Mon, 25 Feb 2008) Log Message: ----------- added new description Modified Paths: -------------- trunk/src/site/apt/index.apt Modified: trunk/src/site/apt/index.apt =================================================================== --- trunk/src/site/apt/index.apt 2008-02-25 03:27:16 UTC (rev 697) +++ trunk/src/site/apt/index.apt 2008-02-26 05:45:33 UTC (rev 698) @@ -8,14 +8,21 @@ About Xmpp4Js - Xmpp4Js is an XMPP client library written purely in Javascript. This means that - unlike xmpp4moz, it requires no browser plugin to operate and in theory should - operate on any browser (in practice it doesn't work in IE or Opera, but could - if somebody cared enough). + Xmpp4Js is an XMPP client written in pure Javascript. It connects to a server + using BOSH (XEP-0124), which is a COMET protocol that provides instantaneous + responses. - Currently Xmpp4Js is only available as a Maven JS artifact, but there's no reason - why it couldn't be extracted and used in a non-maven project. + It allows any web page to be active on an XMPP network. Uses can range from + a simple Meebo-like chat client, to a phpLive-like support interface, and beyond. + Xmpp4Js is supported in all major browsers, which removes compatibility + limitations inherent in browser extensions like xmpp4moz. + + The initial release includes a sample chat client with basic in-browser + messaging functionality, and all dependencies. + + Xmpp4Js is dual-licensed under LGPL and Apache 2.0. + * Requirements - Maven 2.0.x, {{{bosh-environment.html}BOSH environment}} \ No newline at end of file + {{{bosh-environment.html}BOSH environment}} \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <h-i...@us...> - 2008-02-25 03:27:19
|
Revision: 697 http://xmpp4js.svn.sourceforge.net/xmpp4js/?rev=697&view=rev Author: h-iverson Date: 2008-02-24 19:27:16 -0800 (Sun, 24 Feb 2008) Log Message: ----------- added assembly plugin and a sample client. Modified Paths: -------------- trunk/pom.xml trunk/src/site/site.xml Added Paths: ----------- trunk/src/assembler/src.xml trunk/src/main/resources/ trunk/src/main/resources/README trunk/src/main/sample/ trunk/src/main/sample/simpleclient.html Modified: trunk/pom.xml =================================================================== --- trunk/pom.xml 2008-02-23 09:50:46 UTC (rev 696) +++ trunk/pom.xml 2008-02-25 03:27:16 UTC (rev 697) @@ -89,6 +89,26 @@ </execution> </executions> </plugin> + + <plugin> + <artifactId>maven-assembly-plugin</artifactId> + <configuration> + <attach>false</attach> + <descriptors> + <descriptor>src/assembler/src.xml</descriptor> + </descriptors> + </configuration> + <executions> + <execution> + <id>make-assembly</id> + <phase>package</phase> + <goals> + <goal>assembly</goal> + </goals> + </execution> + + </executions> + </plugin> </plugins> </build> Added: trunk/src/assembler/src.xml =================================================================== --- trunk/src/assembler/src.xml (rev 0) +++ trunk/src/assembler/src.xml 2008-02-25 03:27:16 UTC (rev 697) @@ -0,0 +1,26 @@ +<assembly> + <id>with-dependencies</id> + <formats> + <format>zip</format> + <format>tar.gz</format> + </formats> + <includeBaseDirectory>true</includeBaseDirectory> + <dependencySets> + <dependencySet> + <outputDirectory>lib</outputDirectory> + <outputFileNameMapping></outputFileNameMapping> + <unpack>true</unpack> + <scope>runtime</scope> + </dependencySet> + </dependencySets> + <fileSets> + <fileSet> + <directory>target/classes</directory> + <outputDirectory></outputDirectory> + </fileSet> + <fileSet> + <directory>src/main/sample</directory> + <outputDirectory>sample</outputDirectory> + </fileSet> + </fileSets> +</assembly> \ No newline at end of file Added: trunk/src/main/resources/README =================================================================== --- trunk/src/main/resources/README (rev 0) +++ trunk/src/main/resources/README 2008-02-25 03:27:16 UTC (rev 697) @@ -0,0 +1,10 @@ +Xmpp4Js + +Includes uncompressed script and all uncompressed dependencies: +- XML for <script> +- extjs 2.0 +- crypto library + +And a sample client. + +Please see documentation at http://xmpp4js.sourceforge.net \ No newline at end of file Added: trunk/src/main/sample/simpleclient.html =================================================================== --- trunk/src/main/sample/simpleclient.html (rev 0) +++ trunk/src/main/sample/simpleclient.html 2008-02-25 03:27:16 UTC (rev 697) @@ -0,0 +1,292 @@ +<html> + <head> + <title>Xmpp4Js Sample Client</title> + <script type="text/javascript" src="../lib/prototype.js"> </script> + <script type="text/javascript" src="../lib/extjs2.js"></script> + <script type="text/javascript" src="../lib/dom-all.js"></script> + <script type="text/javascript" src="../lib/crypto.js"></script> + <script type="text/javascript" src="../lib/xmpp4js.js"></script> + </head> + + <body> + <div id="login-panel"> + <form onsubmit="return client.login(this)"> + <dl> + <dt>Domain</dt> + <dd><input type="text" name="domain" value="soashable.com"/></dd> + + <dt>Username</dt> + <dd><input type="text" name="username"/></dd> + + <dt>Password</dt> + <dd><input type="password" name="password"/></dd> + + <dt></dt> + <dd><button type="submit">Login</button></dd> + </dl> + </form> + </div> + + <div id="message-panel"> + <div id="message-area"> + + </div> + <form id="message-form" onsubmit="return client.sendMessage(this)"> + <dl> + <dt>To</dt> + <dd> + <input type="text" name="to" size="30" value="ha...@so..."/> + </dd> + <dt>Message</dt> + <dd> + <textarea name="message" rows="4" cols="60"></textarea> + </dd> + <dt></dt> + <dd><button type="submit">Send</button></dd> + </dl> + </form> + </div> + + <div id="control-panel"> + <button onclick="client.close()">Disconnect.</button> + </div> + + <script type="text/javascript"> +<!-- +function SimpleClient() { + /** + * @type Xmpp4Js.Connection + */ + this.con = null; +} + +SimpleClient.prototype = { + CHAT_OPTIONS : { + ignoreResource: true, + ignoreThread: true + }, + + /** + * Connect and set handler that will attempt login + */ + login: function(form) { + // set up the connection + this.init(); + + // store this for onConnectForLogin + this.loginForm = form; + + // set a listener to call onConnectForLogin once when connected + this.con.on("connect", this.onConnectForLogin, this, {single: true} ); + + // actually connec to soashable.com. it doesn't matter what your BOSH + // server is. + this.con.connect( "soashable.com" ); + + this.logMessage( "Connecting..." ); + + // return false so the form doesn't submit + return false; + }, + + close: function() { + this.con.close(); + + // return false so the form doesn't submit + return false; + }, + + sendMessage: function(form) { + var to = form.to.value; + var messageText = form.message.value; + + var msgPacket = new Xmpp4Js.Packet.Message( to, "chat", messageText ); + + this.con.send( msgPacket ); + + this.logMessage( this.con.getJid().toString()+": "+messageText, "outgoing-chat" ); + + // return false so the form doesn't submit + return false; + }, + + /** + * Append a message to message-area. + */ + logMessage: function(msg, cssClasses) { + var msgArea = Ext.get( "message-area" ); + + this.logMessageTemplate.append( msgArea, {cssClasses: cssClasses, msg: msg} ); + + msgArea.scroll("down", 5000, true); + }, + + + /** + * Initialize the connection + * + * @private + */ + init: function() { + var stanzaProvider = new Xmpp4Js.Packet.StanzaProvider(); + stanzaProvider.registerDefaultProviders(); + + this.con = new Xmpp4Js.Connection({ + transport: { + clazz: Xmpp4Js.Transport.BOSH, + endpoint: "/http-bind/" // where your BOSH server is running. + // NOTE: same origin policy means you need some sort of proxt, or a servlet. + }, + stanzaProvider: stanzaProvider, + listeners: { + scope : this, + error : this.onError, + close : this.onClose + } + }); + + this.chatManager = Xmpp4Js.Chat.ChatManager.getInstanceFor( this.con ); + this.chatManager.setOptions(this.CHAT_OPTIONS); + + this.chatManager.on({ + scope : this, + chatStarted : this.onChatStarted, + messageReceived : this.onChatMessageReceived + }); + }, + + /** + * This is called when we connect. It performs a login. + * @private + */ + onConnectForLogin: function() { + var domain = this.loginForm.domain.value; + var username = this.loginForm.username.value; + var password = this.loginForm.password.value; + + // start the login flow + var loginFlow = new Xmpp4Js.Workflow.Login({ + con: this.con, + listeners: { + scope: this, + success: this.onLoginCompleted, + failure: this.onAuthError + } + }); + + this.logMessage( "Loggin in..." ); + + var type = username ? "plaintext" : "anon"; + loginFlow.start( type, username, password ); + }, + + /** + * We're now authenticated + * @private + */ + onLoginCompleted : function() { + + // send the initial presence packet. + this.con.send(this.con.getPacketHelper().createPresence()); + + this.logMessage( "Logged in.", "login-success" ); + + document.getElementById( "login-panel" ).style.display = "none"; + document.getElementById( "message-form" ).style.display = "block"; + document.getElementById( "control-panel" ).style.display = "block"; + }, + + /** + * + * @private + */ + onAuthError: function() { + this.logMessage( "There was authentication error. Try again.", "error" ); + }, + + /** + * @private + */ + onError : function( isTerminal, packetNode, title, message ) { + this.logMessage( "There was an error(fatal="+isTerminal+"): "+message, "error" ); + }, + + /** + * + * @private + */ + onClose : function( con ) { + this.logMessage( "Connection to "+this.con.domain+" closed." ); + + document.getElementById( "login-panel" ).style.display = "block"; + document.getElementById( "message-form" ).style.display = "none"; + document.getElementById( "control-panel" ).style.display = "none"; + + // clean house. + delete this.con; + }, + + /** + * + * @private + */ + onChatStarted : function(chat) { + this.logMessage( "Chat with " + chat.getParticipant().toString() + " started", "chat-started" ); + }, + + /** + * + * @private + */ + onChatMessageReceived : function(chat, messagePacket) { + if( messagePacket.hasContent() ) { + this.logMessage( messagePacket.getFrom() + ": " + messagePacket.getBody(), "incoming-chat" ); + } + + // else, some extension sending a message. + }, + + /** + * The template to use for log messages. + * @private + */ + logMessageTemplate: new Ext.Template( "<div class='message {cssClasses}'>{msg}</div>" ) +} + +var client = null; +Ext.onReady(function() { + client = new SimpleClient(); + + if( !Ext.isOpera && !Ext.isGecko && !Ext.isIE7 && !Ext.isSafari ) { + client.logMessage( "You're using an untested browser. Please let me know how it goes. <a href='mailto:h.i...@gm...'>h.i...@gm...</a>" ); + } + + client.logMessage( "Client ready." ); +}); + +--> + </script> + <style type="text/css"> +<!-- + +#message-area { + height: 15em; + width: 50em; + overflow: auto; + scoll: auto; + +} + +#message-form { + display: none; +} + +#control-panel { + display: none; +} + +--> + </style> + + </body> +</html> \ No newline at end of file Modified: trunk/src/site/site.xml =================================================================== --- trunk/src/site/site.xml 2008-02-23 09:50:46 UTC (rev 696) +++ trunk/src/site/site.xml 2008-02-25 03:27:16 UTC (rev 697) @@ -23,8 +23,12 @@ </bannerRight> <body> + <menu name="About Xmpp4Js"> + <item name="Introduction" href="index.html"/> + <item name="Download" href="https://sourceforge.net/project/showfiles.php?group_id=209465"/> + </menu> <menu name="Developer Docs"> - <item name="Introduction" href="index.html"/> + <item name="BOSH Environment" href="bosh-environment.html"/> <item name="The HACKING File" href="hacking.html"/> <item name="XEP-0124 (BOSH)" href="http://www.xmpp.org/extensions/xep-0124.html"/> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <h-i...@us...> - 2008-02-23 09:51:19
|
Revision: 696 http://xmpp4js.svn.sourceforge.net/xmpp4js/?rev=696&view=rev Author: h-iverson Date: 2008-02-23 01:50:46 -0800 (Sat, 23 Feb 2008) Log Message: ----------- merged xml4script-port branch back into trunk. for the love of god, could not get 'svn merge' to work. just diffed :\. Modified Paths: -------------- trunk/pom.xml trunk/src/assembler/xmpp4js.xml trunk/src/main/javascript/DomBuilder.js trunk/src/main/javascript/StanzaProvider.js trunk/src/main/javascript/ext/DataForm.js trunk/src/main/javascript/ext/DataStorage.js trunk/src/main/javascript/ext/ServiceDisco.js trunk/src/main/javascript/msie-createElementNS.js trunk/src/main/javascript/msie-importNode.js trunk/src/main/javascript/muc/MucPresenceFilter.js trunk/src/main/javascript/packet/Base.js trunk/src/main/javascript/packet/IQ.js trunk/src/main/javascript/packet/PacketExtension.js trunk/src/main/javascript/packet/PacketListenerManager.js trunk/src/main/javascript/packet/Presence.js trunk/src/main/javascript/packet/Registration.js trunk/src/main/javascript/packetfilter/Errors.js trunk/src/main/javascript/packetfilter/PacketExtensionFilter.js trunk/src/main/javascript/roster/RosterItemManager.js trunk/src/main/javascript/roster/RosterPacket.js trunk/src/main/javascript/transport/BOSH.js trunk/src/test/javascript/BOSHTransportTest.html trunk/src/test/javascript/ChatManagerTest.html trunk/src/test/javascript/DomBuilderTest.html trunk/src/test/javascript/DomHacksTest.html trunk/src/test/javascript/ExtensionProviderTest.html trunk/src/test/javascript/MUC_FilterTest.html trunk/src/test/javascript/MUC_JoinTest.html trunk/src/test/javascript/PacketFilterTest.html trunk/src/test/javascript/PacketHelperTest.html trunk/src/test/javascript/PacketReaderTest.html trunk/src/test/javascript/RosterItemManagerTest.html trunk/src/test/javascript/common-test-library.js trunk/src/test/javascript/includes.js Added Paths: ----------- trunk/nbactions.xml trunk/src/main/javascript/console.js Added: trunk/nbactions.xml =================================================================== --- trunk/nbactions.xml (rev 0) +++ trunk/nbactions.xml 2008-02-23 09:50:46 UTC (rev 696) @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="UTF-8"?> +<actions> + <action> + <actionName>build</actionName> + <packagings> + <packaging>*</packaging> + </packagings> + <goals> + <goal>install</goal> + </goals> + <properties> + <maven.test.skip>true</maven.test.skip> + </properties> + </action> + </actions> Modified: trunk/pom.xml =================================================================== --- trunk/pom.xml 2008-02-23 07:20:28 UTC (rev 695) +++ trunk/pom.xml 2008-02-23 09:50:46 UTC (rev 696) @@ -39,6 +39,13 @@ <version>1.0-SNAPSHOT</version> </dependency> + <dependency> + <groupId>net.sf.xml4script</groupId> + <artifactId>xml4script</artifactId> + <type>javascript</type> + <version>3.1-SNAPSHOT</version> + </dependency> + </dependencies> <build> @@ -113,13 +120,13 @@ <repository> <id>mvn.soashable.com</id> <url> - http://mvn.soashable.com:8081/artifactory/libs-releases + http://mvn.soashable.com/artifactory/libs-releases </url> </repository> <snapshotRepository> <id>mvn.soashable.com</id> <url> - http://mvn.soashable.com:8081/artifactory/libs-snapshots + http://mvn.soashable.com/artifactory/libs-snapshots </url> </snapshotRepository> <site> @@ -165,7 +172,7 @@ <repositories> <repository> <id>soashable-libs-snapshots</id> - <url>http://mvn.soashable.com:8081/artifactory/libs-snapshots</url> + <url>http://mvn.soashable.com/artifactory/libs-snapshots</url> <releases> <enabled>false</enabled> <updatePolicy>never</updatePolicy> @@ -178,4 +185,4 @@ </repository> </repositories> -</project> \ No newline at end of file +</project> Modified: trunk/src/assembler/xmpp4js.xml =================================================================== --- trunk/src/assembler/xmpp4js.xml 2008-02-23 07:20:28 UTC (rev 695) +++ trunk/src/assembler/xmpp4js.xml 2008-02-23 09:50:46 UTC (rev 696) @@ -5,8 +5,8 @@ <fileName>xmpp4js.js</fileName> <includes> <!-- utils --> + <include>console.js</include> <include>Jid.js</include> - <include>msie-importNode.js</include> <include>msie-createElementNS.js</include> <include>DomBuilder.js</include> Modified: trunk/src/main/javascript/DomBuilder.js =================================================================== --- trunk/src/main/javascript/DomBuilder.js 2008-02-23 07:20:28 UTC (rev 695) +++ trunk/src/main/javascript/DomBuilder.js 2008-02-23 09:50:46 UTC (rev 696) @@ -55,7 +55,7 @@ // if content is set, append it to childElements if(content) { // if content isn't an element, create a text node for it - if( !(content instanceof Element) ) { + if( !(content instanceof DOMElement) ) { content = parentDoc.createTextNode( content ); } @@ -66,13 +66,13 @@ var elem; if( attributes["xmlns"] !== undefined ) { - elem = createElementNS(parentDoc, attributes["xmlns"], elementName ); + elem = parentDoc.createElementNS( attributes["xmlns"], elementName ); } else if( elementName.indexOf(":") > -1 ) { var prefix = elementName.substring( 0, elementName.indexOf(":") ); var xmlns = attributes[ "xmlns:" + prefix ]; if( xmlns ) { - elem = createElementNS(parentDoc, xmlns, elementName ); + elem = parentDoc.createElementNS( xmlns, elementName ); } else { elem = parentDoc.createElement( elementName ); @@ -83,7 +83,11 @@ // add attributes for( var k in attributes ) { - elem.setAttribute( k, attributes[k] ); + try { + elem.setAttribute( k, attributes[k] ); + } catch(e) { +;;; alert( "Could not set attribute: "+k+"="+attributes[k]+". current="+elem.getAttribute(k).toString() ); + } } // add childElements for( var i = 0; i < childElements.length; i++ ) { @@ -92,4 +96,4 @@ // return newly created element return elem; -} \ No newline at end of file +} Modified: trunk/src/main/javascript/StanzaProvider.js =================================================================== --- trunk/src/main/javascript/StanzaProvider.js 2008-02-23 07:20:28 UTC (rev 695) +++ trunk/src/main/javascript/StanzaProvider.js 2008-02-23 09:50:46 UTC (rev 696) @@ -43,7 +43,7 @@ * @return {Xmpp4Js.Packet.Base} A packet object representing the node. */ fromNode: function( stanzaNode ) { - if( !(stanzaNode instanceof Element) ) { + if( !(stanzaNode instanceof DOMElement) ) { // TODO throw error or something. return undefined; } @@ -106,7 +106,7 @@ } Xmpp4Js.Packet.StanzaProvider._ElemNameProvider = function( stanzaNode, packetType ) { - return stanzaNode.localName.toLowerCase() == packetType.toLowerCase(); + return stanzaNode.nodeName.toLowerCase() == packetType.toLowerCase(); } Xmpp4Js.Packet.StanzaProvider.IQProvider = function( stanzaNode ) { Added: trunk/src/main/javascript/console.js =================================================================== --- trunk/src/main/javascript/console.js (rev 0) +++ trunk/src/main/javascript/console.js 2008-02-23 09:50:46 UTC (rev 696) @@ -0,0 +1,10 @@ +if( window['console'] == undefined ) { + console = { + info: Ext.emptyFn, + log: Ext.emptyFn, + dir: Ext.emptyFn, + dirxml: Ext.emptyFn, + warn: Ext.emptyFn, + error: Ext.emptyFn + } +} Modified: trunk/src/main/javascript/ext/DataForm.js =================================================================== --- trunk/src/main/javascript/ext/DataForm.js 2008-02-23 07:20:28 UTC (rev 695) +++ trunk/src/main/javascript/ext/DataForm.js 2008-02-23 09:50:46 UTC (rev 696) @@ -32,7 +32,7 @@ * Clones the given node and returns a reference to it */ DataForm.prototype.read = function(node) { - if( node.localName != "x" || node.namespaceURI != "jabber:x:data" ) { + if( node.nodeName != "x" || node.namespaceURI != "jabber:x:data" ) { //parentNode = node; alert( "nothin" ); @@ -56,7 +56,7 @@ var newNode = this.node.cloneNode(true); newNode = importNode( node.ownerDocument, newNode, true ); - if( node.localName == "x" && node.namespanamespaceURI == "jabber:x:data" ) { + if( node.nodeName == "x" && node.namespanamespaceURI == "jabber:x:data" ) { var parentNode = node.parentNode; newNode = parentNode.replaceChild( newNode, node ); } else { Modified: trunk/src/main/javascript/ext/DataStorage.js =================================================================== --- trunk/src/main/javascript/ext/DataStorage.js 2008-02-23 07:20:28 UTC (rev 695) +++ trunk/src/main/javascript/ext/DataStorage.js 2008-02-23 09:50:46 UTC (rev 696) @@ -30,7 +30,7 @@ contentNode.setAttribute( "xmlns", xmlns ); if( typeof(data) == 'string' ) { - contentNode.textContent = data; + contentNode.setTextContent( data ); } else { contentNode.appendChild( data ); } Modified: trunk/src/main/javascript/ext/ServiceDisco.js =================================================================== --- trunk/src/main/javascript/ext/ServiceDisco.js 2008-02-23 07:20:28 UTC (rev 695) +++ trunk/src/main/javascript/ext/ServiceDisco.js 2008-02-23 09:50:46 UTC (rev 696) @@ -207,9 +207,9 @@ } var itemNodes = responseQuery.childNodes; - for ( var i=0; i < itemNodes.length; i++ ) { - var item = itemNodes[ i ]; - if( item.localName == "item" ) { + for ( var i=0; i < itemNodes.getLength(); i++ ) { + var item = itemNodes.item( i ); + if( item.nodeName == "item" ) { items.push({ jid: item.getAttribute( "jid" ), name: item.getAttribute( "name" ), @@ -240,16 +240,16 @@ } var itemNodes = responseQuery.childNodes; - for ( var i=0; i < itemNodes.length; i++ ) { - var item = itemNodes[ i ]; + for ( var i=0; i < itemNodes.getLength(); i++ ) { + var item = itemNodes.item( i ); - if( item.localName == "identity" ) { + if( item.nodeName == "identity" ) { identities.push({ category: item.getAttribute( "category" ), name: item.getAttribute( "name" ), type: item.getAttribute( "type" ) }); - } else if( item.localName == "feature" ) { + } else if( item.nodeName == "feature" ) { features.push( item.getAttribute( "var" ) ); } } @@ -363,8 +363,8 @@ var query = iq.getQuery(); - query.appendChild( iq.getDoc().createElement( "username" ) ).textContent = screenName; - query.appendChild( iq.getDoc().createElement( "password" ) ).textContent = password; + query.appendChild( iq.getDoc().createElement( "username" ) ).setTextContent( screenName ); + query.appendChild( iq.getDoc().createElement( "password" ) ).setTextContent( password ); con.send( iq, function( packet ) { if( packet.getType() == "error" ) { @@ -383,4 +383,4 @@ } ); //} ); -} \ No newline at end of file +} Modified: trunk/src/main/javascript/msie-createElementNS.js =================================================================== --- trunk/src/main/javascript/msie-createElementNS.js 2008-02-23 07:20:28 UTC (rev 695) +++ trunk/src/main/javascript/msie-createElementNS.js 2008-02-23 09:50:46 UTC (rev 696) @@ -1,10 +0,0 @@ -var createElementNS = function(doc, ns, elemName ) { - if( doc.createElementNS != undefined ) { - return doc.createElementNS( ns, elemName ); - } else { - var elem = doc.createElement( elemName ); - elem.setAttribute( "xmlns", ns ); - - return elem; - } -} \ No newline at end of file Modified: trunk/src/main/javascript/msie-importNode.js =================================================================== --- trunk/src/main/javascript/msie-importNode.js 2008-02-23 07:20:28 UTC (rev 695) +++ trunk/src/main/javascript/msie-importNode.js 2008-02-23 09:50:46 UTC (rev 696) @@ -1,90 +0,0 @@ -// adapted from http://www.alistapart.com/articles/crossbrowserscripting - -/* is this stuff defined? */ -if (!document.ELEMENT_NODE) { - document.ELEMENT_NODE = 1; - document.ATTRIBUTE_NODE = 2; - document.TEXT_NODE = 3; - document.CDATA_SECTION_NODE = 4; - document.ENTITY_REFERENCE_NODE = 5; - document.ENTITY_NODE = 6; - document.PROCESSING_INSTRUCTION_NODE = 7; - document.COMMENT_NODE = 8; - document.DOCUMENT_NODE = 9; - document.DOCUMENT_TYPE_NODE = 10; - document.DOCUMENT_FRAGMENT_NODE = 11; - document.NOTATION_NODE = 12; -} - -function importNode(doc, node, allChildren) { - if( !doc.importNode ) { - /* find the node type to import */ - switch (node.nodeType) { - case doc.ELEMENT_NODE: - /* create a new element */ - var newNode = doc.createElement(node.nodeName); - /* does the node have any attributes to add? */ - if (node.attributes && node.attributes.length > 0) - /* add all of the attributes */ - for (var i = 0, il = node.attributes.length; i < il;) - newNode.setAttribute(node.attributes[i].nodeName, node.getAttribute(node.attributes[i++].nodeName)); - /* are we going after children too, and does the node have any? */ - if (allChildren && node.childNodes && node.childNodes.length > 0) - /* recursively get all of the child nodes */ - for (var i = 0, il = node.childNodes.length; i < il;) - newNode.appendChild(importNode(doc, node.childNodes[i++], allChildren)); - return newNode; - break; - case document.TEXT_NODE: - case document.CDATA_SECTION_NODE: - case document.COMMENT_NODE: - return doc.createTextNode(node.nodeValue); - break; - } - } else { - return doc.importNode( node, allChildren ); - } -} - -/** - * @return doc {Document} - */ -function parseXmlToDoc( xml ) { - var doc = null; - if( Ext.isIE ) { - // IE hack - doc = new ActiveXObject("Msxml.DOMDocument"); - doc.loadXML( xml ); - } else { - var parser = new DOMParser(); - doc = parser.parseFromString(xml, "text/xml"); - } - - return doc; -} - -function serializeNode( node ) { - var xml = Try.these( - function() { return (new XMLSerializer()).serializeToString(node); }, - function() { - var doc = new ActiveXObject("Msxml.DOMDocument"); - var node = importNode( doc, node, true ); - doc.appendChild( node ); - - return doc.xml; - } - ); - - return xml; -} - -function createDocument() { - return Try.these( - function() { return document.implementation.createDocument("", "", null); }, - function() { return new ActiveXObject("Msxml.DOMDocument"); } - ); -} - -document._importNode = function( node, allChildren ) { - return importNode( document, node, allChildren ); -} \ No newline at end of file Modified: trunk/src/main/javascript/muc/MucPresenceFilter.js =================================================================== --- trunk/src/main/javascript/muc/MucPresenceFilter.js 2008-02-23 07:20:28 UTC (rev 695) +++ trunk/src/main/javascript/muc/MucPresenceFilter.js 2008-02-23 09:50:46 UTC (rev 696) @@ -31,8 +31,8 @@ // if this element contains a muc user extension // TODO ideally this would load real packet extensions, but... var elements = packet.getNode().childNodes; - for( var i = 0; i < elements.length; i++ ) { - var elem = elements[i]; + for( var i = 0; i < elements.getLength(); i++ ) { + var elem = elements.item(i); // namespace matches. if( elem.namespaceURI == "http://jabber.org/protocol/muc#user" ) { @@ -44,4 +44,4 @@ } } -Ext.extend( Xmpp4Js.Muc.MucPresenceFilter, Xmpp4Js.PacketFilter.PacketFilter, Xmpp4Js.Muc.MucPresenceFilter.prototype); \ No newline at end of file +Ext.extend( Xmpp4Js.Muc.MucPresenceFilter, Xmpp4Js.PacketFilter.PacketFilter, Xmpp4Js.Muc.MucPresenceFilter.prototype); Modified: trunk/src/main/javascript/packet/Base.js =================================================================== --- trunk/src/main/javascript/packet/Base.js 2008-02-23 07:20:28 UTC (rev 695) +++ trunk/src/main/javascript/packet/Base.js 2008-02-23 09:50:46 UTC (rev 696) @@ -37,7 +37,7 @@ this.elem.setAttribute( "id", id ); }, getId : function() { - var id = this.elem.getAttribute( "id" ); + var id = this.elem.getAttribute( "id" ).toString(); if( !id ) { id = "id" + Math.random( 0,100 ); this.setId( id ); @@ -53,7 +53,7 @@ this.elem.setAttribute( "to", to ); }, getTo : function() { - return this.elem.getAttribute( "to" ); + return this.elem.getAttribute( "to" ).toString(); }, /** @@ -64,7 +64,7 @@ this.elem.setAttribute( "from", from ); }, getFrom : function() { - return this.elem.getAttribute( "from" ); + return this.elem.getAttribute( "from" ).toString(); }, /** @@ -75,7 +75,7 @@ this.elem.setAttribute( "to", to.toString() ); }, getToJid : function() { - return new Xmpp4Js.Jid(this.elem.getAttribute( "to" )); + return new Xmpp4Js.Jid(this.elem.getAttribute( "to" ).toString()); }, /** @@ -86,7 +86,7 @@ this.elem.setAttribute( "from", from.toString() ); }, getFromJid : function() { - return new Xmpp4Js.Jid(this.elem.getAttribute( "from" )); + return new Xmpp4Js.Jid(this.elem.getAttribute( "from" ).toString()); }, @@ -95,7 +95,7 @@ this.elem.setAttribute( "type", type ); }, getType : function() { - return this.elem.getAttribute( "type" ); + return this.elem.getAttribute( "type" ).toString(); }, setNode : function(node) { @@ -111,7 +111,7 @@ toString : function() { var string = "Packet [" - + "node (JSON)=" + (new XMLSerializer()).serializeToString(this.getNode()) + + "node (JSON)=" + ", type=" + this.getType() + ", from=" + this.getFrom() + ", to=" + this.getTo() @@ -133,11 +133,11 @@ childNode = DomBuilder.node( elemName ); childNode = this.elem.appendChild( childNode ); } - if( content instanceof Element ) { - var importedContent = importNode( this.elem.ownerDocument, content, true ); + if( content instanceof DOMElement ) { + var importedContent = this.elem.ownerDocument.importNode( content, true ); childNode.appendChild( importedContent ); } else { - childNode.textContent = content; + childNode.setTextContent( content ); } }, @@ -146,7 +146,7 @@ * Get a child element node if it exists. */ getChildElementNode : function(elemName) { - return this.elem.getElementsByTagName(elemName)[0]; + return this.elem.getElementsByTagName(elemName).item(0); }, /** @@ -157,7 +157,7 @@ var content = null; if( node ) { - content = node.textContent; + content = node.getStringValue(); } if( content == null || content == "" ) { @@ -232,13 +232,19 @@ /** @deprecated */ function createDocument() { - return Try.these( - function() { return document.implementation.createDocument("", "", null); }, - function() { return new ActiveXObject("Msxml.DOMDocument"); } - ); + return new DOMDocument(new DOMImplementation()); } +/** @deprecated */ +function serializeNode(node) { + return node.toString(); +} +/** @deprecated */ +function parseXmlToDoc(xml) { + return (new DOMImplementation()).loadXML(xml); +} + Modified: trunk/src/main/javascript/packet/IQ.js =================================================================== --- trunk/src/main/javascript/packet/IQ.js 2008-02-23 07:20:28 UTC (rev 695) +++ trunk/src/main/javascript/packet/IQ.js 2008-02-23 09:50:46 UTC (rev 696) @@ -32,14 +32,14 @@ this.elem.appendChild( elem ); }, getQuery : function() { - var elem = this.elem.getElementsByTagName("query")[0]; + var elem = this.elem.getElementsByTagName("query").item(0); return elem; }, /** @deprecated */ getQueryXMLNS : function() { var query = this.getQuery(); - return query ? query.getAttribute("xmlns") : ""; + return query ? query.getAttribute("xmlns").toString() : ""; } } Modified: trunk/src/main/javascript/packet/PacketExtension.js =================================================================== --- trunk/src/main/javascript/packet/PacketExtension.js 2008-02-23 07:20:28 UTC (rev 695) +++ trunk/src/main/javascript/packet/PacketExtension.js 2008-02-23 09:50:46 UTC (rev 696) @@ -26,14 +26,14 @@ createNode : function() { var doc = this.stanza.getNode().ownerDocument; - this.elem = this.stanza.getNode().appendChild( createElementNS(doc, this.getElementNS(), this.getElementName() ) ); + this.elem = this.stanza.getNode().appendChild( doc.createElementNS( this.getElementNS(), this.getElementName() ) ); }, readNode : function() { //this.elem = stanza.getNode().getElementsByTagNameNS( this.getElementNS(), this.getElementName() )[0]; var nodes = this.stanza.getNode().childNodes; - for( var i = 0; i < nodes.length; i++ ) { - var child = nodes[i]; + for( var i = 0; i < nodes.getLength(); i++ ) { + var child = nodes.item(i); if( child.namespaceURI == this.getElementNS() ) { this.elem = child; break; @@ -116,8 +116,8 @@ var extensions = []; var children = stanza.getNode().childNodes; - for( var i = 0; i < children.length; i++ ) { - var child = children[i]; + for( var i = 0; i < children.getLength(); i++ ) { + var child = children.item(i); try { var ext = this.read( child.namespaceURI, stanza ); @@ -164,7 +164,7 @@ // add the new state var doc = this.getNode().ownerDocument; - var node = createElementNS(doc, this.getElementNS(), this.getElementName() ); + var node = doc.createElementNS( this.getElementNS(), this.getElementName() ); this.setNode( node ); @@ -245,8 +245,8 @@ readNode : function() { Xmpp4Js.Ext.Error.superclass.readNode.call( this ); - this.code = this.getNode().getAttribute( "code"); - this.type = this.getNode().getAttribute( "type"); + this.code = this.getNode().getAttribute( "code").toString(); + this.type = this.getNode().getAttribute( "type").toString(); }, createNode : function(code, type) { // since getElementName returns this.state, and createNode creates @@ -293,7 +293,7 @@ setEvent : function(event) { if( this.event ) { // remove the current event if not null / Xmpp4Js.Ext.MessageEvent.EVENT_EMPTY - var node = this.elem.getElementsByTagName( this.event )[0]; + var node = this.elem.getElementsByTagName( this.event ).item(0); this.getNode().removeChild( node ); } Modified: trunk/src/main/javascript/packet/PacketListenerManager.js =================================================================== --- trunk/src/main/javascript/packet/PacketListenerManager.js 2008-02-23 07:20:28 UTC (rev 695) +++ trunk/src/main/javascript/packet/PacketListenerManager.js 2008-02-23 09:50:46 UTC (rev 696) @@ -63,8 +63,8 @@ wrapper.listener( packetNode ); } } else { - for( var j = 0; j < packetNode.childNodes.length; j++ ) { - var node = packetNode.childNodes[j]; + for( var j = 0; j < packetNode.childNodes.getLength(); j++ ) { + var node = packetNode.childNodes.item(j); // if it's not a normal element ignore it if( node.nodeType != 1 /* ELEMENT - are there cross-browser constants? */) { @@ -92,4 +92,4 @@ } } } -} \ No newline at end of file +} Modified: trunk/src/main/javascript/packet/Presence.js =================================================================== --- trunk/src/main/javascript/packet/Presence.js 2008-02-23 07:20:28 UTC (rev 695) +++ trunk/src/main/javascript/packet/Presence.js 2008-02-23 09:50:46 UTC (rev 696) @@ -22,7 +22,7 @@ Xmpp4Js.Packet.Presence.prototype = { getType : function() { - var type = this.elem.getAttribute( "type" ); + var type = this.elem.getAttribute( "type" ).toString(); return type ? type : "available"; }, @@ -72,4 +72,4 @@ } } -Ext.extend( Xmpp4Js.Packet.Presence, Xmpp4Js.Packet.Base, Xmpp4Js.Packet.Presence.prototype); \ No newline at end of file +Ext.extend( Xmpp4Js.Packet.Presence, Xmpp4Js.Packet.Base, Xmpp4Js.Packet.Presence.prototype); Modified: trunk/src/main/javascript/packet/Registration.js =================================================================== --- trunk/src/main/javascript/packet/Registration.js 2008-02-23 07:20:28 UTC (rev 695) +++ trunk/src/main/javascript/packet/Registration.js 2008-02-23 09:50:46 UTC (rev 696) @@ -13,7 +13,7 @@ for( var k in fields ) { var child = queryNode.ownerDocument.createElement( k ); - child.textContent = fields[k]; + child.setTextContent( fields[k] ); queryNode.appendChild( child ); } @@ -27,4 +27,4 @@ // a way to get result if this is a result packet (registered with stanza provider). } -Ext.extend( Xmpp4Js.Packet.Registration, Xmpp4Js.Packet.IQ, Xmpp4Js.Packet.Registration.prototype); \ No newline at end of file +Ext.extend( Xmpp4Js.Packet.Registration, Xmpp4Js.Packet.IQ, Xmpp4Js.Packet.Registration.prototype); Modified: trunk/src/main/javascript/packetfilter/Errors.js =================================================================== --- trunk/src/main/javascript/packetfilter/Errors.js 2008-02-23 07:20:28 UTC (rev 695) +++ trunk/src/main/javascript/packetfilter/Errors.js 2008-02-23 09:50:46 UTC (rev 696) @@ -80,7 +80,7 @@ Xmpp4Js.PacketFilter.TerminalErrorPacketFilter.prototype = { accept : function(bodyElement) { - return bodyElement.getAttribute( "type" ) == "terminate" && Xmpp4Js.PacketFilter.TerminalErrorPacketFilter.conditions[ bodyElement.getAttribute("condition") ] != undefined; + return bodyElement.getAttribute( "type" ).toString() == "terminate" && Xmpp4Js.PacketFilter.TerminalErrorPacketFilter.conditions[ bodyElement.getAttribute("condition").toString() ] != undefined; } } @@ -108,8 +108,8 @@ Xmpp4Js.PacketFilter.RecoverableErrorPacketFilter.prototype = { accept : function(bodyElement) { - return bodyElement.getAttribute( "type" ) == "error"; + return bodyElement.getAttribute( "type" ).toString() == "error"; } } -Ext.extend( Xmpp4Js.PacketFilter.RecoverableErrorPacketFilter, Xmpp4Js.PacketFilter.RawPacketFilter, Xmpp4Js.PacketFilter.RecoverableErrorPacketFilter.prototype); \ No newline at end of file +Ext.extend( Xmpp4Js.PacketFilter.RecoverableErrorPacketFilter, Xmpp4Js.PacketFilter.RawPacketFilter, Xmpp4Js.PacketFilter.RecoverableErrorPacketFilter.prototype); Modified: trunk/src/main/javascript/packetfilter/PacketExtensionFilter.js =================================================================== --- trunk/src/main/javascript/packetfilter/PacketExtensionFilter.js 2008-02-23 07:20:28 UTC (rev 695) +++ trunk/src/main/javascript/packetfilter/PacketExtensionFilter.js 2008-02-23 09:50:46 UTC (rev 696) @@ -16,8 +16,8 @@ // just check child element namespaces. var node = packet.getNode(); - for( var i = 0; i < node.childNodes.length; i++ ) { - if( node.childNodes[i].namespaceURI == this.extensionNS ) { + for( var i = 0; i < node.childNodes.getLength(); i++ ) { + if( node.childNodes.item(i).namespaceURI == this.extensionNS ) { return true; } } Modified: trunk/src/main/javascript/roster/RosterItemManager.js =================================================================== --- trunk/src/main/javascript/roster/RosterItemManager.js 2008-02-23 07:20:28 UTC (rev 695) +++ trunk/src/main/javascript/roster/RosterItemManager.js 2008-02-23 09:50:46 UTC (rev 696) @@ -149,20 +149,20 @@ */ rosterPacketListener: function( packet ) { var itemNodes = packet.getQuery().getElementsByTagName("item"); - for ( var i=0; i < itemNodes.length; i++ ) { - var item = itemNodes[i]; + for ( var i=0; i < itemNodes.getLength(); i++ ) { + var item = itemNodes.item(i); - var jid = item.getAttribute( "jid" ); - var name = item.getAttribute( "name" ); - var subscription = item.getAttribute( "subscription" ); // none, to, from, both, remove - var ask = item.getAttribute( "ask" ); // subscribe, unsubscribe + var jid = item.getAttribute( "jid" ).toString(); + var name = item.getAttribute( "name" ).toString(); + var subscription = item.getAttribute( "subscription" ).toString(); // none, to, from, both, remove + var ask = item.getAttribute( "ask" ).toString(); // subscribe, unsubscribe var groups = []; var groupNodes = item.getElementsByTagName("group"); - for( var j = 0; j < groupNodes.length; j++ ) { - var node = groupNodes[j]; - groups.push( node.textContent ); + for( var j = 0; j < groupNodes.getLength(); j++ ) { + var node = groupNodes.item(j); + groups.push( node.getStringValue() ); } this.update( jid, name, subscription, ask, groups ); @@ -183,7 +183,7 @@ * @param {Xmpp4Js.Packet.IQ} packet Could be class of roster packet. */ rosterSubSyncPacketListener: function( presence ) { - var subsyncNode = presence.getNode().getElementsByTagNameNS("http://jabber.org/protocol/roster-subsync", "x")[0]; + var subsyncNode = presence.getNode().getElementsByTagNameNS("http://jabber.org/protocol/roster-subsync", "x").item(0); // TODO create a subsync packet filter. if( !subsyncNode ) { return; @@ -194,19 +194,19 @@ var itemNodes = subsyncNode.getElementsByTagName("item"); - for ( var i=0; i < itemNodes.length; i++ ) { - var item = itemNodes[i]; + for ( var i=0; i < itemNodes.getLength(); i++ ) { + var item = itemNodes.item(i); - var name = item.getAttribute( "name" ); - var subscription = item.getAttribute( "subscription" ); // none, to, from, both, remove - var ask = item.getAttribute( "ask" ); // subscribe, unsubscribe + var name = item.getAttribute( "name" ).toString(); + var subscription = item.getAttribute( "subscription" ).toString(); // none, to, from, both, remove + var ask = item.getAttribute( "ask" ).toString(); // subscribe, unsubscribe var groups = []; var groupNodes = item.getElementsByTagName("group"); - for( var j = 0; j < groupNodes.length; j++ ) { - var node = groupNodes[j]; - groups.push( node.textContent ); + for( var j = 0; j < groupNodes.getLength(); j++ ) { + var node = groupNodes.item(j); + groups.push( node.getStringValue() ); } this.update( jid, name, subscription, ask, groups ); Modified: trunk/src/main/javascript/roster/RosterPacket.js =================================================================== --- trunk/src/main/javascript/roster/RosterPacket.js 2008-02-23 07:20:28 UTC (rev 695) +++ trunk/src/main/javascript/roster/RosterPacket.js 2008-02-23 09:50:46 UTC (rev 696) @@ -33,7 +33,7 @@ var group = groups[i]; var groupNode = item.appendChild( doc.createElement( "group" ) ); groupNode.setAttribute( "xmlns", "jabber:iq:roster" ); - groupNode.textContent = group; + groupNode.setTextContent( group ); } } } @@ -48,6 +48,6 @@ if( !Xmpp4Js.Packet.StanzaProvider.IQProvider( stanzaNode ) ) { return false; } - var queryNode = stanzaNode.getElementsByTagName("query" )[0]; - return queryNode !== undefined && queryNode.namespaceURI == "jabber:iq:roster"; + var queryNode = stanzaNode.getElementsByTagName("query" ).item(0); + return queryNode != undefined && queryNode.namespaceURI == "jabber:iq:roster"; } Modified: trunk/src/main/javascript/transport/BOSH.js =================================================================== --- trunk/src/main/javascript/transport/BOSH.js 2008-02-23 07:20:28 UTC (rev 695) +++ trunk/src/main/javascript/transport/BOSH.js 2008-02-23 09:50:46 UTC (rev 696) @@ -271,11 +271,11 @@ //this.un("recv", arguments.callee /* the current function */, this ); - this.sid = packetNode.getAttribute( "sid" ); - this.maxRequests = packetNode.getAttribute( "requests" ); + this.sid = packetNode.getAttribute( "sid" ).toString(); + this.maxRequests = packetNode.getAttribute( "requests" ).toString(); if( packetNode.hasAttribute("hold") ) { - this.hold = packetNode.getAttribute("hold"); + this.hold = packetNode.getAttribute("hold").toString(); } else { // sensible default this.hold = packetNode.maxRequests - 1; @@ -283,7 +283,7 @@ if( packetNode.hasAttribute("wait") ) { // FIXME ideally xhr's timeout should be updated - this.wait = packetNode.getAttribute("wait"); + this.wait = packetNode.getAttribute("wait").toString(); } this.startup(); @@ -355,7 +355,7 @@ this.addFrameData( packetNode ); - var xml = serializeNode(packetNode); + var xml = packetNode.toString(); this.fireEvent( "write", packetNode ); @@ -380,7 +380,7 @@ var packetNode = null; - if( response.responseXML != null ) { + if( response.responseText != null ) { // 17.4 XML Stanza Conditions? // this condition would be true if we closed the connection // before a response was received @@ -390,7 +390,7 @@ // inturruption before the server responded. figure out // how to handle this. - packetNode = response.responseXML.documentElement; + packetNode = new DOMImplementation().loadXML( response.responseText ).documentElement; } /* @@ -417,7 +417,7 @@ var condition = null; if( packetNode != null ) { - condition = packetNode.getAttribute( "condition" ); + condition = packetNode.getAttribute( "condition" ).toString(); } else if( !response.status ) { condition = "undefined-condition"; } else if( response.status != 200 ){ @@ -430,7 +430,7 @@ var message = Xmpp4Js.PacketFilter.TerminalErrorPacketFilter.conditions[ condition ].message; this.fireEvent( "termerror", title, message, packetNode ); - } else if( packetNode.getAttribute("type") == "error" ) { + } else if( packetNode.getAttribute("type").toString() == "error" ) { // 17.3 Recoverable Binding Conditions // TODO this should attempt to resend all packets back @@ -571,4 +571,4 @@ } } -Ext.extend( Xmpp4Js.Transport.BOSH, Ext.util.Observable, Xmpp4Js.Transport.BOSH.prototype ); \ No newline at end of file +Ext.extend( Xmpp4Js.Transport.BOSH, Ext.util.Observable, Xmpp4Js.Transport.BOSH.prototype ); Modified: trunk/src/test/javascript/BOSHTransportTest.html =================================================================== --- trunk/src/test/javascript/BOSHTransportTest.html 2008-02-23 07:20:28 UTC (rev 695) +++ trunk/src/test/javascript/BOSHTransportTest.html 2008-02-23 09:50:46 UTC (rev 696) @@ -37,14 +37,14 @@ // make sure that txPacket is an Element assertNotUndefined( "txPacket was empty", txPacket ); - assertTrue( "txPacket was not an element.", txPacket instanceof Element ); + assertTrue( "txPacket was not an element.", txPacket instanceof DOMElement ); // make sure we are adding attributes to raw packets - assertEquals( "txPacket did not have correct wait", bosh.wait, txPacket.getAttribute( "wait" ) ); - assertEquals( "txPacket did not have correct to", bosh.domain, txPacket.getAttribute( "to" ) ); + assertEquals( "txPacket did not have correct wait", bosh.wait, txPacket.getAttribute( "wait" ).toString() ); + assertEquals( "txPacket did not have correct to", bosh.domain, txPacket.getAttribute( "to" ).toString() ); - assertEquals( "txPacket did not have correct BOSH version", "1.6", txPacket.getAttribute( "ver" ) ); - assertEquals( "txPacket did not have correct xmpp version", "1.0", txPacket.getAttribute( "xmpp:version" ) ); + assertEquals( "txPacket did not have correct BOSH version", "1.6", txPacket.getAttribute( "ver" ).toString() ); + assertEquals( "txPacket did not have correct xmpp version", "1.0", txPacket.getAttribute( "xmpp:version" ).toString() ); assertTrue( "txPacket did not have a route", txPacket.hasAttribute( "route" ) ); assertTrue( "txPacket does not have a rid", txPacket.hasAttribute( "rid" ) ); @@ -59,7 +59,8 @@ var packet = packetHelper.createPacket(); var iq = packetHelper.createIQ( "te...@te...", "set", "jabber:iq:roster" ); - packet.appendChild( iq.getNode() ); + var node = packet.ownerDocument.importNode( iq.getNode(), true ); + packet.appendChild( node ); // setup variable to be caught on tx var txPacket = undefined; @@ -76,7 +77,7 @@ // make sure that txPacket is an Element assertNotUndefined( "txPacket was empty", txPacket ); - assertTrue( "txPacket was not an element.", txPacket instanceof Element ); + assertTrue( "txPacket was not an element.", txPacket instanceof DOMElement ); // make sure we are adding attributes to raw packets assertTrue( "txPacket did not have an RID", txPacket.hasAttribute( "rid" ) ); @@ -90,7 +91,8 @@ var packet = packetHelper.createPacket(); var iq = packetHelper.createIQ( "te...@te...", "set", "jabber:iq:roster" ); - packet.appendChild( iq.getNode() ); + var node = packet.ownerDocument.importNode( iq.getNode(), true ); + packet.appendChild( node ); bosh.beginSession(); @@ -99,7 +101,7 @@ var inititalRid = null; bosh.on( "write", function(packetNode) { - inititalRid = parseInt(packetNode.getAttribute( "rid" )); + inititalRid = parseInt(packetNode.getAttribute( "rid" ).toString()); }, this, {single:true}); bosh.write( packet ); @@ -108,7 +110,7 @@ var nextRid = null; bosh.on( "write", function(packetNode) { - nextRid = parseInt(packetNode.getAttribute( "rid" )); + nextRid = parseInt(packetNode.getAttribute( "rid" ).toString()); }, this); bosh.write( packet ); Modified: trunk/src/test/javascript/ChatManagerTest.html =================================================================== --- trunk/src/test/javascript/ChatManagerTest.html 2008-02-23 07:20:28 UTC (rev 695) +++ trunk/src/test/javascript/ChatManagerTest.html 2008-02-23 09:50:46 UTC (rev 696) @@ -139,15 +139,13 @@ function testReceiveMessage_Event() { var packet = loadTestPacket( "packets/incoming_message_chat.xml" ); - var stanzaNode = packet.getElementsByTagName("message" )[0]; + var stanzaNode = packet.getElementsByTagName("message" ).item(0); var wasInvoked = false; - var chat = chatMan.createChat( "te...@te...", THREAD_ID, function(chat, collector) { + var chat = chatMan.createChat( "te...@te...", THREAD_ID, function(chat, msg) { wasInvoked = true; - var msg = collector.pollResult(); - assertNotUndefined( msg ); assertEquals( THREAD_ID, msg.getThread() ); assertEquals( "te...@te...", msg.getFrom() ); @@ -162,15 +160,13 @@ function testReceiveMessage_Event_Two() { var packet = loadTestPacket( "packets/incoming_message_chat.xml" ); - var stanzaNode = packet.getElementsByTagName("message" )[0]; + var stanzaNode = packet.getElementsByTagName("message" ).item(0); var invokationCount = 0; - var chat = chatMan.createChat( "te...@te...", THREAD_ID, function(chat, collector) { + var chat = chatMan.createChat( "te...@te...", THREAD_ID, function(chat, msg) { invokationCount++; - var msg = collector.pollResult(); - assertNotUndefined( msg ); assertEquals( THREAD_ID, msg.getThread() ); assertEquals( "te...@te...", msg.getFrom() ); @@ -186,16 +182,14 @@ function testReceiveMessage_Event_New() { var packet = loadTestPacket( "packets/incoming_message_chat.xml" ); - var stanzaNode = packet.getElementsByTagName("message" )[0]; + var stanzaNode = packet.getElementsByTagName("message" ).item(0); var invokationCount = 0; - var chat = chatMan.createChat( "te...@te...", THREAD_ID, function(chat, collector) { + var chat = chatMan.createChat( "te...@te...", THREAD_ID, function(chat, msg) { invokationCount++; - var msg = collector.pollResult(); - assertNotUndefined( msg ); assertEquals( THREAD_ID, msg.getThread() ); assertEquals( "te...@te...", msg.getFrom() ); Modified: trunk/src/test/javascript/DomBuilderTest.html =================================================================== --- trunk/src/test/javascript/DomBuilderTest.html 2008-02-23 07:20:28 UTC (rev 695) +++ trunk/src/test/javascript/DomBuilderTest.html 2008-02-23 09:50:46 UTC (rev 696) @@ -28,44 +28,44 @@ function testElementName() { var elem = DomBuilder.node( ELEM_NAME ); - assertEquals( ELEM_NAME, elem.localName ); + assertEquals( ELEM_NAME, elem.nodeName ); } function testAttributes() { var elem = DomBuilder.node( ELEM_NAME, {"attr1": TEXT} ); assertTrue( elem.hasAttribute( "attr1" ) ); - assertEquals( TEXT, elem.getAttribute( "attr1" ) ); + assertEquals( TEXT, elem.getAttribute( "attr1" ).toString() ); } function testChildNodes() { var childNode = DomBuilder.node(ELEM_NAME); var elem = DomBuilder.node( ELEM_NAME, undefined, [childNode] ); - assertEquals( 1, elem.childNodes.length ); - assertEquals( childNode, elem.childNodes[0] ); + assertEquals( 1, elem.childNodes.getLength() ); + assertEquals( childNode, elem.childNodes.item(0) ); } function testTextContent() { var elem = DomBuilder.node( ELEM_NAME, undefined, undefined, TEXT ); - assertEquals( 1, elem.childNodes.length ); + assertEquals( 1, elem.childNodes.getLength() ); - var textNode = elem.childNodes[0]; + var textNode = elem.childNodes.item(0); assertEquals( NODETYPE_TEXT, textNode.nodeType ); - assertEquals( TEXT, textNode.textContent ); + assertEquals( TEXT, textNode.getStringValue() ); } function testChildNodesAndTextContent() { var childNode = DomBuilder.node(ELEM_NAME); var elem = DomBuilder.node( ELEM_NAME, undefined, [childNode], TEXT ); - assertEquals( 2, elem.childNodes.length ); - assertEquals( childNode, elem.childNodes[0] ); + assertEquals( 2, elem.childNodes.getLength() ); + assertEquals( childNode, elem.childNodes.item(0) ); - var textNode = elem.childNodes[1]; + var textNode = elem.childNodes.item(1); assertEquals( NODETYPE_TEXT, textNode.nodeType ); - assertEquals( TEXT, textNode.textContent ); + assertEquals( TEXT, textNode.getStringValue() ); } function testParentDoc() { Modified: trunk/src/test/javascript/DomHacksTest.html =================================================================== --- trunk/src/test/javascript/DomHacksTest.html 2008-02-23 07:20:28 UTC (rev 695) +++ trunk/src/test/javascript/DomHacksTest.html 2008-02-23 09:50:46 UTC (rev 696) @@ -17,15 +17,15 @@ function tearDown() { } -function testCreateDocument() { - var doc = createDocument(); - assertTrue( doc instanceof Document ); - - var doc2 = createDocument(); - assertTrue( doc instanceof Document ); - - assertNotEquals( doc, doc2 ); -} +//function testCreateDocument() { +// var doc = createDocument(); +// assertTrue( doc instanceof Document ); +// +// var doc2 = createDocument(); +// assertTrue( doc instanceof Document ); +// +// assertNotEquals( doc, doc2 ); +//} // TODO test deep imports. function testImportNode() { @@ -34,37 +34,37 @@ var elem = doc.createElement( "div" ); - var elem2 = importNode( doc2, elem, true ); + var elem2 = doc2.importNode( elem, true ); - assertTrue( elem2 instanceof Element ); + assertTrue( elem2 instanceof DOMElement ); // jsunit bug? //assertObjectEquals( elem2.ownerDocument, doc2 ); assertNotEquals( elem, elem2 ); } -function testParseXmlToDoc() { - var xml = '<iq type="get"><query xmlns="jabber:iq:version"/></iq>'; +//function testParseXmlToDoc() { +// var xml = '<iq type="get"><query xmlns="jabber:iq:version"/></iq>'; +// +// var doc = parseXmlToDoc( xml ); +// +// assertTrue( doc instanceof Document ); +// assertEquals( "iq", doc.documentElement.nodeName ); +// assertEquals( "query", doc.documentElement.firstChild.nodeName ); +// assertEquals( "jabber:iq:version", doc.documentElement.firstChild.namespaceURI ); +// +//} - var doc = parseXmlToDoc( xml ); - - assertTrue( doc instanceof Document ); - assertEquals( "iq", doc.documentElement.nodeName ); - assertEquals( "query", doc.documentElement.firstChild.nodeName ); - assertEquals( "jabber:iq:version", doc.documentElement.firstChild.namespaceURI ); +//function testSerializeXml() { +// var xml = '<iq type="get"><query xmlns="jabber:iq:version"/></iq>'; +// +// var doc = parseXmlToDoc( xml ); +// +// var outXml = serializeNode( doc.documentElement ); +// +// assertEquals( xml, outXml ); +//} -} -function testSerializeXml() { - var xml = '<iq type="get"><query xmlns="jabber:iq:version"/></iq>'; - - var doc = parseXmlToDoc( xml ); - - var outXml = serializeNode( doc.documentElement ); - - assertEquals( xml, outXml ); -} - - </script> </body> </html> Modified: trunk/src/test/javascript/ExtensionProviderTest.html =================================================================== --- trunk/src/test/javascript/ExtensionProviderTest.html 2008-02-23 07:20:28 UTC (rev 695) +++ trunk/src/test/javascript/ExtensionProviderTest.html 2008-02-23 09:50:46 UTC (rev 696) @@ -37,9 +37,9 @@ var children = msg.getNode().getElementsByTagNameNS( msgEvent.getElementNS(), msgEvent.getElementName() ); - assertEquals( 1, children.length ); - assertEquals( 1, children[0].childNodes.length ); - assertEquals( "composing", children[0].firstChild.nodeName ); + assertEquals( 1, children.getLength() ); + assertEquals( 1, children.item(0).childNodes.length ); + assertEquals( "composing", children.item(0).firstChild.nodeName ); } function testMessageEvent_Multiple() { @@ -49,9 +49,9 @@ var children = msg.getNode().getElementsByTagNameNS( msgEvent.getElementNS(), msgEvent.getElementName() ); - assertEquals( 1, children.length ); - assertEquals( 1, children[0].childNodes.length ); - assertEquals( "pooping", children[0].firstChild.nodeName ); + assertEquals( 1, children.getLength() ); + assertEquals( 1, children.item(0).childNodes.length ); + assertEquals( "pooping", children.item(0).firstChild.nodeName ); } function testMessageEvent_Empty() { @@ -60,23 +60,23 @@ // test empty event constructor var children = msg.getNode().getElementsByTagNameNS( msgEvent.getElementNS(), msgEvent.getElementName() ); - assertEquals( 1, children.length ); - assertEquals( 0, children[0].childNodes.length ); + assertEquals( 1, children.getLength() ); + assertEquals( 0, children.item(0).childNodes.length ); assertEquals( Xmpp4Js.Ext.MessageEvent.EVENT_EMPTY, msgEvent.getEvent() ); // set an event and make sure all is well msgEvent.setEvent( "composing" ); children = msg.getNode().getElementsByTagNameNS( msgEvent.getElementNS(), msgEvent.getElementName() ); - assertEquals( 1, children.length ); - assertEquals( 1, children[0].childNodes.length ); - assertEquals( "composing", children[0].firstChild.nodeName ); + assertEquals( 1, children.getLength() ); + assertEquals( 1, children.item(0).childNodes.length ); + assertEquals( "composing", children.item(0).firstChild.nodeName ); assertEquals( "composing", msgEvent.getEvent() ); // then set event back and make sure we'll still good msgEvent.setEvent( Xmpp4Js.Ext.MessageEvent.EVENT_EMPTY ); children = msg.getNode().getElementsByTagNameNS( msgEvent.getElementNS(), msgEvent.getElementName() ); - assertEquals( 1, children.length ); - assertEquals( 0, children[0].childNodes.length ); + assertEquals( 1, children.getLength() ); + assertEquals( 0, children.item(0).childNodes.length ); assertEquals( Xmpp4Js.Ext.MessageEvent.EVENT_EMPTY, msgEvent.getEvent() ); } @@ -88,8 +88,8 @@ var children = msg.getNode().getElementsByTagNameNS( chatState.getElementNS(), chatState.getElementName() ); - assertEquals( 1, children.length ); - assertEquals( "active", children[0].nodeName ); + assertEquals( 1, children.getLength() ); + assertEquals( "active", children.item(0).nodeName ); } function testChatState_Multiple() { @@ -100,10 +100,10 @@ assertEquals( "away", chatState.getElementName() ); var children = msg.getNode().getElementsByTagNameNS( chatState.getElementNS(), chatState.getElementName() ); - assertEquals( 1, children.length ); + assertEquals( 1, children.getLength() ); var oldChildren = msg.getNode().getElementsByTagNameNS( "active", chatState.getElementName() ); - assertEquals( 0, oldChildren.length ); + assertEquals( 0, oldChildren.getLength() ); } function testPacket_GetExtension() { @@ -224,7 +224,7 @@ assertUndefined( chatState ); var children = msg.getNode().getElementsByTagNameNS( Xmpp4Js.Ext.ChatStates.XMLNS, "active" ); - assertEquals( 0, children.length ); + assertEquals( 0, children.getLength() ); } function BROKEN_testErrorExtension_PacketDefaultNS() { Modified: trunk/src/test/javascript/MUC_FilterTest.html =================================================================== --- trunk/src/test/javascript/MUC_FilterTest.html 2008-02-23 07:20:28 UTC (rev 695) +++ trunk/src/test/javascript/MUC_FilterTest.html 2008-02-23 09:50:46 UTC (rev 696) @@ -23,7 +23,7 @@ function testMucPresenceFilter_NoRoom_True() { var pres = new Xmpp4Js.Packet.Presence(undefined, "som...@so...", undefined, undefined, undefined); pres.setFrom( "on...@co.../firstwitch" ); - var node = createElementNS( pres.getNode().ownerDocument, "http://jabber.org/protocol/muc#user", "x"); + var node = pres.getNode().ownerDocument.createElementNS( "http://jabber.org/protocol/muc#user", "x"); pres.getNode().appendChild( node ); var pf = new Xmpp4Js.Muc.MucPresenceFilter(); @@ -35,7 +35,7 @@ function testMucPresenceFilter_NoRoom_False_WrongNS() { var pres = new Xmpp4Js.Packet.Presence(undefined, "som...@so...", undefined, undefined, undefined); pres.setFrom( "on...@co.../firstwitch" ); - var node = createElementNS( pres.getNode().ownerDocument, "WRONG http://jabber.org/protocol/muc#user", "x"); + var node = pres.getNode().ownerDocument.createElementNS( "WRONG http://jabber.org/protocol/muc#user", "x"); pres.getNode().appendChild( node ); @@ -48,7 +48,7 @@ function testMucPresenceFilter_Room_True() { var pres = new Xmpp4Js.Packet.Presence(undefined, "som...@so...", undefined, undefined, undefined); pres.setFrom( "on...@co.../firstwitch" ); - var node = createElementNS( pres.getNode().ownerDocument, "http://jabber.org/protocol/muc#user", "x"); + var node = pres.getNode().ownerDocument.createElementNS( "http://jabber.org/protocol/muc#user", "x"); pres.getNode().appendChild( node ); @@ -61,7 +61,7 @@ function testMucPresenceFilter_Room_False() { var pres = new Xmpp4Js.Packet.Presence(undefined, "som...@so...", undefined, undefined, undefined); pres.setFrom( "on...@co.../firstwitch" ); - var node = createElementNS( pres.getNode().ownerDocument, "WRONG http://jabber.org/protocol/muc#user", "x"); + var node = pres.getNode().ownerDocument.createElementNS( "WRONG http://jabber.org/protocol/muc#user", "x"); pres.getNode().appendChild( node ); @@ -74,7 +74,7 @@ function testMucPresenceFilter_Occupant_True() { var pres = new Xmpp4Js.Packet.Presence(undefined, "som...@so...", undefined, undefined, undefined); pres.setFrom( "on...@co.../firstwitch" ); - var node = createElementNS( pres.getNode().ownerDocument, "http://jabber.org/protocol/muc#user", "x"); + var node = pres.getNode().ownerDocument.createElementNS( "http://jabber.org/protocol/muc#user", "x"); pres.getNode().appendChild( node ); @@ -87,7 +87,7 @@ function testMucPresenceFilter_Occupant_False() { var pres = new Xmpp4Js.Packet.Presence(undefined, "som...@so...", undefined, undefined, undefined); pres.setFrom( "on...@co.../firstwitch" ); - var node = createElementNS( pres.getNode().ownerDocument, "WRONG http://jabber.org/protocol/muc#user", "x"); + var node = pres.getNode().ownerDocument.createElementNS( "WRONG http://jabber.org/protocol/muc#user", "x"); pres.getNode().appendChild( node ); Modified: trunk/src/test/javascript/MUC_JoinTest.html =================================================================== --- trunk/src/test/javascript/MUC_JoinTest.html 2008-02-23 07:20:28 UTC (rev 695) +++ trunk/src/test/javascript/MUC_JoinTest.html 2008-02-23 09:50:46 UTC (rev 696) @@ -49,8 +49,8 @@ // make a fake response options.responsePacket = loadTestPacket( "packets/muc_roomlist.xml", function(packet) { - packet.getElementsByTagName("iq" )[0].setAttribute( "id", txPacket.getElementsByTagName("iq" )[0].getAttribute( "id" ) ); - packet.getElementsByTagName("iq" )[0].setAttribute( "from", txPacket.getElementsByTagName("iq" )[0].getAttribute( "to" ) ); + packet.getElementsByTagName("iq" ).item(0).setAttribute( "id", txPacket.getElementsByTagName("iq" ).item(0).getAttribute( "id" ).toString() ); + packet.getElementsByTagName("iq" ).item(0).setAttribute( "from", txPacket.getElementsByTagName("iq" ).item(0).getAttribute( "to" ).toString() ); }); }); @@ -139,8 +139,8 @@ // make a fake response options.responsePacket = loadTestPacket( "file://C:/Documents and Settings/Harlan/My Documents/NetBeansProjects/xmpp4js/trunk/target/jsunit/packets/muc_join.xml", function(packet) { - packet.getElementsByTagName("presence" )[0].setAttribute( "id", txPacket.getElementsByTagName("presence" )[0].getAttribute( "id" ) ); - packet.getElementsByTagName("presence" )[0].setAttribute( "from", txPacket.getElementsByTagName("presence" )[0].getAttribute( "to" ) ); + packet.getElementsByTagName("presence" )[0].setAttribute( "id", txPacket.getElementsByTagName("presence" )[0].getAttribute( "id" ).toString() ); + packet.getElementsByTagName("presence" )[0].setAttribute( "from", txPacket.getElementsByTagName("presence" )[0].getAttribute( "to" ).toString() ); }); }); @@ -185,8 +185,8 @@ // make a fake response options.responsePacket = loadTestPacket( "file://C:/Documents and Settings/Harlan/My Documents/NetBeansProjects/xmpp4js/trunk/target/jsunit/packets/muc_join_conflictingnick.xml", function(packet) { - packet.getElementsByTagName("presence" )[0].setAttribute( "id", txPacket.getElementsByTagName("presence" )[0].getAttribute( "id" ) ); - packet.getElementsByTagName("presence" )[0].setAttribute( "from", txPacket.getElementsByTagName("presence" )[0].getAttribute( "to" ) ); + packet.getElementsByTagName("presence" )[0].setAttribute( "id", txPacket.getElementsByTagName("presence" )[0].getAttribute( "id" ).toString() ); + packet.getElementsByTagName("presence" )[0].setAttribute( "from", txPacket.getElementsByTagName("presence" )[0].getAttribute( "to" ).toString() ); }); }); @@ -219,8 +219,8 @@ // make a fake response options.responsePacket = loadTestPacket( "file://C:/Documents and Settings/Harlan/My Documents/NetBeansProjects/xmpp4js/trunk/target/jsunit/packets/muc_join_roomfull.xml", function(packet) { - packet.getElementsByTagName("presence" )[0].setAttribute( "id", txPacket.getElementsByTagName("presence" )[0].getAttribute( "id" ) ); - packet.getElementsByTagName("presence" )[0].setAttribute( "from", txPacket.getElementsByTagName("presence" )[0].getAttribute( "to" ) ); + packet.getElementsByTagName("presence" )[0].setAttribute( "id", txPacket.getElementsByTagName("presence" )[0].getAttribute( "id" ).toString() ); + packet.getElementsByTagName("presence" )[0].setAttribute( "from", txPacket.getElementsByTagName("presence" )[0].getAttribute( "to" ).toString() ); }); }); Modified: trunk/src/test/javascript/PacketFilterTest.html =================================================================== --- trunk/src/test/javascript/PacketFilterTest.html 2008-02-23 07:20:28 UTC (rev 695) +++ trunk/src/test/javascript/PacketFilterTest.html 2008-02-23 09:50:46 UTC (rev 696) @@ -26,7 +26,7 @@ var pf = new Xmpp4Js.PacketFilter.RawPacketFilter(); var packet = DomBuilder.node( "body", {xmlns: "http://jabber.org/protocol/httpbind"} ); - var stanzaNode = packet.getElementsByTagName("iq" )[0]; + var stanzaNode = packet.getElementsByTagName("iq" ).item(0); // RawPacket filters are special and take packet rather than stanza. var result = pf.accept( packet ); Modifie... [truncated message content] |
From: <h-i...@us...> - 2008-02-23 07:28:06
|
Revision: 695 http://xmpp4js.svn.sourceforge.net/xmpp4js/?rev=695&view=rev Author: h-iverson Date: 2008-02-22 23:20:28 -0800 (Fri, 22 Feb 2008) Log Message: ----------- all tests pass with new js DOM library. Modified Paths: -------------- branches/xml4script-port/trunk/src/main/javascript/packet/Base.js branches/xml4script-port/trunk/src/test/javascript/BOSHTransportTest.html branches/xml4script-port/trunk/src/test/javascript/ChatManagerTest.html branches/xml4script-port/trunk/src/test/javascript/DomBuilderTest.html branches/xml4script-port/trunk/src/test/javascript/DomHacksTest.html branches/xml4script-port/trunk/src/test/javascript/ExtensionProviderTest.html Modified: branches/xml4script-port/trunk/src/main/javascript/packet/Base.js =================================================================== --- branches/xml4script-port/trunk/src/main/javascript/packet/Base.js 2008-02-23 06:39:38 UTC (rev 694) +++ branches/xml4script-port/trunk/src/main/javascript/packet/Base.js 2008-02-23 07:20:28 UTC (rev 695) @@ -111,7 +111,7 @@ toString : function() { var string = "Packet [" - + "node (JSON)=" + (new XMLSerializer()).serializeToString(this.getNode()) + + "node (JSON)=" + ", type=" + this.getType() + ", from=" + this.getFrom() + ", to=" + this.getTo() @@ -235,7 +235,16 @@ return new DOMDocument(new DOMImplementation()); } +/** @deprecated */ +function serializeNode(node) { + return node.toString(); +} +/** @deprecated */ +function parseXmlToDoc(xml) { + return (new DOMImplementation()).loadXML(xml); +} + Modified: branches/xml4script-port/trunk/src/test/javascript/BOSHTransportTest.html =================================================================== --- branches/xml4script-port/trunk/src/test/javascript/BOSHTransportTest.html 2008-02-23 06:39:38 UTC (rev 694) +++ branches/xml4script-port/trunk/src/test/javascript/BOSHTransportTest.html 2008-02-23 07:20:28 UTC (rev 695) @@ -37,14 +37,14 @@ // make sure that txPacket is an Element assertNotUndefined( "txPacket was empty", txPacket ); - assertTrue( "txPacket was not an element.", txPacket instanceof Element ); + assertTrue( "txPacket was not an element.", txPacket instanceof DOMElement ); // make sure we are adding attributes to raw packets - assertEquals( "txPacket did not have correct wait", bosh.wait, txPacket.getAttribute( "wait" ) ); - assertEquals( "txPacket did not have correct to", bosh.domain, txPacket.getAttribute( "to" ) ); + assertEquals( "txPacket did not have correct wait", bosh.wait, txPacket.getAttribute( "wait" ).toString() ); + assertEquals( "txPacket did not have correct to", bosh.domain, txPacket.getAttribute( "to" ).toString() ); - assertEquals( "txPacket did not have correct BOSH version", "1.6", txPacket.getAttribute( "ver" ) ); - assertEquals( "txPacket did not have correct xmpp version", "1.0", txPacket.getAttribute( "xmpp:version" ) ); + assertEquals( "txPacket did not have correct BOSH version", "1.6", txPacket.getAttribute( "ver" ).toString() ); + assertEquals( "txPacket did not have correct xmpp version", "1.0", txPacket.getAttribute( "xmpp:version" ).toString() ); assertTrue( "txPacket did not have a route", txPacket.hasAttribute( "route" ) ); assertTrue( "txPacket does not have a rid", txPacket.hasAttribute( "rid" ) ); @@ -59,7 +59,8 @@ var packet = packetHelper.createPacket(); var iq = packetHelper.createIQ( "te...@te...", "set", "jabber:iq:roster" ); - packet.appendChild( iq.getNode() ); + var node = packet.ownerDocument.importNode( iq.getNode(), true ); + packet.appendChild( node ); // setup variable to be caught on tx var txPacket = undefined; @@ -76,7 +77,7 @@ // make sure that txPacket is an Element assertNotUndefined( "txPacket was empty", txPacket ); - assertTrue( "txPacket was not an element.", txPacket instanceof Element ); + assertTrue( "txPacket was not an element.", txPacket instanceof DOMElement ); // make sure we are adding attributes to raw packets assertTrue( "txPacket did not have an RID", txPacket.hasAttribute( "rid" ) ); @@ -90,7 +91,8 @@ var packet = packetHelper.createPacket(); var iq = packetHelper.createIQ( "te...@te...", "set", "jabber:iq:roster" ); - packet.appendChild( iq.getNode() ); + var node = packet.ownerDocument.importNode( iq.getNode(), true ); + packet.appendChild( node ); bosh.beginSession(); @@ -99,7 +101,7 @@ var inititalRid = null; bosh.on( "write", function(packetNode) { - inititalRid = parseInt(packetNode.getAttribute( "rid" )); + inititalRid = parseInt(packetNode.getAttribute( "rid" ).toString()); }, this, {single:true}); bosh.write( packet ); @@ -108,7 +110,7 @@ var nextRid = null; bosh.on( "write", function(packetNode) { - nextRid = parseInt(packetNode.getAttribute( "rid" )); + nextRid = parseInt(packetNode.getAttribute( "rid" ).toString()); }, this); bosh.write( packet ); Modified: branches/xml4script-port/trunk/src/test/javascript/ChatManagerTest.html =================================================================== --- branches/xml4script-port/trunk/src/test/javascript/ChatManagerTest.html 2008-02-23 06:39:38 UTC (rev 694) +++ branches/xml4script-port/trunk/src/test/javascript/ChatManagerTest.html 2008-02-23 07:20:28 UTC (rev 695) @@ -143,11 +143,9 @@ var wasInvoked = false; - var chat = chatMan.createChat( "te...@te...", THREAD_ID, function(chat, collector) { + var chat = chatMan.createChat( "te...@te...", THREAD_ID, function(chat, msg) { wasInvoked = true; - var msg = collector.pollResult(); - assertNotUndefined( msg ); assertEquals( THREAD_ID, msg.getThread() ); assertEquals( "te...@te...", msg.getFrom() ); @@ -166,11 +164,9 @@ var invokationCount = 0; - var chat = chatMan.createChat( "te...@te...", THREAD_ID, function(chat, collector) { + var chat = chatMan.createChat( "te...@te...", THREAD_ID, function(chat, msg) { invokationCount++; - var msg = collector.pollResult(); - assertNotUndefined( msg ); assertEquals( THREAD_ID, msg.getThread() ); assertEquals( "te...@te...", msg.getFrom() ); @@ -191,11 +187,9 @@ var invokationCount = 0; - var chat = chatMan.createChat( "te...@te...", THREAD_ID, function(chat, collector) { + var chat = chatMan.createChat( "te...@te...", THREAD_ID, function(chat, msg) { invokationCount++; - var msg = collector.pollResult(); - assertNotUndefined( msg ); assertEquals( THREAD_ID, msg.getThread() ); assertEquals( "te...@te...", msg.getFrom() ); Modified: branches/xml4script-port/trunk/src/test/javascript/DomBuilderTest.html =================================================================== --- branches/xml4script-port/trunk/src/test/javascript/DomBuilderTest.html 2008-02-23 06:39:38 UTC (rev 694) +++ branches/xml4script-port/trunk/src/test/javascript/DomBuilderTest.html 2008-02-23 07:20:28 UTC (rev 695) @@ -28,7 +28,7 @@ function testElementName() { var elem = DomBuilder.node( ELEM_NAME ); - assertEquals( ELEM_NAME, elem.localName ); + assertEquals( ELEM_NAME, elem.nodeName ); } function testAttributes() { @@ -42,16 +42,16 @@ var childNode = DomBuilder.node(ELEM_NAME); var elem = DomBuilder.node( ELEM_NAME, undefined, [childNode] ); - assertEquals( 1, elem.childNodes.length ); - assertEquals( childNode, elem.childNodes[0] ); + assertEquals( 1, elem.childNodes.getLength() ); + assertEquals( childNode, elem.childNodes.item(0) ); } function testTextContent() { var elem = DomBuilder.node( ELEM_NAME, undefined, undefined, TEXT ); - assertEquals( 1, elem.childNodes.length ); + assertEquals( 1, elem.childNodes.getLength() ); - var textNode = elem.childNodes[0]; + var textNode = elem.childNodes.item(0); assertEquals( NODETYPE_TEXT, textNode.nodeType ); assertEquals( TEXT, textNode.getStringValue() ); } @@ -60,10 +60,10 @@ var childNode = DomBuilder.node(ELEM_NAME); var elem = DomBuilder.node( ELEM_NAME, undefined, [childNode], TEXT ); - assertEquals( 2, elem.childNodes.length ); - assertEquals( childNode, elem.childNodes[0] ); + assertEquals( 2, elem.childNodes.getLength() ); + assertEquals( childNode, elem.childNodes.item(0) ); - var textNode = elem.childNodes[1]; + var textNode = elem.childNodes.item(1); assertEquals( NODETYPE_TEXT, textNode.nodeType ); assertEquals( TEXT, textNode.getStringValue() ); } Modified: branches/xml4script-port/trunk/src/test/javascript/DomHacksTest.html =================================================================== --- branches/xml4script-port/trunk/src/test/javascript/DomHacksTest.html 2008-02-23 06:39:38 UTC (rev 694) +++ branches/xml4script-port/trunk/src/test/javascript/DomHacksTest.html 2008-02-23 07:20:28 UTC (rev 695) @@ -17,15 +17,15 @@ function tearDown() { } -function testCreateDocument() { - var doc = createDocument(); - assertTrue( doc instanceof Document ); - - var doc2 = createDocument(); - assertTrue( doc instanceof Document ); - - assertNotEquals( doc, doc2 ); -} +//function testCreateDocument() { +// var doc = createDocument(); +// assertTrue( doc instanceof Document ); +// +// var doc2 = createDocument(); +// assertTrue( doc instanceof Document ); +// +// assertNotEquals( doc, doc2 ); +//} // TODO test deep imports. function testImportNode() { @@ -42,29 +42,29 @@ assertNotEquals( elem, elem2 ); } -function testParseXmlToDoc() { - var xml = '<iq type="get"><query xmlns="jabber:iq:version"/></iq>'; +//function testParseXmlToDoc() { +// var xml = '<iq type="get"><query xmlns="jabber:iq:version"/></iq>'; +// +// var doc = parseXmlToDoc( xml ); +// +// assertTrue( doc instanceof Document ); +// assertEquals( "iq", doc.documentElement.nodeName ); +// assertEquals( "query", doc.documentElement.firstChild.nodeName ); +// assertEquals( "jabber:iq:version", doc.documentElement.firstChild.namespaceURI ); +// +//} - var doc = parseXmlToDoc( xml ); - - assertTrue( doc instanceof Document ); - assertEquals( "iq", doc.documentElement.nodeName ); - assertEquals( "query", doc.documentElement.firstChild.nodeName ); - assertEquals( "jabber:iq:version", doc.documentElement.firstChild.namespaceURI ); +//function testSerializeXml() { +// var xml = '<iq type="get"><query xmlns="jabber:iq:version"/></iq>'; +// +// var doc = parseXmlToDoc( xml ); +// +// var outXml = serializeNode( doc.documentElement ); +// +// assertEquals( xml, outXml ); +//} -} -function testSerializeXml() { - var xml = '<iq type="get"><query xmlns="jabber:iq:version"/></iq>'; - - var doc = parseXmlToDoc( xml ); - - var outXml = serializeNode( doc.documentElement ); - - assertEquals( xml, outXml ); -} - - </script> </body> </html> Modified: branches/xml4script-port/trunk/src/test/javascript/ExtensionProviderTest.html =================================================================== --- branches/xml4script-port/trunk/src/test/javascript/ExtensionProviderTest.html 2008-02-23 06:39:38 UTC (rev 694) +++ branches/xml4script-port/trunk/src/test/javascript/ExtensionProviderTest.html 2008-02-23 07:20:28 UTC (rev 695) @@ -103,7 +103,7 @@ assertEquals( 1, children.getLength() ); var oldChildren = msg.getNode().getElementsByTagNameNS( "active", chatState.getElementName() ); - assertEquals( 0, oldchildren.getLength() ); + assertEquals( 0, oldChildren.getLength() ); } function testPacket_GetExtension() { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <h-i...@us...> - 2008-02-23 06:39:34
|
Revision: 694 http://xmpp4js.svn.sourceforge.net/xmpp4js/?rev=694&view=rev Author: h-iverson Date: 2008-02-22 22:39:38 -0800 (Fri, 22 Feb 2008) Log Message: ----------- merged in changes from trunk Modified Paths: -------------- branches/xml4script-port/trunk/src/assembler/xmpp4js.xml branches/xml4script-port/trunk/src/main/javascript/transport/BOSH.js branches/xml4script-port/trunk/src/test/javascript/common-test-library.js Added Paths: ----------- branches/xml4script-port/trunk/src/test/javascript/BOSHTransportTest.html Removed Paths: ------------- branches/xml4script-port/trunk/src/test/javascript/BoundRosterTreeTest.html branches/xml4script-port/trunk/src/test/javascript/ChatRendererTest.html branches/xml4script-port/trunk/src/test/javascript/RosterTreeTest.html branches/xml4script-port/trunk/src/test/javascript/broken/BOSHTransportTest.html Modified: branches/xml4script-port/trunk/src/assembler/xmpp4js.xml =================================================================== --- branches/xml4script-port/trunk/src/assembler/xmpp4js.xml 2008-02-23 06:39:31 UTC (rev 693) +++ branches/xml4script-port/trunk/src/assembler/xmpp4js.xml 2008-02-23 06:39:38 UTC (rev 694) @@ -78,10 +78,9 @@ <include>muc/ext/**.js</include> <include>ext/**.js</include> - <include>gui/**.js</include> <include>workflow/**.js</include> </includes> </script> </scripts> -</assembler> \ No newline at end of file +</assembler> Modified: branches/xml4script-port/trunk/src/main/javascript/transport/BOSH.js =================================================================== --- branches/xml4script-port/trunk/src/main/javascript/transport/BOSH.js 2008-02-23 06:39:31 UTC (rev 693) +++ branches/xml4script-port/trunk/src/main/javascript/transport/BOSH.js 2008-02-23 06:39:38 UTC (rev 694) @@ -167,7 +167,18 @@ */ recv : true, + /** + * @event write + * @param {DomElement} the body element of the node about to be written. + * + * A packet node is about to be written. It includes all frame data, but + * the event is fired just before the open request count is incremented. + */ + write : true, + + + /** * @event error * @param {DomElement} the body element of the node received. * @@ -346,6 +357,8 @@ var xml = packetNode.toString(); + this.fireEvent( "write", packetNode ); + this.openRequestCount++; this.xhr.request({ @@ -405,6 +418,8 @@ var condition = null; if( packetNode != null ) { condition = packetNode.getAttribute( "condition" ).toString(); + } else if( !response.status ) { + condition = "undefined-condition"; } else if( response.status != 200 ){ condition = "status."+response.status; } else { Copied: branches/xml4script-port/trunk/src/test/javascript/BOSHTransportTest.html (from rev 692, trunk/src/test/javascript/BOSHTransportTest.html) =================================================================== --- branches/xml4script-port/trunk/src/test/javascript/BOSHTransportTest.html (rev 0) +++ branches/xml4script-port/trunk/src/test/javascript/BOSHTransportTest.html 2008-02-23 06:39:38 UTC (rev 694) @@ -0,0 +1,126 @@ +<html> + <head> + <title>JSUnit - RosterWindowTest</title> + <script language="javascript" src="app/jsUnitCore.js"></script> + + <script type="text/javascript" src="includes.js"></script> + <script type="text/javascript" src="common-test-library.js"></script> + + </head> + <body> + <script type="text/javascript"> + + + + +var bosh; + +function setUp() { + bosh = new MockBOSHTransport({ + domain: "test.com" + }); +} +function tearDown() { + bosh = null; +} + +function testBeginSession() { + // setup variable to be caught on tx + var txPacket = undefined; + + // create listener to catch outgoing packet + bosh.on( "write", function(packetNode) { + txPacket = packetNode; + }); + + bosh.beginSession(); + + // make sure that txPacket is an Element + assertNotUndefined( "txPacket was empty", txPacket ); + assertTrue( "txPacket was not an element.", txPacket instanceof Element ); + + // make sure we are adding attributes to raw packets + assertEquals( "txPacket did not have correct wait", bosh.wait, txPacket.getAttribute( "wait" ) ); + assertEquals( "txPacket did not have correct to", bosh.domain, txPacket.getAttribute( "to" ) ); + + assertEquals( "txPacket did not have correct BOSH version", "1.6", txPacket.getAttribute( "ver" ) ); + assertEquals( "txPacket did not have correct xmpp version", "1.0", txPacket.getAttribute( "xmpp:version" ) ); + + assertTrue( "txPacket did not have a route", txPacket.hasAttribute( "route" ) ); + assertTrue( "txPacket does not have a rid", txPacket.hasAttribute( "rid" ) ); + assertFalse( "txPacket has a sid", txPacket.hasAttribute( "sid" ) ); +} + +function testWriteRaw() { + + var packetHelper = new Xmpp4Js.Packet.PacketHelper(); + + // create raw packet with IQ element + var packet = packetHelper.createPacket(); + var iq = packetHelper.createIQ( "te...@te...", "set", "jabber:iq:roster" ); + + packet.appendChild( iq.getNode() ); + + // setup variable to be caught on tx + var txPacket = undefined; + + bosh.beginSession(); + + // create listener to catch outgoing packet + bosh.on( "write", function(packetNode) { + txPacket = packetNode; + }); + + // send the packet + bosh.write( packet ); + + // make sure that txPacket is an Element + assertNotUndefined( "txPacket was empty", txPacket ); + assertTrue( "txPacket was not an element.", txPacket instanceof Element ); + + // make sure we are adding attributes to raw packets + assertTrue( "txPacket did not have an RID", txPacket.hasAttribute( "rid" ) ); + assertTrue( "txPacket did not have an SID", txPacket.hasAttribute( "sid" ) ); +} + +function testWrite_RID() { + var packetHelper = new Xmpp4Js.Packet.PacketHelper(); + + // create raw packet with IQ element + var packet = packetHelper.createPacket(); + var iq = packetHelper.createIQ( "te...@te...", "set", "jabber:iq:roster" ); + + packet.appendChild( iq.getNode() ); + + bosh.beginSession(); + + + + var inititalRid = null; + + bosh.on( "write", function(packetNode) { + inititalRid = parseInt(packetNode.getAttribute( "rid" )); + }, this, {single:true}); + + bosh.write( packet ); + + assertNotNull( "no intitial RID was set", inititalRid ); + + var nextRid = null; + bosh.on( "write", function(packetNode) { + nextRid = parseInt(packetNode.getAttribute( "rid" )); + }, this); + + bosh.write( packet ); + assertEquals( "Rid did not increment 1", inititalRid + 1, nextRid ); + + bosh.write( packet ); + assertEquals( "Rid did not increment 2", inititalRid + 2, nextRid ); +} + + + </script> + </body> +</html> + + Deleted: branches/xml4script-port/trunk/src/test/javascript/BoundRosterTreeTest.html =================================================================== --- branches/xml4script-port/trunk/src/test/javascript/BoundRosterTreeTest.html 2008-02-23 06:39:31 UTC (rev 693) +++ branches/xml4script-port/trunk/src/test/javascript/BoundRosterTreeTest.html 2008-02-23 06:39:38 UTC (rev 694) @@ -1,233 +0,0 @@ -<html> - <head> - <title>JSUnit - RosterWindowTest</title> - <script language="javascript" src="app/jsUnitCore.js"></script> - - <script type="text/javascript" src="includes.js"></script> - <script type="text/javascript" src="common-test-library.js"></script> - - </head> - <body> - <script type="text/javascript"> - -var GROUP1 = "Group 1"; -var GROUP2 = "Group 2"; - -var ALIAS1 = "Alias 1"; -var ALIAS2 = "Alias 2"; - -var JID1 = "som...@so..."; -var JID2 = "som...@so..."; - -var JID_WITH_RESOURCE = JID1+"/resource1"; - -var tree; -var pm = null; -var rim = null; - -function setUp() { - pm = new Xmpp4Js.Roster.PresenceManager(); - rim = new Xmpp4Js.Roster.RosterItemManager(); - - tree = new Xmpp4Js.UI.Roster.BoundRosterTree({ - renderTo: document.body, - rim: rim, - pm: pm - }); -} - -function tearDown() { - delete tree; -} - -/** - * Ensure that item and group are created with first roster item packet. - * Make sure that it is null before presence but not after. - */ -function testAdd_SingleGroup_() { - rim.update( JID1, ALIAS1, "none", null, [GROUP1] ); - - var pres = new Xmpp4Js.Packet.Presence( "available", "lo...@so...", null, "normal", null ); - pres.setFrom( JID1+"/resource1" ); - pm.update( pres ); - - var group = tree.getGroup( GROUP1 ); - assertNotNull( "Group 1 is null", group ); - - item = tree.getItem( GROUP1, JID1 ); - assertNotNull( "Item is null after presence", item ); -} - -/** - * Ensure that multiple groups are created on first rotser item packet. - * Make sure that it is null before presence but not after. - */ -function testAdd_TwoGroups() { - rim.update( JID1, ALIAS1, "none", null, [GROUP1, GROUP2] ); - - var pres = new Xmpp4Js.Packet.Presence( "available", "lo...@so...", null, "normal", null ); - pres.setFrom( JID1+"/resource1" ); - pm.update( pres ); - - var group = tree.getGroup( GROUP1 ); - assertNotNull( "Group 1 is null but shouldn't be", group ); - - group = tree.getGroup( GROUP2 ); - assertNotNull( "Group 2 is null but shouldn't be", group ); - - var item = tree.getItem( GROUP1, JID1 ); - assertNotNull( "Item in Group 1 is null but shouldn't be", item ); - - item = tree.getItem( GROUP2, JID1 ); - assertNotNull( "Item in Group 2 is null but shouldn't be", item ); -} - -/** - * Ensure that there are no problems updating an entry in its own group - * Make sure that it is not null before presence nor after. - */ -function testUpdate_SingleGroup() { - rim.update( JID1, ALIAS1, "none", null, [GROUP1] ); - rim.update( JID1, ALIAS1, "none", null, [GROUP1] ); - - var pres = new Xmpp4Js.Packet.Presence( "available", "lo...@so...", null, "normal", null ); - pres.setFrom( JID1+"/resource1" ); - pm.update( pres ); - - var group = tree.getGroup( GROUP1 ); - assertNotNull( "Group 1 is null", group ); - - var item = tree.getItem( GROUP1, JID1 ); - assertNotNull( "Item is null", item ); -} - -/** - * Ensure that there are no problems when an entry changes groups. - */ -function testUpdate_Group1ToGroup2() { - rim.update( JID1, ALIAS1, "none", null, [GROUP1] ); - rim.update( JID1, ALIAS1, "none", null, [GROUP2] ); - - var pres = new Xmpp4Js.Packet.Presence( "available", "lo...@so...", null, "normal", null ); - pres.setFrom( JID1+"/resource1" ); - pm.update( pres ); - - // TODO remove group when it's completely empty - var group = tree.getGroup( GROUP1 ); - assertNotNull( "Group 1 is null", group ); - - group = tree.getGroup( GROUP2 ); - assertNotNull( "Group 2 is null", group ); - - // make sure item isn't in group 1 - var item = tree.getItem( GROUP1, JID1 ); - assertNull( "Item from Group 1 IS NOT null but should be", item ); - - item = tree.getItem( GROUP2, JID1 ); - assertNotNull( "Item from Group 2 IS null but shouldn't be", item ); -} - -/** - * Try removing an entry that exists in one gorup, and ensure that the item is gone. - * NOTE: groups are typically not specified in remove packets. - */ -function testRemove_SingleGroup() { - rim.update( JID1, ALIAS1, "none", null, [GROUP1] ); - rim.update( JID1, ALIAS1, "remove", null, [] ); - - var pres = new Xmpp4Js.Packet.Presence( "available", "lo...@so...", null, "normal", null ); - pres.setFrom( JID1+"/resource1" ); - pm.update( pres ); - - var group = tree.getGroup( GROUP1 ); - assertNotNull( group ); - - var item = tree.getItem( GROUP1, JID1 ); - assertNull( item ); -} - -/** - * Remove an entry that exists in multiple groups, and ensure that all items are gone. - * NOTE: groups are typically not specified in remove packets. - */ -function testRemove_MultupleGroups() { - rim.update( JID1, ALIAS1, "none", null, [GROUP1, GROUP2] ); - rim.update( JID1, ALIAS1, "remove", null, [] ); - - var pres = new Xmpp4Js.Packet.Presence( "available", "lo...@so...", null, "normal", null ); - pres.setFrom( JID1+"/resource1" ); - pm.update( pres ); - - var group = tree.getGroup( GROUP1 ); - assertNotNull( group ); - - var item = tree.getItem( GROUP1, JID1 ); - assertNull( item ); - - item = tree.getItem( GROUP2, JID1 ); - assertNull( item ); -} - -function testPresence_RosterBeforePresence() { - rim.update( JID1, ALIAS1, "none", null, [GROUP1, GROUP2] ); - - var group = tree.getGroup( GROUP1 ); - assertNotNull( group ); - - group = tree.getGroup( GROUP2 ); - assertNotNull( group ); - - var item = tree.getItem( GROUP1, JID1 ); - assertNull( item ); - - item = tree.getItem( GROUP2, JID1 ); - assertNull( item ); - - item = tree.getItem( Xmpp4Js.UI.Roster.RosterTree.OFFLINE_GROUP, JID1 ); - assertNotNull( item ); - - var pres = new Xmpp4Js.Packet.Presence( "available", "lo...@so...", null, "normal", null ); - pres.setFrom( JID1+"/resource1" ); - pm.update( pres ); - - item = tree.getItem( GROUP1, JID1 ); - assertNotNull( item ); - - item = tree.getItem( GROUP2, JID1 ); - assertNotNull( item ); - - item = tree.getItem( Xmpp4Js.UI.Roster.RosterTree.OFFLINE_GROUP, JID1 ); - assertNull( item ); -} - -function testPresence_PresenceBeforeRoster() { - - var pres = new Xmpp4Js.Packet.Presence( "available", "lo...@so...", null, "normal", null ); - pres.setFrom( JID1+"/resource1" ); - pm.update( pres ); - - rim.update( JID1, ALIAS1, "none", null, [GROUP1, GROUP2] ); - - var group = tree.getGroup( GROUP1 ); - assertNotNull( "Expected Group 1 to exist", group ); - - group = tree.getGroup( GROUP2 ); - assertNotNull( "Expected Group 2 to exist", group ); - - item = tree.getItem( GROUP1, JID1 ); - assertNotNull( "Expected item to exist in Group 1", item ); - - item = tree.getItem( GROUP2, JID1 ); - assertNotNull( "Expected item to exist in Group 2", item ); - - item = tree.getItem( Xmpp4Js.UI.Roster.RosterTree.OFFLINE_GROUP, JID1 ); - assertNull( "Expected item to not exist in offline group", item ); -} - - </script> - </body> -</html> - - - - Deleted: branches/xml4script-port/trunk/src/test/javascript/ChatRendererTest.html =================================================================== --- branches/xml4script-port/trunk/src/test/javascript/ChatRendererTest.html 2008-02-23 06:39:31 UTC (rev 693) +++ branches/xml4script-port/trunk/src/test/javascript/ChatRendererTest.html 2008-02-23 06:39:38 UTC (rev 694) @@ -1,26 +0,0 @@ -<html> - <head> - <title>JSUnit - RosterWindowTest</title> - <script language="javascript" src="app/jsUnitCore.js"></script> - - <script type="text/javascript" src="includes.js"></script> - <script type="text/javascript" src="common-test-library.js"></script> - - </head> - <body> - <div id="chatRenderer"></div> - <script type="text/javascript"> - - -function testChatRenderer() { - var cr = new Xmpp4Js.UI.Chat.ChatRenderer( "chatRenderer" ); - - cr.render(); -} - - - </script> - </body> -</html> - - Deleted: branches/xml4script-port/trunk/src/test/javascript/RosterTreeTest.html =================================================================== --- branches/xml4script-port/trunk/src/test/javascript/RosterTreeTest.html 2008-02-23 06:39:31 UTC (rev 693) +++ branches/xml4script-port/trunk/src/test/javascript/RosterTreeTest.html 2008-02-23 06:39:38 UTC (rev 694) @@ -1,267 +0,0 @@ -<html> - <head> - <title>JSUnit - RosterWindowTest</title> - <script language="javascript" src="app/jsUnitCore.js"></script> - - <script type="text/javascript" src="includes.js"></script> - <script type="text/javascript" src="common-test-library.js"></script> - - </head> - <body> - <script type="text/javascript"> - -var GROUP1 = "Group 1"; -var GROUP2 = "Group 2"; - -var JID1 = "som...@so..."; -var JID2 = "som...@so..."; - -var JID_WITH_RESOURCE = JID1+"/resource1"; - -var tree; - -function setUp() { - tree = new Xmpp4Js.UI.Roster.RosterTree({ - renderTo: document.body - }); -} - -function tearDown() { - delete tree; -} - -/** - * Try to create a group and make sure that it exists. - */ -function testCreateGroup() { - tree.createGroup( GROUP1 ); - - var group = tree.getGroup( GROUP1 ); - assertNotNull( group ); -} - -/** - * Try to create a group and make sure an error is thrown. - */ -function testCreateGroup_Again() { - tree.createGroup( GROUP1 ); - try { - tree.createGroup( GROUP1 ); - fail( "Should have errored when trying to create an existing group." ); - } catch(e) { - // TODO test exception type - } - - var group = tree.getGroup( GROUP1 ); - assertNotNull( group ); - // TODO make sure it doesn't exist twice. -} - -/** - * Try creating two fresh groups. - */ -function testCreateGroups() { - tree.createGroups( [GROUP1, GROUP2] ); - - assertNotNull( tree.getGroup( GROUP1 ) ); - assertNotNull( tree.getGroup( GROUP2 ) ); -} - -/** - * Create two groups, one of which exists. DO NOT error. - */ -function testCreateGroups_GroupExists() { - tree.createGroup( GROUP1 ); - - try { - tree.createGroups( [GROUP1, GROUP2] ); - } catch(e) { - fail( "We should not have errored when a group already existed." ); - } - - assertNotNull( tree.getGroup( GROUP1 ) ); - assertNotNull( tree.getGroup( GROUP2 ) ); -} - -/** - * Create a group and add an item to it. - */ -function testCreateItem() { - tree.createGroup( GROUP1 ); - tree.createItem( GROUP1, JID1 ); - - assertNotNull( tree.getItem( GROUP1, JID1 ) ); -} - -/** - * Create an item in two groups - */ -function testCreateItem_DifferentGroup() { - tree.createGroup( GROUP1 ); - tree.createItem( GROUP1, JID1 ); - - tree.createGroup( GROUP2 ); - tree.createItem( GROUP2, JID1 ); - - assertNotNull( tree.getItem( GROUP1, JID1 ) ); - assertNotNull( tree.getItem( GROUP2, JID1 ) ); -} - -/** - * Try to create an item that already exists. expect an error. - */ -function testCreateItem_SameGroup() { - tree.createGroup( GROUP1 ); - tree.createItem( GROUP1, JID1 ); - try { - tree.createItem( GROUP1, JID1 ); - fail( "Should have errored when trying to create an existing item." ); - } catch(e) { - // TODO test exception type - } -} - -/** - * Creates two groups and an item in group 1. moves that item to group 1. - * ensures that item exists in group 2 but not group 1. - */ -function testMoveItem() { - tree.createGroup( GROUP1 ); - tree.createGroup( GROUP2 ); - - tree.createItem( GROUP1, JID1 ); - - tree.moveItem( GROUP1, GROUP2, JID1 ); - - assertNull( tree.getItem( GROUP1, JID1 ) ); - assertNotNull( tree.getItem( GROUP2, JID1 ) ); -} - - -/** - * Creates two groups each with a jid. tries to move from group 1 to 2. errors - * because it already exists in group 2. - */ -function testMoveItem_JidAlreadyExists() { - tree.createGroup( GROUP1 ); - tree.createGroup( GROUP2 ); - - tree.createItem( GROUP1, JID1 ); - tree.createItem( GROUP2, JID1 ); - - try { - tree.moveItem( GROUP1, GROUP2, JID1 ); - fail( "Should have errored moving to a group where jid already exists." ); - } catch(e){ - - } -} - -/** - * Test the getItemInAllGroups method by creating two groups with an item, - * and ensuring that there are two items in the returned list - */ -function testGetItemInAllGroups() { - tree.createGroup( GROUP1 ); - tree.createGroup( GROUP2 ); - - tree.createItem( GROUP1, JID1 ); - tree.createItem( GROUP2, JID1 ); - - var items = tree.getItemInAllGroups( JID1 ); - - assertEquals( "The item does not exist in the expected number of groups", 2, items.length ); - - // TODO ensure that the names match. -} - -/** - * Test the removeItemFromAllGroups method. - */ -function testRemoveItemFromAllGroups() { - tree.createGroup( GROUP1 ); - tree.createGroup( GROUP2 ); - - tree.createItem( GROUP1, JID1 ); - tree.createItem( GROUP2, JID1 ); - - tree.removeItemFromAllGroups( JID1 ); - - assertNull( tree.getItem( GROUP1, JID1 ) ); - assertNull( tree.getItem( GROUP2, JID1 ) ); -} - -/** - * Update the groups an item belongs to with all requisite groups existing. - */ -function testUpdateItemGroups_Group1ToGroup2_GroupsExist() { - tree.createGroup( GROUP1 ); - tree.createGroup( GROUP2 ); - - tree.createItem( GROUP1, JID1 ); - - tree.updateItemGroups( JID1, [GROUP2] ); - - assertNull( tree.getItem( GROUP1, JID1 ) ); - assertNotNull( tree.getItem( GROUP2, JID1 ) ); -} - -/** - * Update the groups an item belongs to with a requisite group missing. will - * error. - */ -function testUpdateItemGroups_Group1ToGroup2_Group2Missing() { - tree.createGroup( GROUP1 ); - - tree.createItem( GROUP1, JID1 ); - - try { - tree.updateItemGroups( JID1, [GROUP2] ); - fail( "Should have errored when Group 2 didn't exist" ); - } catch(e) { - - } -} - -/** - * Creates an item that exists in a single group. then updates groups, including - * the one it already exists in. should NOT error. - */ -function testUpdateItemGroups_Group1ToGroup1AndGroup2_GroupsExist() { - tree.createGroup( GROUP1 ); - tree.createGroup( GROUP2 ); - - tree.createItem( GROUP1, JID1 ); - - try { - tree.updateItemGroups( JID1, [GROUP1, GROUP2] ); - - } catch(e) { - fail( "Should not have errored when already existing in a group." ); - } -} - -/** - * Creates an item in group 1 and then updates it to exist in group 1 and 2. but - * group 2 does not exist, so an error is thrown. - */ -function testUpdateItemGroups_Group1ToGroup1AndGroup2_Group2Missing() { - tree.createGroup( GROUP1 ); - - tree.createItem( GROUP1, JID1 ); - - try { - tree.updateItemGroups( JID1, [GROUP1, GROUP2] ); - fail( "Should have errored when group 2 didn't exist" ); - } catch(e) { - - } -} - - </script> - </body> -</html> - - - - Deleted: branches/xml4script-port/trunk/src/test/javascript/broken/BOSHTransportTest.html =================================================================== --- branches/xml4script-port/trunk/src/test/javascript/broken/BOSHTransportTest.html 2008-02-23 06:39:31 UTC (rev 693) +++ branches/xml4script-port/trunk/src/test/javascript/broken/BOSHTransportTest.html 2008-02-23 06:39:38 UTC (rev 694) @@ -1,145 +0,0 @@ -<html> - <head> - <title>JSUnit - RosterWindowTest</title> - <script language="javascript" src="app/jsUnitCore.js"></script> - - <script type="text/javascript" src="includes.js"></script> - <script type="text/javascript" src="common-test-library.js"></script> - - </head> - <body> - <script type="text/javascript"> - - - - -var pw; - -function setUp() { - setupMockRequestPool(); - - pw = new Xmpp4Js.IO.PacketWriter("/http-bind/"); -} -function tearDown() { - pw = null; -} -function testWriteRaw() { - - var packetHelper = new Xmpp4Js.Packet.PacketHelper(); - - // create raw packet with IQ element - var packet = packetHelper.createPacket(); - var iq = packetHelper.createIQ( "te...@te...", "set", "jabber:iq:roster" ); - - packet.appendChild( iq.getNode() ); - - // setup variable to be caught on tx - var txPacket = undefined; - - // create listener to catch outgoing packet - pw.getConnection().addListener( "beforerequest", function(conn, options) { - txPacket = options.xmlNode; - }); - - pw.sid = 1234; - - // write the packet - pw.writeRaw( packet ); - pw.flush(); - - // make sure that txPacket is an Element - assertNotUndefined( txPacket ); - assertTrue( txPacket instanceof DOMElement ); - - // make sure we are adding attributes to raw packets - assertTrue( txPacket.hasAttribute( "rid" ) ); - assertTrue( txPacket.hasAttribute( "sid" ) ); -} - - -function testWrite_ElementType() { - - var packetHelper = new Xmpp4Js.Packet.PacketHelper(); - - var iq = packetHelper.createIQ( "te...@te...", "set", "jabber:iq:roster" ); - - var txPacket = undefined; - - // create listener to catch outgoing packet - pw.getConnection().addListener( "beforerequest", function(conn, options) { - txPacket = options.xmlNode; - }); - - pw.sid = 1234; - - pw.write( iq ); - pw.flush(); - - assertNotUndefined( txPacket ); - assertTrue( txPacket instanceof DOMElement ); -} - - - -function testWrite_SID() { - - var packetHelper = new Xmpp4Js.Packet.PacketHelper(); - - var iq = packetHelper.createIQ( "te...@te...", "set", "jabber:iq:roster" ); - - // setup variable to be caught on tx - var txPacket = undefined; - - // create listener to catch outgoing packet - pw.getConnection().addListener( "beforerequest", function(conn, options) { - txPacket = options.xmlNode; - }); - - pw.sid = 1234; - pw.write( iq ); - pw.flush(); - assertTrue( txPacket.hasAttribute( "sid" ) ); - assertEquals( 1234, parseInt(txPacket.getAttribute( "sid" ).toString()) ); -} - - -function testWrite_RID() { - - var initialRid = 1; - var packetHelper = new Xmpp4Js.Packet.PacketHelper(); - - var iq = packetHelper.createIQ( "te...@te...", "set", "jabber:iq:roster" ); - - // setup variable to be caught on tx - var txPacket = undefined; - - // create listener to catch outgoing packet - pw.getConnection().addListener( "beforerequest", function(conn, options) { - txPacket = options.xmlNode; - console.info( "beforerequest for RID" ); - console.dir( options ); - }); - - pw.sid = 1234; - pw.rid = initialRid; - - pw.write( iq ); - pw.flush(); - - assertEquals( initialRid, parseInt(txPacket.getAttribute( "rid" ).toString()) ); - - pw.write( iq ); - pw.flush(); - assertEquals( initialRid + 1, parseInt(txPacket.getAttribute( "rid" ).toString()) ); - - pw.write( iq ); - pw.flush(); - assertEquals( initialRid + 2, parseInt(txPacket.getAttribute( "rid" ).toString()) ); -} - - - </script> - </body> -</html> - - Modified: branches/xml4script-port/trunk/src/test/javascript/common-test-library.js =================================================================== --- branches/xml4script-port/trunk/src/test/javascript/common-test-library.js 2008-02-23 06:39:31 UTC (rev 693) +++ branches/xml4script-port/trunk/src/test/javascript/common-test-library.js 2008-02-23 06:39:38 UTC (rev 694) @@ -94,6 +94,20 @@ send: function() { MockBOSHTransport.superclass.send.call( this, arguments ); this.sendQueue(); + }, + + beginSession: function() { + MockBOSHTransport.superclass.beginSession.call( this ); + + var packetNode = DomBuilder.node( "body", { + xmlns: "http://jabber.org/protocol/httpbind", + sid: "1234", + requests: "2", + hold: "1", + wait: "60" + }); + + this.onBeginSessionResponse( packetNode ); } }); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <h-i...@us...> - 2008-02-23 06:39:28
|
Revision: 693 http://xmpp4js.svn.sourceforge.net/xmpp4js/?rev=693&view=rev Author: h-iverson Date: 2008-02-22 22:39:31 -0800 (Fri, 22 Feb 2008) Log Message: ----------- merged in changes from trunk Removed Paths: ------------- branches/xml4script-port/trunk/src/main/javascript/gui/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |