evolution-data-server r8436 - in trunk/calendar: . backends/groupwise



Author: pchen
Date: Mon Jan 28 08:19:40 2008
New Revision: 8436
URL: http://svn.gnome.org/viewvc/evolution-data-server?rev=8436&view=rev

Log:
2008-01-28  Chenthill Palanisamy  <pchenthill novell com>

        Fixes part of #511208
        * backends/groupwise/e-cal-backend-groupwise-utils.c:
        (get_cn_from_display_name), (e_gw_item_to_cal_component): Strip
        the email from the display name.



Modified:
   trunk/calendar/ChangeLog
   trunk/calendar/backends/groupwise/e-cal-backend-groupwise-utils.c

Modified: trunk/calendar/backends/groupwise/e-cal-backend-groupwise-utils.c
==============================================================================
--- trunk/calendar/backends/groupwise/e-cal-backend-groupwise-utils.c	(original)
+++ trunk/calendar/backends/groupwise/e-cal-backend-groupwise-utils.c	Mon Jan 28 08:19:40 2008
@@ -924,6 +924,23 @@
 }
 
 
+static char *
+get_cn_from_display_name (char *display_name)
+{	
+	char *dn;
+	
+	/* Strip the name part alone as the display name might contain email also*/
+	dn = g_strstr_len (display_name, strlen (display_name), " <");
+
+	if (!dn)
+		return g_strdup (display_name);
+	else { 
+		dn = g_strndup (display_name, (dn - display_name));
+		dn = g_strdelimit (dn, "\"", ' ');
+		return dn;
+	}	
+}
+
 ECalComponent *
 e_gw_item_to_cal_component (EGwItem *item, ECalBackendGroupwise *cbgw)
 {
@@ -1134,7 +1151,7 @@
 				EGwItemRecipient *recipient = (EGwItemRecipient *) rl->data;
 				ECalComponentAttendee *attendee = g_new0 (ECalComponentAttendee, 1);
 
-				attendee->cn = g_strdup (recipient->display_name);
+				attendee->cn = get_cn_from_display_name (recipient->display_name);
 				attendee->value = g_strconcat("MAILTO:", recipient->email, NULL);
 				if (recipient->type == E_GW_ITEM_RECIPIENT_TO)
 					attendee->role = ICAL_ROLE_REQPARTICIPANT;
@@ -1173,7 +1190,7 @@
 		ECalComponentOrganizer *cal_organizer;
 
 		cal_organizer = g_new0 (ECalComponentOrganizer, 1);
-		cal_organizer->cn = g_strdup (organizer->display_name);
+		cal_organizer->cn = get_cn_from_display_name (organizer->display_name);
 		cal_organizer->value = g_strconcat("MAILTO:", organizer->email, NULL);
 		e_cal_component_set_organizer (comp, cal_organizer);
 	}



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