Permalink
Browse files

Fixed issue #1

  • Loading branch information...
1 parent c22e1b9 commit 269e36fb57660caf56152b7ba9d041906eb51932 @ditesh committed Nov 8, 2011
Showing with 7 additions and 6 deletions.
  1. +7 −6 main.js
View
13 main.js
@@ -34,9 +34,11 @@ var net = require("net"),
// Constructor
function POP3Client(port, host, options) {
+ if (options === undefined) options = {};
+
// Optional constructor arguments
- var enabletls = options.enabletls || "";
- var ignoretlserrs = (options.ignoretlserrs !== undefined ? options.ignoretlserrs: false);
+ var enabletls = options.enabletls !== undefined ? options.enabletls: false;
+ var ignoretlserrs = options.ignoretlserrs !== undefined ? options.ignoretlserrs: false;
var debug = options.debug || false;
// Private variables follow
@@ -222,7 +224,7 @@ function POP3Client(port, host, options) {
if (checkResp === false) {
- if (multiline === true && bufferedData.substr(bufferedData.length-5) === "\r\n.\r\n") {
+ if (multiline === true && (response === false || bufferedData.substr(bufferedData.length-5) === "\r\n.\r\n")) {
// Make a copy to avoid race conditions
var responseCopy = response;
@@ -672,10 +674,9 @@ POP3Client.prototype.uidl = function(msgnumber) {
if (endOffset > startOffset) {
data = data.substr(startOffset, endOffset-startOffset);
+ endOffset -= startOffset;
- while(true) {
-
- if (offset > endOffset) break;
+ while (offset < endOffset) {
newoffset = data.indexOf("\r\n", offset);
listitem = data.substr(offset, newoffset-offset);

0 comments on commit 269e36f

Please sign in to comment.