Il giorno mer, 02/11/2005 alle 14.51 +0100, David Eriksson ha scritto:
> On Wed, 2005-11-02 at 12:07 +0100, Sergio CERLESI wrote:
> > Hi all,
> > 
> > I try to sync the contacts of my ipaq with Evolution but the office
> > field seems not works.
> > 
> > The rra library creates/searchs into the vcard a type
> > "X-EVOLUTION-OFFICE".
> > 
> > The version of evolution that I used (2.2.3) implements the syntax
> > described into the rfc2426
> >
> > [snip]
> >
> > where the office is the organizational unit #2 name.
> > 
> > I wrote a patch to implement this into rra library.
> > 
> > What do you think about?
> 
> Looks good! Maybe rra could stil add of the X-EVOLUTION-OFFICE attribute
> in case anyone cares about it?

Hi,

with the attached patch rra supports both syntax at the same time.

Regards,
Sergio

--- ./lib/contact.c.orig	2005-10-30 15:57:59.000000000 +0100
+++ ./lib/contact.c	2005-11-02 15:13:08.000000000 +0100
@@ -221,6 +221,7 @@
 	/* organization parts */
 	WCHAR* company = NULL;
 	WCHAR* department = NULL;
+	WCHAR* office = NULL;
 
 	/* home address parts */
 	WCHAR* home_street = NULL;
@@ -507,6 +508,7 @@
 				strbuf_append(vcard, "X-EVOLUTION-OFFICE:");
 				strbuf_append_escaped_wstr(vcard, pFields[i].val.lpwstr, flags);
 				strbuf_append_crlf(vcard);
+				office = pFields[i].val.lpwstr;
 				break;
 
 			case ID_RADIO_TEL:
@@ -541,12 +543,14 @@
 	 * followed by one or more levels of organizational unit names.
 	 */
 	 
-	if (company || department)
+	if (company || department || office)
 	{
 		strbuf_append(vcard, "ORG:");
 		strbuf_append_escaped_wstr (vcard, company, flags);
 		strbuf_append_c            (vcard, ';');
 		strbuf_append_escaped_wstr (vcard, department, flags);
+		strbuf_append_c            (vcard, ';');
+		strbuf_append_escaped_wstr (vcard, office, flags);
 		strbuf_append_crlf      (vcard);
 	}
 
@@ -1058,6 +1062,14 @@
 		if (separator)
 		{
 			if (separator[1]) {
+				char* separator2 = strchr(separator + 1, ';');
+				if (separator2)
+				{
+					if (separator2[1])
+						add_string(parser, ID_OFFICE_LOC, type, separator2 + 1);
+
+					*separator2 = '\0';
+				}
 				add_string(parser, ID_DEPARTMENT, type, separator + 1);
 			}
 			*separator = '\0';

Reply via email to