[Pkg-javascript-commits] [ltx] 23/469: Connection: export NS consts; Client: full xmlns awareness

Jonas Smedegaard dr at jones.dk
Wed Aug 31 13:00:53 UTC 2016


This is an automated email from the git hooks/post-receive script.

js pushed a commit to branch master
in repository ltx.

commit 7c2d2853d97e8a501cfc9197dd0a0c4350f2b1c6
Author: Astro <astro at spaceboyz.net>
Date:   Sun May 30 23:02:49 2010 +0200

    Connection: export NS consts; Client: full xmlns awareness
---
 lib/xmpp/client.js | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/lib/xmpp/client.js b/lib/xmpp/client.js
index d198ae5..d1ff14e 100644
--- a/lib/xmpp/client.js
+++ b/lib/xmpp/client.js
@@ -1,4 +1,4 @@
-var Connection = require('./connection').Connection;
+var Connection = require('./connection');
 var JID = require('./jid').JID;
 var xml = require('./xml');
 var sasl = require('./sasl');
@@ -6,6 +6,7 @@ var sys = require('sys');
 var dns = require('dns');
 var b64 = require('base64');
 
+var NS_CLIENT = 'jabber:client';
 var NS_XMPP_SASL = 'urn:ietf:params:xml:ns:xmpp-sasl';
 var NS_XMPP_BIND = 'urn:ietf:params:xml:ns:xmpp-bind';
 var NS_XMPP_SESSION = 'urn:ietf:params:xml:ns:xmpp-session';
@@ -27,14 +28,14 @@ var IQID_SESSION = 'sess',
  *   port: Number (optional)
  */
 function Client(params) {
-    Connection.call(this);
+    Connection.Connection.call(this);
 
     if (typeof params.jid == 'string')
 	this.jid = new JID(params.jid);
     else
 	this.jid = params.jid;
     this.password = params.password;
-    this.xmlns = "jabber:client";
+    this.xmlns = NS_CLIENT;
     this.xmppVersion = "1.0";
     this.streamTo = this.jid.domain;
     this.state = STATE_PREAUTH;
@@ -70,7 +71,7 @@ function Client(params) {
     }
 }
 
-sys.inherits(Client, Connection);
+sys.inherits(Client, Connection.Connection);
 exports.Client = Client;
 
 Client.prototype.onRawStanza = function(stanza) {
@@ -78,7 +79,7 @@ Client.prototype.onRawStanza = function(stanza) {
        this.streamAttrs.version is missing, but who uses pre-XMPP-1.0
        these days anyway? */
     if (this.state != STATE_ONLINE &&
-	stanza.name == 'stream:features') {
+	stanza.is('features', Connection.NS_STREAM)) {
 	this.streamFeatures = stanza;
 	this.useFeatures();
     } else if (this.state == STATE_AUTH) {
@@ -90,7 +91,7 @@ Client.prototype.onRawStanza = function(stanza) {
 	    this.end();
 	}
     } else if (this.state == STATE_BIND &&
-	       stanza.is('iq') &&
+	       stanza.is('iq', NS_CLIENT) &&
 	       stanza.attrs.id == IQID_BIND) {
 	if (stanza.attrs.type == 'result') {
 	    this.state = STATE_AUTHED;
@@ -108,7 +109,7 @@ Client.prototype.onRawStanza = function(stanza) {
 	    this.end();
 	}
     } else if (this.state == STATE_SESSION &&
-	       stanza.is('iq') &&
+	       stanza.is('iq', NS_CLIENT) &&
 	       stanza.attrs.id == IQID_SESSION) {
 	if (stanza.attrs.type == 'result') {
 	    this.state = STATE_AUTHED;

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/ltx.git



More information about the Pkg-javascript-commits mailing list