[evolution-data-server] EContact: fix "parse vcard + update contact + commit"



commit 58199a4bac66e86ec677f0d3a507418278ccab18
Author: Patrick Ohly <patrick ohly intel com>
Date:   Mon Mar 5 08:19:41 2012 +0100

    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);



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