[dev] [PATCH] vCard 3.0 support

Adriaan Putter a.putter at codefusion.co.za
Mon Jun 9 23:30:17 PDT 2003


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

I have added support for vCard 3.0 (RFC2426) support. Here are the patches:


- --
Adriaan Putter
Code Fusion cc

GPG Key:
http://www.mandrakesecure.net/cks/search.cgi?stype=keyid_4b&keyid_4b=8B90E6FD
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6-2 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAj7levkACgkQj20UkouQ5v1XHQCfeg/JUggtk/ROAGAFeC5xjNwd
tI0An3gYmAp0JZV78a1fZHECIPi/EhJB
=oP5K
-----END PGP SIGNATURE-----
-------------- next part --------------
Index: vcard.php
===================================================================
RCS file: /repository/horde/lib/Data/vcard.php,v
retrieving revision 1.15
diff -u -r1.15 vcard.php
--- vcard.php	30 Mar 2003 00:51:36 -0000	1.15
+++ vcard.php	10 Jun 2003 06:27:54 -0000
@@ -130,6 +130,36 @@
                 }
                 break;
 
+	       // for vCard 3.0
+	    case 'ADR':
+	    	if (isset($item['params']['TYPE'])) {
+		    foreach($item['params']['TYPE'] as $adr){
+		         if ( String::upper($adr) == 'HOME' ){
+			      // im only getting the street address from the semi colon list
+			      $street = explode(';', $this->read($item));
+		              $hash['homeAddress'] = $this->read($item);
+			 }
+			 elseif ( String::upper($adr) == 'WORK' ){
+			      $street = explode(';', $this->read($item));
+			      $hash['workAddress'] = $street[2];
+			 }
+		    }
+		}
+		break;
+
+	    // for vCard 3.0
+	    case 'TEL':
+	    	foreach($item['params']['TYPE'] as $tel){
+		     if (String::upper($tel) == 'WORK')
+		          $hash['workPhone'] = $this->read($item);
+		     elseif (String::upper($tel) == 'HOME')
+		          $hash['homePhone'] = $this->read($item);
+		     elseif (String::upper($tel) == 'CELL')
+		          $hash['cellPhone'] = $this->read($item);
+		}
+		break;
+		
+	    // for vCard 2.1
             case 'TEL':
                 if (isset($item['params']['VOICE'])) {
                     if (isset($item['params']['HOME'])) {
-------------- next part --------------
Index: imc.php
===================================================================
RCS file: /repository/horde/lib/Data/imc.php,v
retrieving revision 1.20
diff -u -r1.20 imc.php
--- imc.php	26 Mar 2003 23:06:43 -0000	1.20
+++ imc.php	10 Jun 2003 06:29:02 -0000
@@ -73,7 +73,9 @@
                 $values[$i] = preg_replace('/\\\\,/', ',', $values[$i]);
                 $values[$i] = preg_replace('/\\\\\\\\/', '\\', $values[$i]);
             }
-            $data[] = array('name' => String::upper($name[0]), 'params' => $params, 'values' => $values);
+	    // X- types are case sensitive
+            //$data[] = array('name' => String::upper($name[0]), 'params' => $params, 'values' => $values);
+	    $data[] = array('name' => $name[0], 'params' => $params, 'values' => $values);
         }
         $start = 0;
         return $this->_build($data, $start);


More information about the dev mailing list