diff options
author | Mattias Andrée <maandree@kth.se> | 2021-04-02 19:07:28 +0200 |
---|---|---|
committer | Mattias Andrée <maandree@kth.se> | 2021-04-02 19:07:28 +0200 |
commit | a8d76118ca810c92a68fe5bb4648ce23636c022d (patch) | |
tree | b83505d23a7667b421be06bb23b99d8f316ebe9a /libcontacts_format_contact.c | |
parent | libcontacts_list_contacts: return empty list of contacts if dir is missing (diff) | |
download | libcontacts-a8d76118ca810c92a68fe5bb4648ce23636c022d.tar.gz libcontacts-a8d76118ca810c92a68fe5bb4648ce23636c022d.tar.bz2 libcontacts-a8d76118ca810c92a68fe5bb4648ce23636c022d.tar.xz |
Add full name, use separate fields for birthday componets and add when leapies celebrate on common years
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to 'libcontacts_format_contact.c')
-rw-r--r-- | libcontacts_format_contact.c | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/libcontacts_format_contact.c b/libcontacts_format_contact.c index 9a20fcf..002dd4a 100644 --- a/libcontacts_format_contact.c +++ b/libcontacts_format_contact.c @@ -32,6 +32,9 @@ libcontacts_format_contact(const struct libcontacts_contact *contact, char **dat if (contact->last_name) fprintf(fp, "LNAME %s\n", contact->last_name); + if (contact->full_name) + fprintf(fp, "FLNAME %s\n", contact->full_name); + if (contact->nickname) fprintf(fp, "NICK %s\n", contact->nickname); @@ -183,18 +186,18 @@ libcontacts_format_contact(const struct libcontacts_contact *contact, char **dat } if (contact->birthday) { - if (contact->birthday->year && contact->birthday->day) { - fprintf(fp, "BIRTH %04i-%02i-%02i\n", - contact->birthday->year, contact->birthday->month, contact->birthday->day); - } else if (contact->birthday->year && contact->birthday->month) { - fprintf(fp, "BIRTH %04i-%02i\n", contact->birthday->year, contact->birthday->month); - } else if (contact->birthday->year) { - fprintf(fp, "BIRTH %04i\n", contact->birthday->year); - } else if (contact->birthday->day) { - fprintf(fp, "BIRTH %02i-%02i\n", contact->birthday->month, contact->birthday->day); - } else if (contact->birthday->month) { - fprintf(fp, "BIRTH %02i\n", contact->birthday->month); - } + fprintf(fp, "BIRTH:\n"); + if (contact->birthday->year) + fprintf(fp, "YEAR %u\n", contact->birthday->year); + if (contact->birthday->month) + fprintf(fp, "MONTH %u\n", (unsigned int)contact->birthday->month); + if (contact->birthday->day) + fprintf(fp, "DAY %u\n", (unsigned int)contact->birthday->day); + if (contact->birthday->before_on_common) + fprintf(fp, "EARLY\n"); + if ((list = contact->birthday->unrecognised_data)) + for (; *list; list++) + fprintf(fp, "\t%s\n", *list); } if (contact->in_case_of_emergency) |