Note: There are a few cases of duplicates in user autocompletion which are being worked on.

Contacts without e-mail addresses break mailing lists

RESOLVED DUPLICATE of bug 248786

Status

MailNews Core
Address Book
RESOLVED DUPLICATE of bug 248786
8 years ago
7 years ago

People

(Reporter: pi, Unassigned)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(2 attachments)

(Reporter)

Description

8 years ago
Created attachment 377071 [details]
JS to reproduce the exceptions

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
(Reporter)

Comment 1

8 years ago
Created attachment 377076 [details] [diff] [review]
A patch that allows one contact w/o an e-mail address per list

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.
(Reporter)

Comment 2

8 years ago
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
Last Resolved: 7 years ago
Resolution: --- → DUPLICATE
Duplicate of bug: 248786
You need to log in before you can comment on or make changes to this bug.