aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook/backend/ebook/e-card.c
diff options
context:
space:
mode:
Diffstat (limited to 'addressbook/backend/ebook/e-card.c')
-rw-r--r--addressbook/backend/ebook/e-card.c27
1 files changed, 25 insertions, 2 deletions
diff --git a/addressbook/backend/ebook/e-card.c b/addressbook/backend/ebook/e-card.c
index 2f0f05b97f..2eeec38b73 100644
--- a/addressbook/backend/ebook/e-card.c
+++ b/addressbook/backend/ebook/e-card.c
@@ -227,13 +227,15 @@ char
vobj = newVObject (VCCardProp);
- if ( card->file_as )
+ if ( card->file_as && *card->file_as )
addPropValue(vobj, "X-EVOLUTION-FILE-AS", card->file_as);
+ else if (card->file_as)
+ addProp(vobj, "X-EVOLUTION-FILE_AS");
if ( card->fname )
addPropValue(vobj, VCFullNameProp, card->fname);
- if ( card->name ) {
+ if ( card->name && (card->name->prefix || card->name->given || card->name->additional || card->name->family || card->name->suffix) ) {
VObject *nameprop;
nameprop = addProp(vobj, VCNameProp);
if ( card->name->prefix )
@@ -705,6 +707,27 @@ parse(ECard *card, VObject *vobj)
while(moreIteration (&iterator)) {
parse_attribute(card, nextVObject(&iterator));
}
+ if (!card->name) {
+ if (card->fname) {
+ card->name = e_card_name_from_string(card->fname);
+ }
+ }
+ if (!card->file_as) {
+ if (card->name) {
+ ECardName *name = card->name;
+ char *strings[3], **stringptr;
+ char *string;
+ stringptr = strings;
+ if (name->family && *name->family)
+ *(stringptr++) = name->family;
+ if (name->given && *name->given)
+ *(stringptr++) = name->given;
+ *stringptr = NULL;
+ string = g_strjoinv(", ", strings);
+ card->file_as = string;
+ } else
+ card->file_as = g_strdup("");
+ }
}
static void