Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Bug fix

Fixed bug with markSeen not correctly updating messages.
  • Loading branch information...
commit 9581b618ac2584b4486cfe1c273388728e43e59d 1 parent 85542c6
Jake Stubbs authored
Showing with 6 additions and 7 deletions.
  1. +4 −4 dist/mail.listener.js
  2. +2 −3 src/mail.listener.coffee
View
8 dist/mail.listener.js
@@ -67,19 +67,19 @@
MailListener.prototype._parseUnreadEmails = function() {
var _this = this;
return this.imap.search(["UNSEEN"], function(err, searchResults) {
- var fetch, params;
+ var fetch, markSeen;
if (err) {
return _this.emit("error", err);
} else {
if (Array.isArray(searchResults) && searchResults.length === 0) {
return;
}
- params = {};
if (_this.markSeen) {
- params.markSeen = true;
+ markSeen = true;
}
fetch = _this.imap.fetch(searchResults, {
- bodies: ''
+ bodies: '',
+ markSeen: markSeen
});
return fetch.on("message", function(msg, id) {
var parser;
View
5 src/mail.listener.coffee
@@ -53,11 +53,10 @@ class MailListener extends EventEmitter
if Array.isArray(searchResults) and searchResults.length == 0
return
# 5. fetch emails
- params = {}
if @markSeen
- params.markSeen = true
+ markSeen = true
- fetch = @imap.fetch(searchResults, { bodies: '' })
+ fetch = @imap.fetch(searchResults, { bodies: '', markSeen: markSeen })
# 6. email was fetched. Parse it!
fetch.on "message", (msg, id) =>
parser = new MailParser
Please sign in to comment.
Something went wrong with that request. Please try again.