summaryrefslogtreecommitdiff
path: root/plugins/phonebook-ebook.c
diff options
context:
space:
mode:
authorMarcel Mol <marcel@mesa.nl>2010-08-03 00:08:15 +0200
committerJohan Hedberg <johan.hedberg@nokia.com>2010-08-03 01:16:35 +0300
commit3d6c10e7c51280bf86267a0e43031e3678cada78 (patch)
tree5067625eea99ea131d39ed85eb4db1f920120c07 /plugins/phonebook-ebook.c
parenta16e7d98934b9ef1e3a6d9611bc37c89e8328c38 (diff)
downloadobexd-3d6c10e7c51280bf86267a0e43031e3678cada78.tar.gz
ebook backend: return all TEL attribs from vCard as strings
evcard_to_string() only took one TEL attrib from a vCard. But multiple TEL attribs are supported. This patch will convert all TEL attribs to strings.
Diffstat (limited to 'plugins/phonebook-ebook.c')
-rw-r--r--plugins/phonebook-ebook.c25
1 files changed, 17 insertions, 8 deletions
diff --git a/plugins/phonebook-ebook.c b/plugins/phonebook-ebook.c
index 089b956..3c24107 100644
--- a/plugins/phonebook-ebook.c
+++ b/plugins/phonebook-ebook.c
@@ -97,8 +97,8 @@ static char *evcard_to_string(EVCard *evcard, unsigned int format,
uint64_t filter)
{
EVCard *evcard2;
+ GList *l;
char *vcard;
- unsigned int i;
if (!filter)
return e_vcard_to_string(evcard, format);
@@ -109,18 +109,27 @@ static char *evcard_to_string(EVCard *evcard, unsigned int format,
*/
filter = format == EVC_FORMAT_VCARD_30 ? filter | 0x87: filter | 0x85;
+ l = e_vcard_get_attributes(evcard);
evcard2 = e_vcard_new();
- for (i = 0; i < 29; i++) {
- EVCardAttribute *attrib;
-
- if (!(filter & (1 << i)))
- continue;
+ for (; l; l = g_list_next(l)) {
+ EVCardAttribute *attrib = l->data;
+ const char *name;
+ int i;
- attrib = e_vcard_get_attribute(evcard, attribute_mask[i]);
if (!attrib)
continue;
- e_vcard_add_attribute(evcard2, e_vcard_attribute_copy(attrib));
+ name = e_vcard_attribute_get_name(attrib);
+
+ for (i = 0; attribute_mask[i] != NULL; i++) {
+ if (!(filter & (1 << i)))
+ continue;
+ if (g_strcmp0(name, attribute_mask[i]) != 0)
+ continue;
+
+ e_vcard_add_attribute(evcard2,
+ e_vcard_attribute_copy(attrib));
+ }
}
vcard = e_vcard_to_string(evcard2, format);