make serverSupports() public

fork
mscdex 12 years ago
parent 78935f8a3c
commit 30c11e4710

@ -174,7 +174,7 @@ ImapConnection.prototype.connect = function(loginCb) {
return loginCb(err);
}
// Next, get the list of available namespaces if supported (RFC2342)
if (!checkedNS && self._serverSupports('NAMESPACE')) {
if (!checkedNS && self.serverSupports('NAMESPACE')) {
// Re-enter this function after we've obtained the available
// namespaces
checkedNS = true;
@ -679,7 +679,7 @@ ImapConnection.prototype.connect = function(loginCb) {
var recentCmd = requests[0].cmdstr;
requests.shift();
if (requests.length === 0 && recentCmd !== 'LOGOUT') {
if (state.status >= STATES.AUTH && self._serverSupports('IDLE')) {
if (state.status >= STATES.AUTH && self.serverSupports('IDLE')) {
// According to RFC 2177, we should re-IDLE at least every 29
// minutes to avoid disconnection by the server
self._send('IDLE', undefined, true);
@ -691,7 +691,7 @@ ImapConnection.prototype.connect = function(loginCb) {
var timeDiff = Date.now() - state.ext.idle.timeStarted;
if (timeDiff >= state.ext.idle.MAX_WAIT)
self._send('IDLE', undefined, true); // restart IDLE
} else if (!self._serverSupports('IDLE'))
} else if (!self.serverSupports('IDLE'))
self._noop();
}
}, state.tmoKeepalive);
@ -796,7 +796,7 @@ ImapConnection.prototype.getBoxes = function(namespace, cb) {
cb = namespace;
namespace = '';
}
this._send((!this._serverSupports('XLIST') ? 'LIST' : 'XLIST')
this._send((!this.serverSupports('XLIST') ? 'LIST' : 'XLIST')
+ ' "' + utils.escape(utf7.encode(''+namespace)) + '" "*"', cb);
};
@ -896,7 +896,7 @@ ImapConnection.prototype._sort = function(which, sorts, options, cb) {
throw new Error('Expected array with at least one sort criteria');
if (!Array.isArray(options))
throw new Error('Expected array for search options');
if (!this._serverSupports('SORT'))
if (!this.serverSupports('SORT'))
return cb(new Error('Sorting is not supported on the server'));
var criteria = sorts.map(function(criterion) {
@ -1155,7 +1155,7 @@ ImapConnection.prototype._fetch = function(which, uids, options, what, cb) {
}
// always fetch GMail-specific bits of information when on GMail
if (this._serverSupports('X-GM-EXT-1'))
if (this.serverSupports('X-GM-EXT-1'))
extensions = 'X-GM-THRID X-GM-MSGID X-GM-LABELS ';
var cmd = which;
@ -1233,7 +1233,7 @@ ImapConnection.prototype.delLabels = function(uids, labels, cb) {
};
ImapConnection.prototype._storeLabels = function(which, uids, labels, mode, cb) {
if (!this._serverSupports('X-GM-EXT-1'))
if (!this.serverSupports('X-GM-EXT-1'))
throw new Error('Server must support X-GM-EXT-1 capability');
if (this._state.status !== STATES.BOXSELECTED)
throw new Error('No mailbox is currently selected');
@ -1372,7 +1372,7 @@ ImapConnection.prototype.__defineGetter__('seq', function() {
// Private/Internal Functions
ImapConnection.prototype._serverSupports = function(capability) {
ImapConnection.prototype.serverSupports = function(capability) {
return (this.capabilities.indexOf(capability) > -1);
};
@ -1435,13 +1435,13 @@ ImapConnection.prototype._login = function(cb) {
};
if (this._state.status === STATES.NOAUTH) {
if (this._serverSupports('LOGINDISABLED'))
if (this.serverSupports('LOGINDISABLED'))
return cb(new Error('Logging in is disabled on this server'));
if (this._serverSupports('AUTH=XOAUTH') && this._options.xoauth) {
if (this.serverSupports('AUTH=XOAUTH') && this._options.xoauth) {
this._send('AUTHENTICATE XOAUTH ' + utils.escape(this._options.xoauth),
fnReturn);
} else if (this._serverSupports('AUTH=XOAUTH2') && this._options.xoauth2) {
} else if (this.serverSupports('AUTH=XOAUTH2') && this._options.xoauth2) {
this._send('AUTHENTICATE XOAUTH2 ' + utils.escape(this._options.xoauth2),
fnReturn);
} else if (this._options.username && this._options.password) {

Loading…
Cancel
Save