Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Unique key on nsIAbCard

7 views
Skip to first unread message

Henrik Kaare Poulsen

unread,
Jan 19, 2009, 5:36:55 AM1/19/09
to
Hi,

I am developing a synchronization interface for Thunderbird.
Works well on Thunderbird 2, and I am now trying to port to
Thunderbird 3.

I need a unique key for each address-card.
This key will be stored by my application and later I need to be able
to find the address-card based on this unique key.

nsIAbCard does not seem to offer such a feature.

Does anybody have any suggestions as how to get a unique key which can
later be used to retrieve the card?

(Note that I cannot just use some of the user-defined fields or a hash
of all fields or similar, as the user may change the info on the card
at will, and I still need to find the same card)

Thanks in advance for any help...

/Henrik

Mark Banner

unread,
Jan 19, 2009, 5:43:03 AM1/19/09
to
On 01/19/2009 10:36, Henrik Kaare Poulsen wrote:
> I need a unique key for each address-card.
> This key will be stored by my application and later I need to be able
> to find the address-card based on this unique key.
>
> nsIAbCard does not seem to offer such a feature.
>
> Does anybody have any suggestions as how to get a unique key which can
> later be used to retrieve the card?

This has been discussed but not resolved yet:
https://bugzilla.mozilla.org/show_bug.cgi?id=444093

Standard8

Joshua Cranmer

unread,
Jan 19, 2009, 9:34:08 AM1/19/09
to
Henrik Kaare Poulsen wrote:
> I need a unique key for each address-card.
> This key will be stored by my application and later I need to be able
> to find the address-card based on this unique key.

By Thunderbird 3, a UUID will be provided for each card; the feature was
supposed to have been added with the first patch on bug 413260 but was
pulled late in the review cycle due to an unresolved disagreement. I
currently have UUIDs set up and working for Outlook and LDAP address
books in my ab_rewrite repo:
<http://hg.mozilla.org/users/Pidgeot18_gmail.com/ab_rewrite/> (be sure
to use the bug444093 branch...).

> Does anybody have any suggestions as how to get a unique key which can
> later be used to retrieve the card?

If you know the source of a card, you could use the UUID of the source
for the time being: DN for LDAP cards, DbRowID for MDB cards,
OutlookEntryURI for Outlook cards, and the RDF value (from
nsIRDFResource) for OS X cards (I'm not sure about that last one).

Henrik Kaare Poulsen

unread,
Jan 19, 2009, 11:41:16 AM1/19/09
to
Hi Mark and Joshua!

Thank you for your help!
Guess I will stick to DbRowID for now (like I do for TBird 2) and
watch for 444093 to be resolved (as I don't like the dependency on MDB
but would like to stick to nsIAbCard)

/Henrik

Henrik Kaare Poulsen

unread,
Jan 22, 2009, 12:21:00 PM1/22/09
to
On Jan 19, 3:34 pm, Joshua Cranmer <Pidgeo...@verizon.net> wrote:
> Henrik Kaare Poulsen wrote:
> > I need a unique key for each address-card.
>> [...]

> By Thunderbird 3, a UUID will be provided for each card;
> [...]

> If you know the source of a card, you could use the UUID of the source
> for the time being: DN for LDAP cards, DbRowID for MDB cards,

Well, building Thunderbid (dynamic linking) from Comm-central source
code
(Mercurial) does not include nsIAbMDBCard.h in dist/include/addrbook
anymore.

Is this "just" a bug in the current building code, or is this
interface being dropped, or ???

/Henrik

Joshua Cranmer

unread,
Jan 22, 2009, 12:24:57 PM1/22/09
to
Henrik Kaare Poulsen wrote:
> Well, building Thunderbid (dynamic linking) from Comm-central source
> code
> (Mercurial) does not include nsIAbMDBCard.h in dist/include/addrbook
> anymore.
>
> Is this "just" a bug in the current building code, or is this
> interface being dropped, or ???

The interface has been dropped due to its functions having been
superseded by the new nsIAbCard (and the eventual disappearance of MDB
address books altogether).

Henrik Kaare Poulsen

unread,
Jan 22, 2009, 12:32:32 PM1/22/09
to

Ahh...

But then: How do I get a unique ID on a card ???

/Henrik

Henrik Kaare Poulsen

unread,
Jan 22, 2009, 5:36:57 PM1/22/09
to

Might this also be the reason that the following fails with
0x0cf130001 (although it works in Tbird2):

nsCOMPtr<nsIRDFService> rdfService;
rdfService=do_GetService("@mozilla.org/rdf/rdf-service;1", &rv);
nsCOMPtr<nsIRDFResource> rs;
gchar *szAB=g_strconcat("moz-abmdbdirectory://", sz, NULL);
nsCString csc;
NS_CStringSetData(csc, szAB);
rdfService->GetResource(csc, getter_AddRefs(rs));
nsCOMPtr<nsIAbDirectory> myAbDirectory;
myAbDirectory = do_QueryInterface(rs, &rv);
rv <- 0x0cf130001

If yes, my Q remains:

0 new messages