diff --git a/lib/imap.js b/lib/imap.js index 767135e..49d47af 100644 --- a/lib/imap.js +++ b/lib/imap.js @@ -730,10 +730,6 @@ ImapConnection.prototype.status = function(boxName, cb) { }; ImapConnection.prototype.removeDeleted = function(cb) { - if (this._state.status !== STATES.BOXSELECTED) - throw new Error('No mailbox is currently selected'); - cb = arguments[arguments.length - 1]; - this._send('EXPUNGE', cb); }; @@ -746,35 +742,24 @@ ImapConnection.prototype.getBoxes = function(namespace, cb) { }; ImapConnection.prototype.addBox = function(name, cb) { - cb = arguments[arguments.length - 1]; - if (typeof name !== 'string' || name.length === 0) - throw new Error('Mailbox name must be a string describing the full path' - + ' of a new mailbox to be created'); - this._send('CREATE "' + utils.escape(utf7.encode(name)) + '"', cb); + this._send('CREATE "' + utils.escape(utf7.encode(''+name)) + '"', cb); }; ImapConnection.prototype.delBox = function(name, cb) { - cb = arguments[arguments.length - 1]; - if (typeof name !== 'string' || name.length === 0) - throw new Error('Mailbox name must be a string describing the full path' - + ' of an existing mailbox to be deleted'); - this._send('DELETE "' + utils.escape(name) + '"', cb); + this._send('DELETE "' + utils.escape(''+name) + '"', cb); }; ImapConnection.prototype.renameBox = function(oldname, newname, cb) { - cb = arguments[arguments.length - 1]; - if (typeof oldname !== 'string' || oldname.length === 0) - throw new Error('Old mailbox name must be a string describing the full path' - + ' of an existing mailbox to be renamed'); - else if (typeof newname !== 'string' || newname.length === 0) - throw new Error('New mailbox name must be a string describing the full path' - + ' of a new mailbox to be renamed to'); if (this._state.status === STATES.BOXSELECTED && oldname === this._state.box.name && oldname !== 'INBOX') - this._state.box._newName = oldname; + this._state.box._newName = ''+oldname; - this._send('RENAME "' + utils.escape(oldname) + '" "' + utils.escape(newname) - + '"', cb); + var cmd = 'RENAME "'; + cmd += utils.escape(''+oldname); + cmd += '" "'; + cmd += utils.escape(''+newname); + cmd += '"'; + this._send(cmd, cb); }; ImapConnection.prototype.append = function(data, options, cb) {