diff options
author | alecpl <alec@alec.pl> | 2010-03-07 08:02:43 +0000 |
---|---|---|
committer | alecpl <alec@alec.pl> | 2010-03-07 08:02:43 +0000 |
commit | 6611b415aee7cd41afbbbf88e90f920de0a9a520 (patch) | |
tree | 2a443aac5da876f6812be04e30cffb715b5ad213 | |
parent | 5821ff51239b7f24d18e3097b3e85813f81768dd (diff) |
- Fix sig replacement (#1486538) + fix checking for separator existance in sig
-rw-r--r-- | program/js/app.js | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/program/js/app.js b/program/js/app.js index 8eecc67f0..e779a9866 100644 --- a/program/js/app.js +++ b/program/js/app.js @@ -2331,19 +2331,19 @@ function rcube_webmail() // remove the 'old' signature if (show_sig && this.env.identity && this.env.signatures && this.env.signatures[this.env.identity]) { sig = this.env.signatures[this.env.identity].is_html ? this.env.signatures[this.env.identity].plain_text : this.env.signatures[this.env.identity].text; - - if (sig.indexOf('-- ') != 0) + + sig = sig.replace(/\r\n/, '\n'); + if (!sig.match(/^--[ -]\n/) sig = sig_separator + '\n' + sig; p = this.env.sig_above ? message.indexOf(sig) : message.lastIndexOf(sig); if (p >= 0) message = message.substring(0, p) + message.substring(p+sig.length, message.length); } - // add the new signature string if (show_sig && this.env.signatures && this.env.signatures[id]) { sig = this.env.signatures[id]['is_html'] ? this.env.signatures[id]['plain_text'] : this.env.signatures[id]['text']; - if (sig.indexOf('-- ') != 0) + if (!sig.match(/^--[ -]\n/) sig = sig_separator + '\n' + sig; if (this.env.sig_above) { @@ -2412,12 +2412,12 @@ function rcube_webmail() if (this.env.signatures[id]) { if (this.env.signatures[id].is_html) { sig = this.env.signatures[id].text; - if (this.env.signatures[id].plain_text.indexOf('-- ') != 0) + if (!this.env.signatures[id].plain_text.match(/^--[ -]\n/) sig = sig_separator + '<br />' + sig; } else { sig = this.env.signatures[id].text; - if (sig.indexOf('-- ') != 0) + if (!sig.match(/^--[ -]\n/) sig = sig_separator + '\n' + sig; sig = '<pre>' + sig + '</pre>'; } |