[Pkg-javascript-commits] [ltx] 105/469: router DomainContext.prototype.send(): return on missing to attribute
Jonas Smedegaard
dr at jones.dk
Wed Aug 31 13:01:09 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 c33b0cab7e94384806b034abb12b6560bd911a1f
Author: Astro <astro at spaceboyz.net>
Date: Tue Sep 7 01:16:13 2010 +0200
router DomainContext.prototype.send(): return on missing to attribute
---
lib/xmpp/router.js | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
diff --git a/lib/xmpp/router.js b/lib/xmpp/router.js
index 8fd3d1c..f8a0408 100644
--- a/lib/xmpp/router.js
+++ b/lib/xmpp/router.js
@@ -40,7 +40,21 @@ DomainContext.prototype.send = function(stanza) {
if (stanza.root)
stanza = stanza.root();
- // TODO: return on empty to
+ // no destination? return to ourself
+ if (!stanza.attrs.to) {
+ // do not provoke ping-pong effects
+ if (stanza.attrs.type === 'error')
+ return;
+
+ 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
+ this.receive(stanza);
+
+ return;
+ }
+
destDomain = new JID.JID(stanza.attrs.to).domain;
var outStream = this.getOutStream(destDomain);
--
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