summaryrefslogtreecommitdiff
path: root/plugins/attachment_reminder/attachment_reminder.js
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/attachment_reminder/attachment_reminder.js')
-rwxr-xr-xplugins/attachment_reminder/attachment_reminder.js11
1 files changed, 4 insertions, 7 deletions
diff --git a/plugins/attachment_reminder/attachment_reminder.js b/plugins/attachment_reminder/attachment_reminder.js
index 01f2b4993..a4f3e6325 100755
--- a/plugins/attachment_reminder/attachment_reminder.js
+++ b/plugins/attachment_reminder/attachment_reminder.js
@@ -18,15 +18,12 @@ function rcmail_get_compose_message()
function rcmail_check_message(msg)
{
- var i, rg, keywords = rcmail.gettext('keywords', 'attachment_reminder').split(",").concat([".doc", ".pdf"]);
+ var i, rx, keywords = rcmail.gettext('keywords', 'attachment_reminder').split(",").concat([".doc", ".pdf"]);
- for (i=0; i<keywords.length; i++) {
- rg = new RegExp(keywords[i],'i');
- if (msg.search(rg) != -1)
- return true;
- }
+ $.each(keywords, function(n) { return RegExp.escape(n); });
+ rx = new RegExp('(' + keywords.join('|') + ')', 'i');
- return false;
+ return msg.search(rx) != -1;
}
function rcmail_have_attachments()