Changeset 3073


Ignore:
Timestamp:
10/02/07 17:01:27 (6 years ago)
Author:
thomas
Message:

Patch by: Roman Moravcik <roman.moravcik@…>

  • src/moko-contacts.c: (moko_contacts_add_contact): Read phone number from

VCARD.

Location:
trunk/src/target/OM-2007.2/applications/openmoko-dialer2
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/target/OM-2007.2/applications/openmoko-dialer2/ChangeLog

    r3072 r3073  
     12007-10-02  Thomas Wood  <thomas@openedhand.com> 
     2 
     3        Patch by: Roman Moravcik <roman.moravcik@gmail.com> 
     4 
     5        * src/moko-contacts.c: (moko_contacts_add_contact): Read phone number from 
     6        VCARD. 
     7 
    182007-10-02  Thomas Wood  <thomas@openedhand.com> 
    29 
  • trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-contacts.c

    r2961 r3073  
    249249  MokoContact *m_contact = NULL; 
    250250  const gchar *name; 
    251   gint         i; 
     251  GList *attributes, *params, *numbers; 
    252252 
    253253  g_return_if_fail (MOKO_IS_CONTACTS (contacts)); 
     
    268268    
    269269  /* Now go through the numbers,creating MokoNumber for them */ 
    270   for (i = E_CONTACT_FIRST_PHONE_ID; i < E_CONTACT_LAST_PHONE_ID; i++) 
     270  for (attributes = e_vcard_get_attributes (E_VCARD(e_contact)); attributes; attributes = attributes->next) 
    271271  { 
    272272    MokoContactEntry  *entry; 
    273273    const gchar *phone; 
    274  
    275     phone = e_contact_get_const (e_contact, i); 
    276     if (phone) 
    277     { 
    278       entry = g_new0 (MokoContactEntry, 1); 
    279       entry->desc = g_strdup (e_contact_field_name (i)); 
    280       entry->number = normalize (phone); 
    281       entry->contact = m_contact; 
    282  
    283       priv->entries = g_list_append (priv->entries, (gpointer)entry); 
    284       g_hash_table_insert (priv->prefixes,  
    285                            g_strdup (entry->number),  
    286                            (gpointer)entry); 
    287       add_number (&priv->start, entry); 
     274    const char *attr; 
     275 
     276    attr = e_vcard_attribute_get_name (attributes->data); 
     277    if (!strcmp (attr, EVC_TEL)) 
     278    { 
     279      for (numbers = e_vcard_attribute_get_values (attributes->data); numbers; numbers = numbers->next) 
     280      { 
     281        phone = g_strdup (numbers->data); 
     282         if (phone) 
     283        { 
     284          entry = g_new0 (MokoContactEntry, 1); 
     285 
     286          params = e_vcard_attribute_get_param (attributes->data, "TYPE"); 
     287          if (params) 
     288            entry->desc = g_strdup (params->data); 
     289 
     290          entry->desc = g_strdup (params->data); 
     291          entry->number = normalize (phone); 
     292          entry->contact = m_contact; 
     293 
     294          priv->entries = g_list_append (priv->entries, (gpointer)entry); 
     295          g_hash_table_insert (priv->prefixes,  
     296                               g_strdup (entry->number),  
     297                               (gpointer)entry); 
     298          add_number (&priv->start, entry); 
     299        } 
     300      } 
    288301    } 
    289302  } 
Note: See TracChangeset for help on using the changeset viewer.