[evolution-ews] Add profession, office_location, anniversary to EContact.



commit a2d5fba6356ac7a1c8f42c0d081bb3038d37b736
Author: Chenthill Palanisamy <pchenthill novell com>
Date:   Thu Oct 13 15:36:09 2011 +0530

    Add profession, office_location, anniversary to EContact.

 src/addressbook/e-book-backend-ews.c |   38 +++++++++++++++++++++++++++++++++-
 src/server/e-ews-item.c              |   13 +++++++++++
 src/server/e-ews-item.h              |    1 +
 3 files changed, 51 insertions(+), 1 deletions(-)
---
diff --git a/src/addressbook/e-book-backend-ews.c b/src/addressbook/e-book-backend-ews.c
index b88edc9..ca3cb44 100644
--- a/src/addressbook/e-book-backend-ews.c
+++ b/src/addressbook/e-book-backend-ews.c
@@ -236,6 +236,27 @@ ebews_populate_birth_date	(EContact *contact, EEwsItem *item)
 	}
 }
 
+static void
+ebews_populate_anniversary	(EContact *contact, EEwsItem *item)
+{
+	time_t bdate;
+	GDate date;
+	EContactDate edate;
+
+	bdate = e_ews_item_get_wedding_anniversary (item);
+
+	if (bdate) {
+		g_date_clear (&date, 1);
+		g_date_set_time_t (&date, bdate);
+	
+		edate.year = date.year;
+		edate.month = date.month;
+		edate.day = date.day;
+
+		if (g_date_valid (&date))
+			e_contact_set (contact, E_CONTACT_ANNIVERSARY, &edate);
+	}
+}
 
 static void
 set_phone_number (EContact *contact, EContactField field, EEwsItem *item, const gchar *item_field)
@@ -341,13 +362,19 @@ ebews_set_full_name		(ESoapMessage *msg, EContact *contact)
 
 	e_contact_name_free (name);
 }
-
+/* TODO Set birth and anniversary dates */
 static void
 ebews_set_birth_date		(ESoapMessage *message, EContact *contact)
 {
 	
 }
 
+static void
+ebews_set_anniversary		(ESoapMessage *message, EContact *contact)
+{
+	
+}
+
 static gboolean
 add_entry (ESoapMessage *msg, EContact *contact, EContactField field, const gchar *entry_name, const gchar *include_hdr)
 {
@@ -503,6 +530,12 @@ ebews_set_birth_date_changes	(ESoapMessage *message, EContact *new, EContact *ol
 }
 
 static void
+ebews_set_anniversary_changes	(ESoapMessage *message, EContact *new, EContact *old)
+{
+
+}
+
+static void
 ebews_set_phone_number_changes	(ESoapMessage *message, EContact *new, EContact *old)
 {
 	gint i;
@@ -658,8 +691,11 @@ static const struct field_element_mapping {
 	{ E_CONTACT_IM_AIM, ELEMENT_TYPE_COMPLEX, "ImAddresses", NULL, ebews_populate_ims, ebews_set_ims, ebews_set_im_changes },
 	{ E_CONTACT_TITLE, ELEMENT_TYPE_SIMPLE, "JobTitle", e_ews_item_get_job_title},
 	{ E_CONTACT_MANAGER, ELEMENT_TYPE_SIMPLE, "Manager", e_ews_item_get_manager},
+	{ E_CONTACT_MANAGER, ELEMENT_TYPE_SIMPLE, "OfficeLocation", e_ews_item_get_office_location},
+	{ E_CONTACT_SPOUSE, ELEMENT_TYPE_SIMPLE, "Profession", e_ews_item_get_profession},
 	{ E_CONTACT_SPOUSE, ELEMENT_TYPE_SIMPLE, "SpouseName", e_ews_item_get_spouse_name},
 	{ E_CONTACT_FAMILY_NAME, ELEMENT_TYPE_SIMPLE, "Surname", e_ews_item_get_surname},
+	{ E_CONTACT_BIRTH_DATE, ELEMENT_TYPE_COMPLEX, "WeddingAnniversary", NULL,  ebews_populate_anniversary, ebews_set_anniversary, ebews_set_anniversary_changes },
 
 	/* Should take of uid and changekey (REV) */
 	{ E_CONTACT_UID, ELEMENT_TYPE_COMPLEX, "ItemId", NULL,  ebews_populate_uid, ebews_set_item_id},
diff --git a/src/server/e-ews-item.c b/src/server/e-ews-item.c
index 735169c..e31cb70 100644
--- a/src/server/e-ews-item.c
+++ b/src/server/e-ews-item.c
@@ -118,6 +118,7 @@ struct _EEwsContactFields {
 	time_t birthday;
 	time_t wedding_anniversary;
 	
+	gchar *profession;
 	gchar *spouse_name;
 	gchar *culture;
 	gchar *surname;
@@ -397,6 +398,7 @@ ews_free_contact_fields (struct _EEwsContactFields *con_fields)
 		g_free (con_fields->manager);
 		g_free (con_fields->office_location);
 		g_free (con_fields->business_homepage);
+		g_free (con_fields->profession);
 		g_free (con_fields->spouse_name);
 		g_free (con_fields->culture);
 		g_free (con_fields->surname);
@@ -777,6 +779,8 @@ parse_contact_field (EEwsItem *item, const gchar *name, ESoapParameter *subparam
 		priv->contact_fields->manager = e_soap_parameter_get_string_value (subparam);
 	} else if (!g_ascii_strcasecmp (name, "OfficeLocation")) {
 		priv->contact_fields->office_location = e_soap_parameter_get_string_value (subparam);
+	} else if (!g_ascii_strcasecmp (name, "Profession")) {
+		priv->contact_fields->profession = e_soap_parameter_get_string_value (subparam);
 	} else if (!g_ascii_strcasecmp (name, "SpouseName")) {
 		priv->contact_fields->spouse_name = e_soap_parameter_get_string_value (subparam);
 	} else if (!g_ascii_strcasecmp (name, "Surname")) {
@@ -1625,6 +1629,15 @@ e_ews_item_get_business_homepage (EEwsItem *item)
 }
 
 const gchar *
+e_ews_item_get_profession (EEwsItem *item)
+{
+	g_return_val_if_fail (E_IS_EWS_ITEM(item), NULL);
+	g_return_val_if_fail (item->priv->contact_fields != NULL, NULL);
+
+	return (const gchar*) item->priv->contact_fields->profession;
+}
+
+const gchar *
 e_ews_item_get_spouse_name (EEwsItem *item)
 {
 	g_return_val_if_fail (E_IS_EWS_ITEM(item), NULL);
diff --git a/src/server/e-ews-item.h b/src/server/e-ews-item.h
index bfdcc93..94b36a6 100644
--- a/src/server/e-ews-item.h
+++ b/src/server/e-ews-item.h
@@ -192,6 +192,7 @@ const gchar *	e_ews_item_get_business_homepage
 time_t		e_ews_item_get_birthday		(EEwsItem *item);
 time_t		e_ews_item_get_wedding_anniversary
 						(EEwsItem *item);
+const gchar *	e_ews_item_get_profession	(EEwsItem *item);
 const gchar *	e_ews_item_get_spouse_name	(EEwsItem *item);
 const gchar *	e_ews_item_get_culture		(EEwsItem *item);
 const gchar *	e_ews_item_get_surname		(EEwsItem *item);



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