The source code for the qt mobility contacts backend for the n900 may also be a 
good reference. I am pretty sure it is all in one file and it is pretty straigh 
forward. Just an idea....

----- Original message -----
> Thanks Andrew, this seems to be roughly what I'm looking for. In
> particular, it seems an OssoABookContact is asubclass of an EContact,
> so I can just use this stuff directly.
> 
> However, I've looked at the associated code in hermes:
> https://garage.maemo.org/plugins/ggit/browse.php/?p=hermes;a=blob;f=package/src/org/maemo/hermes/engine/contact.py;h=a309b290ee506ca6de7f46108adb1541ea4fbb58;hb=HEAD
> and I can't find where you get the "GList" and "EVCardAttribute"
> types. I've got my own implementation of a glist (stolen from
> somewhere online) but I'd prefer to not have to write the
> EVCardAttribute myself (wrapping the evolution code).
> 
> My best guess is that it's coming through some long line of imports
> (maybe evolution?) or the pygobject library, but neither of these seem
> to have this type for the libraries I have access to. Any suggestions?
> 
> Thanks!
> 
> On Tue, Aug 24, 2010 at 11:40 PM, Andrew Flegg <and...@bleb.org> wrote:
> > Here's some code from Hermes'[1] org/maemo/hermes/engine/contact.py:
> > 
> > --------8<---------
> > # Constants from
> > http://library.gnome.org/devel/libebook/stable/EContact.html#EContactField
> > ebook = CDLL('libebook-1.2.so.5') E_CONTACT_PHONE_OTHER = 30
> > 
> >    def get_phones(self):
> >        """Return a list of phone numbers associated with this
> > contact."""
> > 
> >        nums = []
> >        ai =
> > GList.new(ebook.e_contact_get_attributes(hash(self._contact),
> > E_CONTACT_PHONE_OTHER))       while ai.has_next():           attr =
> > ai.next(as_a = EVCardAttribute)           types = set()
> >            if attr.params:
> >                params =
> > GList.new(ebook.e_vcard_attribute_param_get_values(attr.params.contents.next()))
> >                while params.has_next():                  
> >  types.add(string_at(params.next()))
> > 
> >            device = 'VOICE' in types and 'landline' \
> >                  or 'CELL'  in types and 'mobile'   \
> >                  or None
> >            type = 'HOME' in types and 'home' \
> >                or 'WORK' in types and 'work' \
> >                or None
> >            number = string_at(attr.value().next())
> >            nums.append(PhoneNumber(number, type = type, device =
> > device))
> > 
> >        return nums
> > ------->8--------
> > 
> > If you don't speak Python, what is basically does is (dealing with an
> > EContact, but you can get that from an OssoABookContact IIRC:
> > 
> >  1) Get all attributes of type 30 - this returns all
> >     phone numbers, I've found.
> >  2) Loop over each attribute, the value of which is
> >     the phone number.
> >  3) The parameters of the attribute will tell you the different
> >     types flagged against this number.
> > 
> > HTH,
> > 
> > Andrew
> > 
> > [1] http://hermes.garage.maemo.org/
> > 
> > --
> > Andrew Flegg -- mailto:and...@bleb.org   |   http://www.bleb.org/
> > Maemo Community Council chair
> > ----- Original message -----
> > > Hello maemo-developers!
> > > 
> > > Does anyone know how to get a phone number (any number) out of an
> > > OssoABookContact instance? I'm at my wit's end; all of the online
> > > hits i've found have been doing the opposite and I can't figure this
> > > out. My guess was using the osso_abook_contact_get_value function,
> > > but I have no idea what the appropriate attribute would be. I've
> > > tried a great many (Cell, for instance) and gotten nothing.
> > > 
> > > Ideas?
> > > 
> > > Thanks!
> > > _______________________________________________
> > > maemo-developers mailing list
> > > maemo-developers@maemo.org
> > > https://lists.maemo.org/mailman/listinfo/maemo-developers
> > 
> > 
> _______________________________________________
> maemo-developers mailing list
> maemo-developers@maemo.org
> https://lists.maemo.org/mailman/listinfo/maemo-developers

_______________________________________________
maemo-developers mailing list
maemo-developers@maemo.org
https://lists.maemo.org/mailman/listinfo/maemo-developers

Reply via email to