Ensure email refresh interval doesn't exceed setInterval limit

This commit is contained in:
Nick O'Leary 2018-04-16 13:35:05 +01:00
parent 5358b29255
commit f033a383b9
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9
4 changed files with 9 additions and 2 deletions

View File

@ -222,6 +222,7 @@
}
</pre>
<p>For POP3, the default port numbers are 110 for plain TCP and 995 for SSL. For IMAP the port numbers are 143 for plain TCP and 993 for SSL.</p>
<p>The maximum refresh interval is 2147483 seconds (24.8 days).</p>
</script>

View File

@ -138,6 +138,11 @@ module.exports = function(RED) {
RED.nodes.createNode(this,n);
this.name = n.name;
this.repeat = n.repeat * 1000 || 300000;
if (this.repeat > 2147483647) {
// setTimeout/Interval has a limit of 2**31-1 Milliseconds
this.repeat = 2147483647;
this.error(RED._("email.errors.refreshtoolarge"));
}
this.inserver = n.server || (globalkeys && globalkeys.server) || "imap.gmail.com";
this.inport = n.port || (globalkeys && globalkeys.port) || "993";
this.box = n.box || "INBOX";

View File

@ -43,7 +43,8 @@
"nosmtptransport": "No SMTP transport. See info panel.",
"nopayload": "No payload to send",
"fetchfail": "Failed to fetch folder: __folder__",
"messageerror": "Fetch message error: __error__"
"messageerror": "Fetch message error: __error__",
"refreshtoolarge": "Refresh interval too large. Limiting to 2147483 seconds"
}
}
}

View File

@ -1,6 +1,6 @@
{
"name": "node-red-node-email",
"version": "0.1.28",
"version": "0.1.29",
"description": "Node-RED nodes to send and receive simple emails",
"dependencies": {
"nodemailer": "^1.11.0",