Made xmppClient, transportLayer, and authenticationLayer into proper modules using Components.Utils. Also renamed the JabberClient class to XMPPClient, which is more accurate (as it implements XMPP which is a newer protocol than Jabber.)

This commit is contained in:
jonathandicarlo@jonathan-dicarlos-macbook-pro.local 2008-04-30 16:55:34 -07:00
parent e8b52e9413
commit 2fec756b19
3 changed files with 14 additions and 10 deletions

View File

@ -1,3 +1,5 @@
const EXPORTED_SYMBOLS = ['PlainAuthenticator', 'Md5DigestAuthenticator'];
if(typeof(atob) == 'undefined') {
// This code was written by Tyler Akins and has been placed in the
// public domain. It would be nice if you left this header intact.

View File

@ -1,3 +1,5 @@
const EXPORTED_SYMBOLS = ['HTTPPollingTransport'];
var Cc = Components.classes;
var Ci = Components.interfaces;
@ -17,6 +19,10 @@ InputStreamBuffer.prototype = {
}
function SocketClient( host, port ) {
/* A transport layer that uses raw sockets.
Not recommended for use; currently fails when trying to negotiate
TLS.
Use HTTPPollingTransport instead. */
this._init( host, port );
}
SocketClient.prototype = {
@ -128,10 +134,6 @@ SocketClient.prototype = {
this._transport.securityInfo.StartTLS();
},
// TODO have a variant of waitForResponse that gets binary data
// binaryInStream = Cc["@mozilla.org/binaryinputstream;1].createInstance( Ci.nsIBinaryInputStream );
// binaryInStream.setInputStream( this._rawInputStream );
};
@ -330,7 +332,3 @@ HTTPPollingTransport.prototype = {
},
};
//transport = new HTTPPollingTransport( "http://127.0.0.1:5280/http-poll" );
//transport.testKeys();

View File

@ -1,3 +1,4 @@
const EXPORTED_SYMBOLS = ['XMPPClient', 'HTTPPollingTransport', 'PlainAuthenticator', 'Md5DigestAuthenticator'];
// See www.xulplanet.com/tutorials/mozsdk/sockets.php
// http://www.xmpp.org/specs/rfc3920.html
@ -8,12 +9,15 @@
var Cc = Components.classes;
var Ci = Components.interfaces;
var Cu = Components.utils;
Cu.import("resource://weave/xmpp/transportLayer.js");
Cu.import("resource://weave/xmpp/authenticationLayer.js");
function JabberClient( clientName, realm, clientPassword, transport, authenticator ) {
function XmppClient( clientName, realm, clientPassword, transport, authenticator ) {
this._init( clientName, realm, clientPassword, transport, authenticator );
}
JabberClient.prototype = {
XmppClient.prototype = {
//connection status codes:
NOT_CONNECTED: 0,
CALLED_SERVER: 1,