[Dojo-checkins] BryanForbes - r18130 - dojox/trunk/xmpp

dojo-checkins-admin at dojotoolkit.org dojo-checkins-admin at dojotoolkit.org
Fri Jun 19 13:21:52 EDT 2009


Author: BryanForbes
Date: Fri Jun 19 10:21:43 2009
New Revision: 18130

Modified:
   dojox/trunk/xmpp/TransportSession.js
Log:
  * Re-use iframes already created and fire _sendLogin() automatically if found. !strict


Modified: dojox/trunk/xmpp/TransportSession.js
==============================================================================
--- dojox/trunk/xmpp/TransportSession.js	(original)
+++ dojox/trunk/xmpp/TransportSession.js	Fri Jun 19 10:21:43 2009
@@ -10,7 +10,6 @@
 		dojo.mixin(this, props);
 		if(this.useScriptSrcTransport){
 			this.transportIframes = [];
-		
 		}
 	}
 	
@@ -81,17 +80,23 @@
 				this.transportIframes = [];
 
 				var transSessionStr = dojox._scopeName + '.xmpp.TransportSession';
+				var delayLogin = !dojo.byId('xmpp-transport-0');
 				for(var i = 0; i <= this.hold; i++) {
-					var iframe = dojo.io.iframe.create("xmpp-transport-" + i, transSessionStr + "._iframeOnload("+i+");" );
+					var iframe = dojo.byId('xmpp-transport-'+i);
+					if(!iframe){
+						iframe = dojo.io.iframe.create("xmpp-transport-" + i, transSessionStr + "._iframeOnload("+i+");" );
+					}
 					this.transportIframes.push(iframe);
 				}
-				dojo.connect(dojo.getObject(transSessionStr), '_iframeOnload', this, function(index){
-					if(index==0){
-						this._sendLogin();
-					}
-				});
-				
-			
+				if(delayLogin){
+					dojo.connect(dojo.getObject(transSessionStr), '_iframeOnload', this, function(index){
+						if(index==0){
+							this._sendLogin();
+						}
+					});
+				}else{
+					this._sendLogin();
+				}
 			} else {
 				this._sendLogin();
 			}
@@ -331,7 +336,7 @@
 				iframe.contentWindow.rid=rid;
 				iframe.contentWindow.transmiting=true;
 				dojo.io.script.attach("rid-"+rid,this.serviceUrl+"?"+encodeURIComponent(message),iframeDoc);
-				return false;	
+				return false;
 			} else {
 				var def = dojo.rawXhrPost({
 					contentType: "text/xml",


More information about the Dojo-checkins mailing list