From f62659a52390927a5dc8b4028f63c8595b67d83c Mon Sep 17 00:00:00 2001 From: mscdex Date: Wed, 23 Jan 2013 06:16:56 -0500 Subject: [PATCH] re-add node 0.6 compatibility --- README.md | 2 +- lib/imap.js | 9 ++++++--- package.json | 2 +- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index ec9d73d..74b0614 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ If you are in need of this kind of extra functionality, check out andris9's [mim Requirements ============ -* [node.js](http://nodejs.org/) -- v0.8.0 or newer +* [node.js](http://nodejs.org/) -- v0.6.0 or newer * An IMAP server -- tested with gmail diff --git a/lib/imap.js b/lib/imap.js index 99c5cd9..b8ebe20 100644 --- a/lib/imap.js +++ b/lib/imap.js @@ -123,9 +123,12 @@ ImapConnection.prototype.connect = function(loginCb) { socket.setKeepAlive(true); socket.setTimeout(0); - if (this._options.secure) - socket = tls.connect({ socket: state.conn }, onconnect); - else + if (this._options.secure) { + if (process.version.indexOf('v0.6.') > -1) + socket = tls.connect(null, { socket: state.conn }, onconnect); + else + socket = tls.connect({ socket: state.conn }, onconnect); + } else state.conn.once('connect', onconnect); function onconnect() { diff --git a/package.json b/package.json index 471b4f8..f6b9fca 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "author": "Brian White ", "description": "An IMAP module for node.js that makes communicating with IMAP servers easy", "main": "./lib/imap", - "engines": { "node" : ">=0.8.0" }, + "engines": { "node" : ">=0.6.0" }, "dependencies": { "utf7": "1.0.0" },