Re: [Evolution-hackers] Querying Evolution with a contact's UID
- From: Tom Copeland <tom infoether com>
- To: Not Zed <notzed ximian com>
- Cc: evolution-hackers lists ximian com, Sushma Rai <rsushma novell com>
- Subject: Re: [Evolution-hackers] Querying Evolution with a contact's UID
- Date: Thu, 30 Jun 2005 13:50:39 -0400
On Thu, 2005-06-30 at 22:20 +0800, Not Zed wrote:
> Sushma,
>
> You now being the calendar maintainer (-;, any ideas for Tom on this
> issue?
Here's a small program that illustrates the problem (at least on my
machine); note that the "is uid blah" query returns zero contacts but
when I get all contacts, the UID I'm looking for definitely exists:
======================================
[tom tom evtest]$ cat evtest.c ; echo "OUTPUT" ; ./evtest
#include <stdio.h>
#include <libebook/e-book.h>
#include <libebook/e-contact.h>
#include <libecal/e-cal.h>
int main(int argc, char* argv[]) {
GError* error = 0;
GList* results, *l = NULL;
EBook* book = e_book_new_default_addressbook(&error);
e_book_open(book, TRUE, &error);
char* uid = "pas-id-42B70B7100000001";
EBookQuery* query = e_book_query_from_string(g_strdup_printf ("(is
\"id\" \"%s\")", uid));
e_book_get_contacts(book, query, &results, &error);
printf("Number of contacts with uid %s is %d\n", uid,
g_list_length(results));
query = e_book_query_any_field_contains("");
results = NULL;
e_book_get_contacts(book, query, &results, &error);
for (l = results; l; l = l->next) {
EContact* ev_contact = E_CONTACT(l->data);
if (!g_strcasecmp(e_contact_get(ev_contact, E_CONTACT_UID), uid)) {
printf("Found a contact with uid %s, last name is %s\n", uid,
(char*)e_contact_get(ev_contact, E_CONTACT_GIVEN_NAME));
}
}
e_book_query_unref(query);
return 0;
}
OUTPUT
Number of contacts with uid pas-id-42B70B7100000001 is 0
Found a contact with uid pas-id-42B70B7100000001, last name is
jadmin jabber org
======================================
Weird, huh? I must be doing something wrong... just not sure what...
Yours,
Tom
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]