[Pkg-javascript-commits] [ltx] 78/469: server initServer(): optimize dialback stanza matching

Jonas Smedegaard dr at jones.dk
Wed Aug 31 13:01:04 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 258cb4c98d8942de5511cada6253b35b5b75d11a
Author: Astro <astro at spaceboyz.net>
Date:   Mon Sep 6 00:00:07 2010 +0200

    server initServer(): optimize dialback stanza matching
    
    thanks to dodo's advice
---
 lib/xmpp/server.js | 47 +++++++++++++++++++++++------------------------
 1 file changed, 23 insertions(+), 24 deletions(-)

diff --git a/lib/xmpp/server.js b/lib/xmpp/server.js
index 4fd2a2f..ee2cd59 100644
--- a/lib/xmpp/server.js
+++ b/lib/xmpp/server.js
@@ -20,37 +20,36 @@ function initServer(self) {
     self.addListener('rawStanza', function(stanza) {
 	var key = stanza.getText();
 
-	if (stanza.is('result', NS_DIALBACK) &&
-		   stanza.attrs.from && stanza.attrs.to &&
-		   stanza.attrs.type) {
+	if (stanza.is('result', NS_DIALBACK)) {
+	    if (stanza.attrs.from && stanza.attrs.to &&
+		stanza.attrs.type) {
 
-	    self.emit('dialbackResult',
-		      stanza.attrs.from, stanza.attrs.to,
-		      stanza.attrs.type == 'valid');
+		self.emit('dialbackResult',
+			  stanza.attrs.from, stanza.attrs.to,
+			  stanza.attrs.type == 'valid');
 
-	} else if (stanza.is('result', NS_DIALBACK) &&
-	    stanza.attrs.from && stanza.attrs.to) {
+	    } else if (stanza.attrs.from && stanza.attrs.to) {
 
-	    self.emit('dialbackKey',
-		      stanza.attrs.from, stanza.attrs.to,
-		      key);
+		self.emit('dialbackKey',
+			  stanza.attrs.from, stanza.attrs.to,
+			  key);
 
-	} else if (stanza.is('verify', NS_DIALBACK) &&
-		   stanza.attrs.from && stanza.attrs.to &&
-		   stanza.attrs.id && stanza.attrs.type) {
+	    }
+	} else if (stanza.is('verify', NS_DIALBACK)) {
+	    if (stanza.attrs.from && stanza.attrs.to &&
+		stanza.attrs.id && stanza.attrs.type) {
 
-	    self.emit('dialbackVerified',
-		      stanza.attrs.from, stanza.attrs.to,
-		      stanza.attrs.id, stanza.attrs.type == 'valid');
+		self.emit('dialbackVerified',
+			  stanza.attrs.from, stanza.attrs.to,
+			  stanza.attrs.id, stanza.attrs.type == 'valid');
 
-	} else if (stanza.is('verify', NS_DIALBACK) &&
-		   stanza.attrs.from && stanza.attrs.to &&
-		   stanza.attrs.id) {
-
-	    self.emit('dialbackVerify',
-		      stanza.attrs.from, stanza.attrs.to,
-		      stanza.attrs.id, key);
+	    } else if (stanza.attrs.from && stanza.attrs.to &&
+		       stanza.attrs.id) {
 
+		self.emit('dialbackVerify',
+			  stanza.attrs.from, stanza.attrs.to,
+			  stanza.attrs.id, key);
+	    }
 	} else
 	    self.emit('stanza', stanza);
     });

-- 
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