fixes the ImapConnection.getBox method.

the code is:

	console.log(params);
	var imap = new require('../submodules/node-imap/imap').ImapConnection({
		username: params.username,
		password: params.password,
		host: params.hostname,
		port: params.port,
		secure: true
	});
	imap.connect(function(r, err) {
		if(err) {
			console.log('Connection failed. Quitting.');
		} else {
			imap.getBoxes(function() {
				console.log(arguments);
				console.log('Done. Quitting.');
				imap.logout();
			});
		}
	});

the output is:

	{ hostname: '*******',
	  port: '993',
	  username: '*******',
	  password: '*******' }

	/home/tahu/workspace/mailget/submodules/node-imap/imap.js:292
	                if (!curChildren[path[i]].children)
	                                         ^
	TypeError: Cannot read property 'children' of undefined
	    at CleartextStream.<anonymous> (/home/tahu/workspace/mailget/submodules/node-imap/imap.js:292:42)
	    at CleartextStream.emit (events.js:42:17)
	    at CleartextStream._push (tls.js:257:31)
	    at SecurePair._cycle (tls.js:514:18)
	    at EncryptedStream.write (tls.js:72:13)
	    at Socket.ondata (stream.js:15:26)
	    at Socket.emit (events.js:42:17)
	    at Socket._onReadable (net.js:649:14)
	    at IOWatcher.onReadable [as callback] (net.js:156:10)
fork
Vytautas Jakutis 13 years ago committed by Brian White
parent 0ed5b5b32f
commit 1e1031f06d

@ -289,6 +289,8 @@ ImapConnection.prototype.connect = function(loginCb) {
var path = name.split(box.delim).filter(isNotEmpty), parent = null;
name = path.pop();
for (var i=0,len=path.length; i<len; i++) {
if (!curChildren[path[i]])
curChildren[path[i]] = {};
if (!curChildren[path[i]].children)
curChildren[path[i]].children = {};
parent = curChildren[path[i]];

Loading…
Cancel
Save