Open Bug 591777 Opened 14 years ago Updated 2 years ago

"Other" headers (addr_other, i.e. otherRandomHeaders) not properly handled by CompFields2Recipients()

Categories

(Thunderbird :: Message Compose Window, defect)

defect

Tracking

(Not tracked)

People

(Reporter: alexandre.feblot, Unassigned)

Details

User-Agent:       Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; fr; rv:1.9.2.8) Gecko/20100722 Firefox/3.6.8
Build Identifier: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; fr; rv:1.9.2.4) Gecko/20100608 Thunderbird/3.1

The "otherRandomHeaders" field may contain multiple values composed of (label: value), and CompFields2Recipients() doesn't handled that at all.

Reproducible: Always

Steps to Reproduce:
1. Add 2 new headers by changing: mail.compose.other.header with value References,Essai.

2. Open a compose window, and set the following Headers:
  * References = "ref"
  * Essai = "ess"

3. Call Recipients2CompFields(compFields) followed by CompFields2Recipients(compFields) for this window.
Actual Results:  
  * calling Recipients2CompFields(compFields) will properly compute compFields.otherRandomHeaders = "References: ref\r\nEssai: ess\r\n".

  * but calling CompFields2Recipients(compFields) with this otherRandomHeaders value brings the following wrong header in the editor window:

References = "References: ref,Essai: ess"


Expected Results:  
The compose window should be unchanged with the initial 2 headers
  * References = "ref"
  * Essai = "ess"


There seems to be 2 issues there:

1) CompFields2Recipients doesn't consider that the "otherRandomHeaders" field may contain multiple values separated by \r\n, and that each of these values is a pair (header label, header value).

2) The mechanism to get the correct popup element in awGetSelectItemIndex() doesn't take into account the fact that there may be multiple "addr_other" items with different labels (in my case, "References" and "Essai"), and just returns the first one.
OS: Mac OS X → All
Hardware: x86 → All
Can you share a piece of code that does that ?

Even better if you provided a patch to fix this.
Status: UNCONFIRMED → NEW
Ever confirmed: true
You can install my extension "External Editor" (http://globs.org/articles.php?lng=en&pg=2) which does it in the function updateEditor().

I started to look for a workaround, but gave up on issue 2). I'm not good enough on Mozilla code for this;
(In reply to comment #2)
> You can install my extension "External Editor"
> (http://globs.org/articles.php?lng=en&pg=2) which does it in the function
> updateEditor().
> 
> I started to look for a workaround, but gave up on issue 2). I'm not good
> enough on Mozilla code for this;

We can probably help.
Cool, thanks.
Hopefully, with a patch delivered in a future minor TB version?
Anyway, as soon as you have done the hard job, I'll be able to take the necessary code in addressingWidgetOverlay.js, and embbed what I need in my extension.
(In reply to comment #4)
> Cool, thanks.
> Hopefully, with a patch delivered in a future minor TB version?
> Anyway, as soon as you have done the hard job, I'll be able to take the
> necessary code in addressingWidgetOverlay.js, and embbed what I need in my
> extension.

You lost me .
Well,
you wrote that "you can probably help (me?)".
By that, I understood that you might be able without too much difficulties to fix addressingWidgetOverlay.js, so that my extension can work properly with multiple addr_other headers.
But I know that even when a fix is commited to the trunk, it may be long for it to reach a public release.
So I just said that when the fix is done, I can grab the corrected functions from the repository, rename them and include them directly in my extension, until it's no longer necessary.
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.