Re: [Evolution-hackers] libebook master: obsolete vCard used despite updated properties



On Sat, 2012-03-03 at 13:26 +0100, Patrick Ohly wrote:
> It removes the check for evc->priv->attributes. Adding that check back
> fixes the problem.

Attached is the patch. I must admit that I'm not up-to-date about
release plans. From Matthew's email I gathered that there will be a
release on Monday?!

Please include this patch. I think it is obviously correct, or at least
as correct as the original code was before introducing the vCard 2.1
support - see below.

> Question: why does the removed comment only mention UID? Isn't any
> contact modification detected by checking evc->priv->attributes?

I'm still wondering about that, primarily because I want to be sure that
the code really works in all cases.

-- 
Best Regards, Patrick Ohly

The content of this message is my personal opinion only and although
I am an employee of Intel, the statements I make here in no way
represent Intel's position on the issue, nor am I authorized to speak
on behalf of Intel on this matter.

>From 956c91eb6e8ed89d3847738768d53752d2e2d7a4 Mon Sep 17 00:00:00 2001
From: Patrick Ohly <patrick ohly intel com>
Date: Sun, 4 Mar 2012 14:24:03 +0000
Subject: [PATCH] EContact: fix "parse vcard + update contact + commit"

The commit which introduced vCard 2.1 encoding support (cca25e)
removed the "evc->priv->attributes" check. Without that check
the encoder will always return a cached vCard, even if the
EContact was modified in the meantime.

Found when updating of a contact with SyncEvolution's --update
operation failed because the UID set after parsing the vCard was
ignored and thus committing the update wasn't possible. Might also
break quite a lot of other functionality!

Fixed by addding the "evc->priv->attributes" in both cases (vCard 2.1
and 3.0).
---
 addressbook/libebook/e-vcard.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/addressbook/libebook/e-vcard.c b/addressbook/libebook/e-vcard.c
index 1ff8af2..375a9d1 100644
--- a/addressbook/libebook/e-vcard.c
+++ b/addressbook/libebook/e-vcard.c
@@ -1251,12 +1251,14 @@ e_vcard_to_string (EVCard *evc,
 
 	switch (format) {
 	case EVC_FORMAT_VCARD_21:
-		if (evc->priv->vcard && strstr_nocase (evc->priv->vcard, CRLF "VERSION:2.1" CRLF))
+		if (evc->priv->vcard && evc->priv->attributes == NULL &&
+		    strstr_nocase (evc->priv->vcard, CRLF "VERSION:2.1" CRLF))
 			return g_strdup (evc->priv->vcard);
 
 		return e_vcard_to_string_vcard_21 (evc);
 	case EVC_FORMAT_VCARD_30:
-		if (evc->priv->vcard && strstr_nocase (evc->priv->vcard, CRLF "VERSION:3.0" CRLF))
+		if (evc->priv->vcard && evc->priv->attributes == NULL &&
+		    strstr_nocase (evc->priv->vcard, CRLF "VERSION:3.0" CRLF))
 			return g_strdup (evc->priv->vcard);
 
 		return e_vcard_to_string_vcard_30 (evc);
-- 
1.7.2.5



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]