From 928bcaedc0013a7b653647750108a8ab2c37d2a6 Mon Sep 17 00:00:00 2001
From: alecpl <alec@alec.pl>
Date: Fri, 01 Oct 2010 04:08:05 -0400
Subject: [PATCH] - Fix handling of Thunderbird's vCards (#1487024)

---
 CHANGELOG                       |    1 +
 program/include/rcube_vcard.php |    6 ++++--
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/CHANGELOG b/CHANGELOG
index d89ab2b..5d54de0 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -15,6 +15,7 @@
 - Plugin API: improved 'abort' flag handling, added 'result' item in some hooks (#1486914)
 - Fix: contact group input is empty when using rename action more than once on the same group record
 - Fix "Server Error! (Not Found)" when using utils/save-pref action (#1487023)
+- Fix handling of Thunderbird's vCards (#1487024)
 
 RELEASE 0.4.1
 -------------
diff --git a/program/include/rcube_vcard.php b/program/include/rcube_vcard.php
index 0eb7a78..9bbc32b 100644
--- a/program/include/rcube_vcard.php
+++ b/program/include/rcube_vcard.php
@@ -218,7 +218,9 @@
       if ($in_vcard_block && !empty($line))
         $vcard_block .= $line . "\n";
 
-      if (trim($line) == 'END:VCARD') {
+      $line = trim($line);
+
+      if (preg_match('/^END:VCARD$/i', $line)) {
         // parse vcard
         $obj = new rcube_vcard(self::cleanup($vcard_block), $charset);
         if (!empty($obj->displayname))
@@ -226,7 +228,7 @@
 
         $in_vcard_block = false;
       }
-      else if (trim($line) == 'BEGIN:VCARD') {
+      else if (preg_match('/^BEGIN:VCARD$/i', $line)) {
         $vcard_block = $line . "\n";
         $in_vcard_block = true;
       }

--
Gitblit v1.9.1