discard any double quotes for strings in BODYs in untagged FETCH responses

fork
mscdex 12 years ago
parent 4398a801e4
commit 318d01f177

@ -24,6 +24,7 @@ var CRLF = '\r\n',
RE_LITHEADER = /(?:((?:BODY\[.*\](?:<\d+>)?)?|[^ ]+) )?\{(\d+)\}$/i, RE_LITHEADER = /(?:((?:BODY\[.*\](?:<\d+>)?)?|[^ ]+) )?\{(\d+)\}$/i,
RE_UNRESP = /^\* (OK|PREAUTH|NO|BAD) (?:\[(.+)\] )?(.+)$/i, RE_UNRESP = /^\* (OK|PREAUTH|NO|BAD) (?:\[(.+)\] )?(.+)$/i,
//RE_ISPARTIAL = /<(\d+)>$/, //RE_ISPARTIAL = /<(\d+)>$/,
RE_DBLQ = /"/g,
RE_CMD = /^([^ ]+)(?: |$)/, RE_CMD = /^([^ ]+)(?: |$)/,
RE_ISHEADER = /HEADER/, RE_ISHEADER = /HEADER/,
REX_UNRESPDATA = XRegExp('^\\* (?:(?:(?<type>NAMESPACE) (?<personal>(?:NIL|\\((?:\\(.+\\))+\\))) (?<other>(?:NIL|\\((?:\\(.+\\))+\\))) (?<shared>(?:NIL|\\((?:\\(.+\\))+\\))))|(?:(?<type>FLAGS) \\((?<flags>.*)\\))|(?:(?<type>LIST|LSUB|XLIST) \\((?<flags>.*)\\) (?<delimiter>".+"|NIL) (?<mailbox>.+))|(?:(?<type>(SEARCH|SORT))(?: (?<results>.*))?)|(?:(?<type>STATUS) (?<mailbox>.+) \\((?<attributes>.*)\\))|(?:(?<type>CAPABILITY) (?<capabilities>.+))|(?:(?<type>BYE) (?:\\[(?<code>.+)\\] )?(?<message>.+)))$', 'i'), REX_UNRESPDATA = XRegExp('^\\* (?:(?:(?<type>NAMESPACE) (?<personal>(?:NIL|\\((?:\\(.+\\))+\\))) (?<other>(?:NIL|\\((?:\\(.+\\))+\\))) (?<shared>(?:NIL|\\((?:\\(.+\\))+\\))))|(?:(?<type>FLAGS) \\((?<flags>.*)\\))|(?:(?<type>LIST|LSUB|XLIST) \\((?<flags>.*)\\) (?<delimiter>".+"|NIL) (?<mailbox>.+))|(?:(?<type>(SEARCH|SORT))(?: (?<results>.*))?)|(?:(?<type>STATUS) (?<mailbox>.+) \\((?<attributes>.*)\\))|(?:(?<type>CAPABILITY) (?<capabilities>.+))|(?:(?<type>BYE) (?:\\[(?<code>.+)\\] )?(?<message>.+)))$', 'i'),
@ -210,13 +211,13 @@ ImapConnection.prototype.connect = function(loginCb) {
} }
function emitLitData(key, data) { function emitLitData(key, data) {
var fetches = requests[0].fetchers[key]; var fetches = requests[0].fetchers[key.replace(RE_DBLQ, '')];
for (var i=0, len=fetches.length; i<len; ++i) for (var i=0, len=fetches.length; i<len; ++i)
fetches[i]._msg.emit('data', data); fetches[i]._msg.emit('data', data);
} }
function emitLitMsg(key, msg) { function emitLitMsg(key, msg) {
var fetches = requests[0].fetchers[key]; var fetches = requests[0].fetchers[key.replace(RE_DBLQ, '')];
for (var i=0, len=fetches.length; i<len; ++i) { for (var i=0, len=fetches.length; i<len; ++i) {
if (!fetches[i]._msg) { if (!fetches[i]._msg) {
fetches[i]._msg = msg; fetches[i]._msg = msg;
@ -226,7 +227,7 @@ ImapConnection.prototype.connect = function(loginCb) {
} }
function emitMsgEnd(key) { function emitMsgEnd(key) {
var fetches = requests[0].fetchers[key]; var fetches = requests[0].fetchers[key.replace(RE_DBLQ, '')];
for (var i=0, len=fetches.length; i<len; ++i) { for (var i=0, len=fetches.length; i<len; ++i) {
if (fetches[i]._msg) { if (fetches[i]._msg) {
fetches[i]._msg.emit('end'); fetches[i]._msg.emit('end');

Loading…
Cancel
Save