Skip to content

Commit

Permalink
default to needFullParse, otherwise do not do full parse
Browse files Browse the repository at this point in the history
  • Loading branch information
NickOvt committed Jan 5, 2024
1 parent 44ce8f7 commit 5b65843
Showing 1 changed file with 5 additions and 12 deletions.
17 changes: 5 additions & 12 deletions lib/imap-notifier.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,18 +83,11 @@ class ImapNotifier extends EventEmitter {
// if p -> json parse ONLY p
// if e not in beginning but p is -> json parse whole

let needFullParse = false;

if (
(message[2] === 'e' && message[33] === 'p') ||
message[2] === 'p' ||
(message[2] === 'e' && message[5] !== `"` && message[6 + 24 + 1] !== `"`)
) {
// 1) there is e and p OR
// 2) p is first OR
// 2) there is e but it is not between quotes (not 24 chars long)
// do full parse
needFullParse = true;
let needFullParse = true;

if (message.length === 32 && message[2] === 'e' && message[5] === '"' && message[6 + 24] === '"') {
// there is only e, no p -> no need for full parse
needFullParse = false;
}

if (!needFullParse) {
Expand Down

0 comments on commit 5b65843

Please sign in to comment.