Force output of bodytruncated tag if it's empty.
authorMichael J. Rubinsky <mrubinsk@horde.org>
Thu, 3 Jun 2010 17:22:20 +0000 (13:22 -0400)
committerMichael J. Rubinsky <mrubinsk@horde.org>
Thu, 3 Jun 2010 17:29:04 +0000 (13:29 -0400)
framework/ActiveSync/lib/Horde/ActiveSync/Message/Base.php
framework/ActiveSync/lib/Horde/ActiveSync/Message/Contact.php

index 072d0db..bdf4e06 100644 (file)
@@ -133,7 +133,7 @@ class Horde_ActiveSync_Message_Base
 
     public function __isset($property)
     {
-        return !empty($this->_properties[$property]);
+        return isset($this->_properties[$property]);
     }
 
     /**
@@ -327,9 +327,12 @@ class Horde_ActiveSync_Message_Base
                 } else {
                     /* Simple type */
                     if (strlen($this->$map[self::KEY_ATTRIBUTE]) == 0) {
-                          // Do not output empty items.
-                          // See above: $encoder->startTag($tag, false, true);
-                        continue;
+                          // Do not output empty items except for the following:
+                          if ($this->_checkSendEmpty($tag)) {
+                              $encoder->startTag($tag, false, true);
+                          } else {
+                            continue;
+                          }
                     } else {
                         $encoder->startTag($tag);
                     }
@@ -351,6 +354,18 @@ class Horde_ActiveSync_Message_Base
     }
 
     /**
+     * Checks to see if we should send an empty value.
+     *
+     * @param string $tag  The tag name
+     *
+     * @return boolean
+     */
+    protected function _checkSendEmpty($tag)
+    {
+        return false;
+    }
+
+    /**
      *
      * @param $message
      * @return unknown_type
index 4476dbc..07c700c 100644 (file)
@@ -246,4 +246,13 @@ class Horde_ActiveSync_Message_Contact extends Horde_ActiveSync_Message_Base
         return 'Contacts';
     }
 
+    protected function _checkSendEmpty($tag)
+    {
+        if ($tag == self::BODYTRUNCATED && $this->bodysize > 0) {
+            return true;
+        }
+
+        return false;
+    }
+
 }