Closed Bug 492695 Opened 16 years ago Closed 14 years ago

Contacts without e-mail addresses break mailing lists

Categories

(MailNews Core :: Address Book, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED DUPLICATE of bug 248786

People

(Reporter: pi, Unassigned)

Details

Attachments

(2 files)

When working on my extension I kept breaking directories from syncing contacts without e-mail addresses to mailing lists. It is the leading subject in e-mail and comments about my extension because it can be caused by dragging and dropping contacts into a mailing list as well. It now adds a fake e-mail address to contacts added to mailing lists by overriding the abDirTreeObserver.onDrop and CheckAndSetCardValues methods (among others), but can still miss some cases. After the contact is added to this list, calling hasMoreElements on an nsISimpleEnumerator of the list's childCards fails with NS_ERROR_FAILURE, and calls to nsIAbDirectory.addCard fail with NS_ERROR_INVALID_POINTER. See the attachment for a line to evaluate in the Error Console. It only works in Thunderbird 3.0b1pre and above, but I can attach one for 2 as well. I can reproduce the error in Thunderbird 2.0.0.22pre, 3.0b3pre, and 3.1a1pre. The main problem lies in nsAddrDatabase::AddListCardColumnsToRow on line 1359 [0]. It checks if the contact has an e-mail address and just returns NS_OK if not. I know it defeats the original purpose of a mailing list, but allowing contacts without e-mail addresses would be nice for extensions at least. This, however, would require a more complicated patch since duplicate e-mail addresses won't work in mailing lists. Otherwise, returning an error would allow extensions to catch it and add a fake e-mail address. [0] http://mxr.mozilla.org/comm-central/source/mailnews/addrbook/src/nsAddrDatabase.cpp#1359
This is just a sample patch (not for review) that allows contacts without an e-mail address to be added to a mailing list. Due to the unique e-mail restriction this still won't allow multiple contacts without e-mail addresses in the same list.
I have managed to get the NS_ERROR_INVALID_POINTER when exporting, deleting, then importing an address book with mailing lists without restarting Thunderbird. The import was unable to add the contact to the list, but I didn't see anything in a debug build until I tried to manually add the contact.
Status: NEW → RESOLVED
Closed: 14 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: