Closed Bug 1643262 Opened 4 years ago Closed 4 years ago

Update vCard conversion to correctly handle multiple values of the same type

Categories

(MailNews Core :: Address Book, defect)

defect

Tracking

(thunderbird78+ fixed)

RESOLVED FIXED
Thunderbird 79.0
Tracking Status
thunderbird78 + fixed

People

(Reporter: darktrojan, Assigned: darktrojan)

References

(Regression)

Details

(Keywords: regression)

Attachments

(1 file)

In most cases nsIAbCard only deals with one value of each type. Multiple values are allowed in a vCard for many data types. We need to ensure we use the right one, taking into account any preference given. For email addresses we can store two values, but there could be any number, so we need to handle that as best we can.

This required a fairly big rethink of parsing. I've taken what was in vCardToAbCard and moved it to a separate function. It now returns a kind-of intermediate data structure that can also be reused in modifyVCard so that I didn't have to fix each problem twice.

I also renamed propertyMap to typeMap which is a better description, and converted the fromAbCard function to a generator since it can return multiple values in the case of email. toAbCard became a generator too since it can return 0-n values.

There's probably more corner cases I haven't thought of yet, and some things we just can't handle properly without virtually replacing nsIAbCard, but this makes me feel a lot better about our vCard functions.

Attachment #9154104 - Flags: review?(mkmelin+mozilla)
Attachment #9154104 - Flags: approval-comm-beta?
Keywords: regression
Comment on attachment 9154104 [details] [diff] [review] 1643262-vcard-multiple-values-1.diff Review of attachment 9154104 [details] [diff] [review]: ----------------------------------------------------------------- r=mkmelin
Attachment #9154104 - Flags: review?(mkmelin+mozilla) → review+
Target Milestone: --- → Thunderbird 79.0

Pushed by mkmelin@iki.fi:
https://hg.mozilla.org/comm-central/rev/4cec8714f352
Update vCard conversion to correctly handle multiple values of the same type. r=mkmelin

Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Comment on attachment 9154104 [details] [diff] [review] 1643262-vcard-multiple-values-1.diff Approved for beta
Attachment #9154104 - Flags: approval-comm-beta? → approval-comm-beta+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: