diff options
author | Aleksander Machniak <alec@alec.pl> | 2013-09-15 16:48:44 +0200 |
---|---|---|
committer | Aleksander Machniak <alec@alec.pl> | 2013-09-15 16:48:44 +0200 |
commit | 8deae975f0589fccb171b16d54c4b6d9eb569a1b (patch) | |
tree | da2401e5d404b9adc0b55c624e777428ab3a458a /program/js/app.js | |
parent | a1400cb68d8ac34b1ed6b0dcec97dbe44f4ec7ea (diff) |
Fixed issues in handling reply-to/bcc fields on identity change
Diffstat (limited to 'program/js/app.js')
-rw-r--r-- | program/js/app.js | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/program/js/app.js b/program/js/app.js index 24aaca055..337a12156 100644 --- a/program/js/app.js +++ b/program/js/app.js @@ -3427,7 +3427,8 @@ function rcube_webmail() message = input_message.val(), is_html = ($("input[name='_is_html']").val() == '1'), sig = this.env.identity, - delim = this.env.recipients_delimiter, + delim = this.env.recipients_separator, + rx_delim = RegExp.escape(delim), headers = ['replyto', 'bcc']; // update reply-to/bcc fields with addresses defined in identities @@ -3444,16 +3445,18 @@ function rcube_webmail() } // cleanup - rx = new RegExp(RegExp.escape(delim) + '\\s*' + RegExp(delim), 'g'); - input_val = input_val.replace(rx, delim) - rx = new RegExp('^\\s*' + RegExp.escape(delim) + '\\s*$'); - input_val = input_val.replace(rx, '') + rx = new RegExp(rx_delim + '\\s*' + rx_delim, 'g'); + input_val = input_val.replace(rx, delim); + rx = new RegExp('^[\\s' + rx_delim + ']+'); + input_val = input_val.replace(rx, ''); // add new address(es) - if (new_val) { - rx = new RegExp(RegExp.escape(delim) + '\\s*$'); - if (input_val && !rx.test(input_val)) - input_val += delim + ' '; + if (new_val && input_val.indexOf(new_val) == -1 && input_val.indexOf(new_val.replace(/"/g, '')) == -1) { + if (input_val) { + rx = new RegExp('[' + rx_delim + '\\s]+$') + input_val = input_val.replace(rx, '') + delim + ' '; + } + input_val += new_val + delim + ' '; } |