Browse Source

Parser: fix IDLE parsing

Dovecot might answer DONE with some statistics:

  IDLE OK Idle completed (0.001 + 0.093 + 0.092 secs).

The plus character passes RE_PRECEDING which leads to dead end
code-wise.
fork
Matthias Biggeleben 5 years ago
committed by Brian White
parent
commit
941b071f80
No known key found for this signature in database GPG Key ID: 606D7358F94DA209
  1. 2
      lib/Parser.js
  2. 4
      test/test-parser.js

2
lib/Parser.js

@ -11,7 +11,7 @@ var CH_LF = 10,
LITPLACEHOLDER = String.fromCharCode(0),
EMPTY_READCB = function(n) {},
RE_INTEGER = /^\d+$/,
RE_PRECEDING = /^(?:(?:\*|A\d+) )|\+ ?/,
RE_PRECEDING = /^(?:\* |A\d+ |\+ ?)/,
RE_BODYLITERAL = /BODY\[(.*)\] \{(\d+)\}$/i,
RE_BODYINLINEKEY = /^BODY\[(.*)\]$/i,
RE_SEQNO = /^\* (\d+)/,

4
test/test-parser.js

@ -20,6 +20,10 @@ var CR = '\r', LF = '\n', CRLF = CR + LF;
expected: [ 'IDLE OK IDLE terminated' ],
what: 'Unknown line'
},
{ source: ['IDLE OK Idle completed (0.002 + 1.783 + 1.783 secs).', CRLF],
expected: [ 'IDLE OK Idle completed (0.002 + 1.783 + 1.783 secs).' ],
what: 'Unknown line with + char'
},
{ source: ['+ idling', CRLF],
expected: [ { textCode: undefined,
text: 'idling'

Loading…
Cancel
Save