Reply
Thread Tools
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((
 
jaywink's Avatar
Posts: 46 | Thanked: 26 times | Joined on Dec 2007 @ Helsinki
#2
Aww crap. Spent an hour digging stuff up and scratching my head, should of read this first Was trying to dig up Jabber contacts with a Python script, thought it was going to be just a few lines of code... :P
__________________
http://www.basshero.org
 
Reply

Thread Tools

 
Forum Jump


All times are GMT. The time now is 17:31.