Style fixes

fork
Brian White 12 years ago
parent 2be77661a9
commit 430cda79cb

@ -91,7 +91,7 @@ function ImapConnection (options) {
this.delimiter = undefined; this.delimiter = undefined;
this.namespaces = { personal: [], other: [], shared: [] }; this.namespaces = { personal: [], other: [], shared: [] };
this.capabilities = []; this.capabilities = [];
}; }
inherits(ImapConnection, EventEmitter); inherits(ImapConnection, EventEmitter);
exports.ImapConnection = ImapConnection; exports.ImapConnection = ImapConnection;
@ -462,14 +462,13 @@ ImapConnection.prototype.connect = function(loginCb) {
} else if (/^ALERT$/i.test(m[2])) } else if (/^ALERT$/i.test(m[2]))
self.emit('alert', m[3]); self.emit('alert', m[3]);
else if (state.status === STATES.BOXSELECTING) { else if (state.status === STATES.BOXSELECTING) {
var r; if (m = /^UIDVALIDITY (\d+)/i.exec(m[2]))
if (r = /^UIDVALIDITY (\d+)/i.exec(m[2])) state.box.uidvalidity = m[1];
state.box.uidvalidity = r[1]; else if (m = /^UIDNEXT (\d+)/i.exec(m[2]))
else if (r = /^UIDNEXT (\d+)/i.exec(m[2])) state.box.uidnext = m[1];
state.box.uidnext = r[1]; else if (m = /^PERMANENTFLAGS \((.*)\)/i.exec(m[2])) {
else if (r = /^PERMANENTFLAGS \((.*)\)/i.exec(m[2])) {
var idx, permFlags, keywords; var idx, permFlags, keywords;
state.box.permFlags = permFlags = r[1].split(' '); state.box.permFlags = permFlags = m[1].split(' ');
if ((idx = state.box.permFlags.indexOf('\\*')) > -1) { if ((idx = state.box.permFlags.indexOf('\\*')) > -1) {
state.box.newKeywords = true; state.box.newKeywords = true;
permFlags.splice(idx, 1); permFlags.splice(idx, 1);
@ -734,7 +733,7 @@ ImapConnection.prototype.append = function(data, options, cb) {
if (this._state.status !== STATES.BOXSELECTED) if (this._state.status !== STATES.BOXSELECTED)
throw new Error('No mailbox specified or currently selected'); throw new Error('No mailbox specified or currently selected');
else else
options.mailbox = this._state.box.name options.mailbox = this._state.box.name;
} }
var cmd = 'APPEND "' + utils.escape(options.mailbox) + '"'; var cmd = 'APPEND "' + utils.escape(options.mailbox) + '"';
if ('flags' in options) { if ('flags' in options) {
@ -818,10 +817,10 @@ ImapConnection.prototype._fetch = function(which, uids, options) {
throw new Error("Expected Array of length 2 for body byte range"); throw new Error("Expected Array of length 2 for body byte range");
else if (typeof opts.request.body[1] !== 'string' else if (typeof opts.request.body[1] !== 'string'
|| !(rangeInfo = /^([\d]+)\-([\d]+)$/.exec(opts.request.body[1])) || !(rangeInfo = /^([\d]+)\-([\d]+)$/.exec(opts.request.body[1]))
|| parseInt(rangeInfo[1]) >= parseInt(rangeInfo[2])) || parseInt(rangeInfo[1], 10) >= parseInt(rangeInfo[2]), 10)
throw new Error("Invalid body byte range format"); throw new Error("Invalid body byte range format");
bodyRange = '<' + parseInt(rangeInfo[1]) + '.' + parseInt(rangeInfo[2]) bodyRange = '<' + parseInt(rangeInfo[1], 10) + '.'
+ '>'; + parseInt(rangeInfo[2], 10) + '>';
opts.request.body = opts.request.body[0]; opts.request.body = opts.request.body[0];
} }
if (opts.request.headers === true && opts.request.body === true) { if (opts.request.headers === true && opts.request.body === true) {

Loading…
Cancel
Save