Closed Bug 646638 Opened 9 years ago Closed 8 years ago

vCards from webpages and the desktop cannot be opened / imported to Thunderbird.


(Thunderbird :: Address Book, defect)

Windows 7
Not set


(Not tracked)

Thunderbird 9.0


(Reporter: jshipp, Assigned: protz)



(1 file, 1 obsolete file)

User-Agent:       Mozilla/5.0 (Windows NT 6.1; WOW64; rv:2.0) Gecko/20100101 Firefox/4.0
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv: Gecko/20110303 Lightning/1.0b2 Thunderbird/3.1.9

Often I find vCards on a webpages that I would like to be imported into my address book. Clicking the link, wants to bring up outlook, and even if thunderbird is selected as the correct application to open the file, Thunderbird does not appear recognize that any action has transpired. This is the same even if I save the vCard to my desktop.

Reproducible: Always

Steps to Reproduce:
1. Just as a random example there is a vCard on the page here:
2. Click it and select thunderbird to open the file.
3. Sadness ensues as thunderbird does not respond to your request.
Actual Results:  
Thunderbird does not seem to recognize that a request has transpired. 

Expected Results:  
Thunderbird would open your address book, and show you where it has inserted your entry. Or in the case of multiple address books, you are prompted for the correct book to insert the new record into.
Version: unspecified → 3.1
I should have elaborated on the "saving to my desktop" sentence. If I save the vcard to my desktop and ensure the thunderbird is the associated application to open .vcf files, it still does not respond. It does not make a difference if thunderbird is open or not when this is attempted. I know TB is capable of reading vCard files, so I assume this is a limitation of TB's command-line usage.
Thunderbird 3.1.9 indeed seems to ignore VCF files completely on Windows.
I don't have Outlook installed, but after associating VCF with Thunderbird, nothing happens when double-clicking a file. Even a direct drag-and-drop
into the 3-pane or address-book window doesn't show any effect.
Component: General → Address Book
QA Contact: general → address-book
If anyone can give me a kick start, like where to look for, I'd gladly try to fix this bug.
Ever confirmed: true
Attached patch HACK HACK HACK (obsolete) — Splinter Review
This patch works, although for the reasons described in the comment, it's a hack. I haven't found a better way to achieve this, though. David, if you have any suggestions on how to do this in a less hackish way, I'd love to hear about them :-).

Here's the code that does all the work in the end: ; and VCard service is not exactly script-friendly ...

My solution results in a window flashing for a brief period of time before the "Add Contact" dialog pops up.

Don't forget to purge caches when trying this patch :).
Assignee: nobody → jonathan.protzenko
Attachment #557372 - Flags: review?(squibblyflabbetydoo)
Attachment #557372 - Flags: feedback?(dbienvenu)
Comment on attachment 557372 [details] [diff] [review]

I'd rather think about making some of these scriptable (or adding interfaces that are scriptable) than flashing up a useless window.
Attachment #557372 - Flags: feedback-
The problem is that nothing is scriptable in that area, so that sounds like a massive undertaking is required. Do you think it's actually feasible to convert to something that could be used from the command-line handler?

- I could basically write as a separate function, but that would be very ad-hoc and not very useful except for that specific case.
- I could make the vCardService scriptable, and that would somehow be useful, but given the current state of it, I think it's hard.

I agree that making nsIMsgVCardService scriptable is not particularly feasible. Could you add a method to nsIMsgVCardService that can import a vcard given a file name? Or a stream?

You could open the window offscreen so that it doesn't flash, or open it hidden. Still hacky, but the user wouldn't know.
Attached patch No hackSplinter Review
Here's a less hackish version. There's no prior validation of the contents to ensure this is a valid vcard, which will result in an "add contact" dialog with nothing pre-filled if the vcard is invalid.

I don't know the vcard parser, but does the vCardService->Parse_MIME function do anything else besides checking that it's valid? The escapedVCardToAbCard seems to imply that the string has to be "escaped" beforehand, but I'm not sure what that means...

Anyway, it works for me \o/ :)
Attachment #557372 - Attachment is obsolete: true
Attachment #557372 - Flags: review?(squibblyflabbetydoo)
Attachment #557372 - Flags: feedback?(dbienvenu)
Attachment #557601 - Flags: review?(mbanner)
Comment on attachment 557601 [details] [diff] [review]
No hack

This looks reasonable, but I can't actually test it at the moment, so passing review to squib.

I'm a little concerned about the modal window without a parent though.

Also I think you could catch the fact that card is null and not display a dialog. Dunno if we'd want to also display a prompt or just log something to the error console (or do nothing). bwinton may have some ideas there.
Attachment #557601 - Flags: review?(squibblyflabbetydoo)
Attachment #557601 - Flags: review?(mbanner)
Attachment #557601 - Flags: feedback+
Comment on attachment 557601 [details] [diff] [review]
No hack

Review of attachment 557601 [details] [diff] [review]:

This seems to work. I'm pretty unfamiliar with vCards, so I'm not 100% sure how we want this to behave. For instance, if Thunderbird isn't open, should we really add the card and close immediately? In any case, this is a pretty big improvement over how things work now, so r+.
Attachment #557601 - Flags: review?(squibblyflabbetydoo) → review+
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → Thunderbird 9.0
You need to log in before you can comment on or make changes to this bug.