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

   3.5.5 ORG Type Definition

   To: [EMAIL PROTECTED]

   Subject: Registration of text/directory MIME type ORG

   Type name: ORG

   Type purpose: To specify the organizational name and units associated
   with the vCard.

   Type encoding: 8bit

   Type value: A single structured text value consisting of components
   separated the SEMI-COLON character (ASCII decimal 59).

   Type special notes: The type is based on the X.520 Organization Name
   and Organization Unit attributes. The type value is a structured type
   consisting of the organization name, followed by one or more levels
   of organizational unit names.

   Type example: A type value consisting of an organizational name,
   organizational unit #1 name and organizational unit #2 name.

        ORG:ABC\, Inc.;North American Division;Marketing

where the office is the organizational unit #2 name.

I wrote a patch to implement this into rra library.

What do you think about?

Regards
Sergio
--- ./lib/contact.c.orig	2005-10-30 15:57:59.000000000 +0100
+++ ./lib/contact.c	2005-11-01 16:27:38.000000000 +0100
@@ -221,6 +221,7 @@
 	/* organization parts */
 	WCHAR* company = NULL;
 	WCHAR* department = NULL;
+	WCHAR* office = NULL;
 
 	/* home address parts */
 	WCHAR* home_street = NULL;
@@ -504,9 +505,7 @@
 				break;
 
 			case ID_OFFICE_LOC:
-				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 +540,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 +1059,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