|
|
2010-05-13
, 05:57
|
|
Posts: 4 |
Thanked: 2 times |
Joined on Mar 2010
|
#2
|
const int NFIELDS = 7;
const char *FIELDS[] = {
"po-box",
"house",
"street",
"city",
"county",
"postcode",
"country"
};
GList *attribs = g_list_last(
e_vcard_get_attributes(
E_VCARD( contact )
)
);
while ( attribs ) {
EVCardAttribute *attr = static_cast< EVCardAttribute* >( attribs -> data );
if ( ! strcmp( EVC_ADR, e_vcard_attribute_get_name( attr ) ) ) {
GList *values = e_vcard_attribute_get_values( attr );
for (
int i = 0;
values && i < NFIELDS;
i ++
) {
std::cout
<< FIELDS[i]
<< " = "
<< static_cast< const char* >( values -> data )
<< std::endl;
values = values -> next;
}
std::cout << std::endl;
}
attribs = attribs -> prev;
}
I want to split the vcard and i have trouble to split the address field. I am doing at this way:
GList* address_list;
char* street;
address_list = (GList*)e_contact_get(contact,E_CONTACT_ADDRESS);
EContactAddress* addr = (EContactAddress*) address_list->data;
street = addr->street;
Is this way correct to access the street field in a EContactAddress ?
Can anyone tell me what is wrong at this code ?
I apreciate your help.
best regards