From: Marcel Mol <marcel@mesa.nl>
To: linux-bluetooth@vger.kernel.org
Subject: [PATCH 2/2] ebook backend: return all TEL attribs from vcard in string
Date: Wed, 28 Jul 2010 10:11:27 +0200 [thread overview]
Message-ID: <201007281324.o6SDO9YB010621@joshua.mesa.nl> (raw)
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.
---
plugins/phonebook-ebook.c | 24 +++++++++++++-----------
1 files changed, 13 insertions(+), 11 deletions(-)
diff --git a/plugins/phonebook-ebook.c b/plugins/phonebook-ebook.c
index 089b956..04b7900 100644
--- a/plugins/phonebook-ebook.c
+++ b/plugins/phonebook-ebook.c
@@ -97,6 +97,7 @@ static char *evcard_to_string(EVCard *evcard, unsigned int format,
uint64_t filter)
{
EVCard *evcard2;
+ GList *l;
char *vcard;
unsigned int i;
@@ -109,18 +110,19 @@ 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;
-
- attrib = e_vcard_get_attribute(evcard, attribute_mask[i]);
- if (!attrib)
- continue;
-
- e_vcard_add_attribute(evcard2, e_vcard_attribute_copy(attrib));
+ for (; l; l = g_list_next(l)) {
+ EVCardAttribute *attrib = l->data;
+ if (attrib) {
+ const char *name = e_vcard_attribute_get_name(attrib);
+ for (i = 0; i < 29; i++) {
+ if (!(filter & (1 << i)))
+ continue;
+ if (!strcmp(name, attribute_mask[i]))
+ e_vcard_add_attribute(evcard2, e_vcard_attribute_copy(attrib));
+ }
+ }
}
vcard = e_vcard_to_string(evcard2, format);
--
1.7.1.1
next reply other threads:[~2010-07-28 8:11 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-07-28 8:11 Marcel Mol [this message]
2010-08-02 20:06 ` [PATCH 2/2] ebook backend: return all TEL attribs from vcard in string Johan Hedberg
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=201007281324.o6SDO9YB010621@joshua.mesa.nl \
--to=marcel@mesa.nl \
--cc=linux-bluetooth@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox