Skip to content

Commit

Permalink
changing order of sending messages
Browse files Browse the repository at this point in the history
  • Loading branch information
root committed May 9, 2012
1 parent be27942 commit c2e7146
Showing 1 changed file with 15 additions and 9 deletions.
24 changes: 15 additions & 9 deletions lib/Node.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,20 @@ Node.prototype.added = function(server) {
}, this);
};

Node.prototype._initForward = function(message, denied, user, pass){
var channel = message.channel;
if (META.test(channel) || SERVICE.test(channel) || CLUSTER.test(channel)) return;
if (message.ext && message.ext.cluster) return;
if (denied) return;
if(user!=null && pass!=null){
message.data.username = user;
message.data.password = pass;
}
this._forward(message);
};

Node.prototype.incoming = function(message, callback) {

var channel = message.channel;
var user = null;
var pass = null;
Expand All @@ -47,16 +60,9 @@ Node.prototype.incoming = function(message, callback) {
console.log('PUBLISH_DENIED');
}
}

this._initForward(message, denied, user, pass);
callback(message);

if (META.test(channel) || SERVICE.test(channel) || CLUSTER.test(channel)) return;
if (message.ext && message.ext.cluster) return;
if (denied) return;
if(user!=null && pass !=null){
message.data.username = user;
message.data.password = pass;
}
this._forward(message);
};

Node.prototype.outgoing = function(message, callback) {
Expand Down

0 comments on commit c2e7146

Please sign in to comment.