[Pkg-javascript-commits] [ltx] 106/469: router send(): inner routing
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 df2caed240219005979653cd68cabf7d818aba1d
Author: Astro <astro at spaceboyz.net>
Date: Tue Sep 7 01:26:14 2010 +0200
router send(): inner routing
---
lib/xmpp/router.js | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/lib/xmpp/router.js b/lib/xmpp/router.js
index f8a0408..fb32b7a 100644
--- a/lib/xmpp/router.js
+++ b/lib/xmpp/router.js
@@ -394,12 +394,17 @@ Router.prototype.send = function(stanza) {
if (stanza.root)
stanza = stanza.root();
- // TODO: inner routing
- if (stanza.attrs && stanza.attrs.from) {
+ var to = stanza.attrs && stanza.attrs.to;
+ var toDomain = to && (new JID.JID(to)).domain;
+ if (toDomain && this.hasContext(toDomain)) {
+ // inner routing
+ this.getContext(toDomain).receive(stanza);
+ } else if (stanza.attrs && stanza.attrs.from) {
+ // route to domain context for s2s
var domain = (new JID.JID(stanza.attrs.from)).domain;
this.getContext(domain).send(stanza);
} else
- throw 'Sending stanza without destination';
+ throw 'Sending stanza from a domain we do not host';
};
Router.prototype.hasContext = function(domain) {
--
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