Merge pull request #304 from ronniemb/master

esearch should call _esearch and return data to callback. Removed space ...
fork
Brian White 11 years ago
commit 37778d8747

@ -829,7 +829,7 @@ Connection.prototype._sort = function(which, sorts, criteria, cb) {
}; };
Connection.prototype.esearch = function(criteria, options, cb) { Connection.prototype.esearch = function(criteria, options, cb) {
this._search('UID ', criteria, options, cb); this._esearch('UID ', criteria, options, cb);
}; };
Connection.prototype._esearch = function(which, criteria, options, cb) { Connection.prototype._esearch = function(which, criteria, options, cb) {
@ -843,7 +843,7 @@ Connection.prototype._esearch = function(which, criteria, options, cb) {
charset = '', charset = '',
lines; lines;
if (info.hasUTF8) { if (info.hasUTF8) {
charset = 'CHARSET UTF-8'; charset = ' CHARSET UTF-8';
lines = query.split(CRLF); lines = query.split(CRLF);
query = lines.shift(); query = lines.shift();
} }
@ -857,7 +857,7 @@ Connection.prototype._esearch = function(which, criteria, options, cb) {
if (Array.isArray(options)) if (Array.isArray(options))
options = options.join(' '); options = options.join(' ');
this._enqueue(which + 'SEARCH RETURN (' + options + ') ' + charset + query, cb); this._enqueue(which + 'SEARCH RETURN (' + options + ')' + charset + query, cb);
if (info.hasUTF8) { if (info.hasUTF8) {
var req = this._queue[this._queue.length - 1]; var req = this._queue[this._queue.length - 1];
req.lines = lines; req.lines = lines;
@ -1097,7 +1097,7 @@ Connection.prototype._resUntagged = function(info) {
this._caps = info.text.map(function(v) { return v.toUpperCase(); }); this._caps = info.text.map(function(v) { return v.toUpperCase(); });
else if (type === 'preauth') else if (type === 'preauth')
this.state = 'authenticated'; this.state = 'authenticated';
else if (type === 'sort' || type === 'thread') else if (type === 'sort' || type === 'thread' || type === 'esearch')
this._curReq.cbargs.push(info.text); this._curReq.cbargs.push(info.text);
else if (type === 'search') { else if (type === 'search') {
if (info.text.results !== undefined) { if (info.text.results !== undefined) {

Loading…
Cancel
Save