[Pkg-javascript-commits] [ltx] 109/469: router: add <error/> with condition when returning stanzas

Jonas Smedegaard dr at jones.dk
Wed Aug 31 13:01:10 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 9962e3adeb4a0e97da639fed0204e81a52ec431c
Author: Astro <astro at spaceboyz.net>
Date:   Wed Sep 8 00:44:02 2010 +0200

    router: add <error/> with condition when returning stanzas
---
 lib/xmpp/router.js | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/lib/xmpp/router.js b/lib/xmpp/router.js
index a2c5059..22d3403 100644
--- a/lib/xmpp/router.js
+++ b/lib/xmpp/router.js
@@ -7,6 +7,7 @@ var StringPrep = require('node-stringprep').StringPrep;
 var nameprep = new StringPrep('nameprep');
 
 var NS_XMPP_SASL = 'urn:ietf:params:xml:ns:xmpp-sasl';
+var NS_XMPP_STANZAS = 'urn:ietf:params:xml:ns:xmpp-stanzas';
 
 
 dbgStream = function(tag, stream) {
@@ -52,7 +53,8 @@ DomainContext.prototype.send = function(stanza) {
 	stanza.attrs.to = stanza.attrs.from;
 	delete stanza.attrs.from;
 	stanza.attrs.type = 'error';
-	// TODO: add <error/> child if any programs wants to use that
+	stanza.c('error', { type: 'modify' }).
+	    c('jid-malformed', { xmlns: NS_XMPP_STANZAS });
 	this.receive(stanza);
 
 	return;
@@ -124,7 +126,8 @@ DomainContext.prototype.getOutStream = function(destDomain) {
 					    stanza.attrs.to = stanza.attrs.from;
 					    stanza.attrs.from = dest;
 					    stanza.attrs.type = 'error';
-					    // TODO: add <error/> child if any programs wants to use that
+					    stanza.c('error', { type: 'cancel' }).
+						c('remote-server-not-found', { xmlns: NS_XMPP_STANZAS });
 					    self.receive(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