View Single Post
Posts: 2 | Thanked: 0 times | Joined on May 2010
#1
Hello. I am creating my first python script for maemo. It just analyzes my address book and deletes some contacts, that i don't need. The problem is, that i just cant get icq, jabber, or other aim id's. No problems though, getting email or name fields.
Here is bit of my code
Code:
import evolution
adr_book = evolution.ebook.open_addressbook('default') 
contacts = adr_book.get_all_contacts()
icq = [ i.get_property('im-icq') for i in contacts ]
now in icq variable, i've got list of Nones and GPointer structures such as <gpointer at 0x1d7150>.
According to help( icq[0] ) problem is that property 'im-icq' holds GPointer to list of icq id's. And properties such as 'email-1' hold gchararray, which can be treated by python as string. Also properties such as 'im-icq-home-1',...,'im-icq-work-3' are always None for my contacts.

I am not expert on gtk and its object model, and I couldn't find how I can treat these lists in python. Hermes app just handles contacts as objects, but doesn't access properties such as icq id's.

The only solution, I could find, is getting id's from vcard string via get_vcard_string(), but it seems sooo ugly...

PS just found thread http://talk.maemo.org/showthread.php?t=47840 it seems, that guys decided to parse vcard string and couldn't find better solution, that's sad((