From c7bbfeeb7c0c78acacbcaec64ede085f4558ab7e Mon Sep 17 00:00:00 2001 From: Dave C-J Date: Fri, 4 Oct 2013 22:13:25 +0100 Subject: [PATCH] suppress warning from underlying xmpp library - missing stringprep is unlikely to cause a problem unless using higher utf8 codes, but it doesn't compile at present so more trouble for users than it's worth. --- nodes/social/92-xmpp.js | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/nodes/social/92-xmpp.js b/nodes/social/92-xmpp.js index f8c8c227c..15f957958 100644 --- a/nodes/social/92-xmpp.js +++ b/nodes/social/92-xmpp.js @@ -14,8 +14,17 @@ * limitations under the License. **/ +var orig=console.warn; +console.warn=(function() { // suppress warning from stringprep when not needed) + var orig=console.warn; + return function() { + //orig.apply(console, arguments); + }; +})(); + var RED = require("../../red/red"); var xmpp = require('simple-xmpp'); +console.warn = orig; try { var xmppkey = require("../../settings").xmpp || require("../../../xmppkeys.js"); @@ -97,17 +106,13 @@ function XmppNode(n) { } }); - this._close = function() { + this.on("close", function() { xmpp.setPresence('offline'); //xmpp.conn.end(); // TODO - DCJ NOTE... this is not good. It leaves the connection up over a restart - which will end up with bad things happening... // (but requires the underlying xmpp lib to be fixed (which does have an open bug request on fixing the close method)). this.warn("Due to an underlying bug in the xmpp library this does not disconnect old sessions. This is bad... A restart would be better."); - } + }); } RED.nodes.registerType("xmpp",XmppNode); - -XmppNode.prototype.close = function() { - this._close(); -}