Branch 'kolab-syncroton-2.1' - 5 commits - lib/ext lib/kolab_sync_backend.php lib/kolab_sync_data_calendar.php lib/kolab_sync_data_email.php

Aleksander Machniak machniak at kolabsys.com
Fri Jun 28 14:09:46 CEST 2013


 lib/ext/Syncroton/Backend/SyncState.php                |   17 ++++-----
 lib/ext/Syncroton/Server.php                           |    3 +
 lib/ext/Syncroton/Wbxml/Dtd/ActiveSync/CodePage254.php |   31 +++++++++++++++++
 lib/kolab_sync_backend.php                             |    3 -
 lib/kolab_sync_data_calendar.php                       |    2 -
 lib/kolab_sync_data_email.php                          |   14 ++++---
 6 files changed, 53 insertions(+), 17 deletions(-)

New commits:
commit aa7467bd341c653852d8e52baa6d691d4875a35b
Author: Aleksander Machniak <alec at alec.pl>
Date:   Sat Apr 6 17:52:06 2013 +0200

    Fix type annotation of folder creation (Bug #1719)

diff --git a/lib/kolab_sync_backend.php b/lib/kolab_sync_backend.php
index 108f6d3..0498759 100644
--- a/lib/kolab_sync_backend.php
+++ b/lib/kolab_sync_backend.php
@@ -224,7 +224,7 @@ class kolab_sync_backend
         }
         else {
             $type    = self::type_activesync2kolab($type);
-            $created = kolab_storage::folder_create($name, $kolab_type, true);
+            $created = kolab_storage::folder_create($name, $type, true);
         }
 
         if ($created) {
@@ -250,7 +250,6 @@ class kolab_sync_backend
      */
     public function folder_rename($old_name, $new_name, $type, $deviceid)
     {
-        $type  = self::type_activesync2kolab($type);
         $moved = kolab_storage::folder_rename($old_name, $new_name);
 
         if ($moved) {


commit 5e8d948f1857ff86392e8df0b4f601f5ec1f8124
Author: Aleksander Machniak <alec at alec.pl>
Date:   Sat Apr 6 18:24:15 2013 +0200

    Throw exception in createEntry() of Email (and SMS) class

diff --git a/lib/kolab_sync_data_email.php b/lib/kolab_sync_data_email.php
index 6959e71..e8f3db3 100644
--- a/lib/kolab_sync_data_email.php
+++ b/lib/kolab_sync_data_email.php
@@ -526,21 +526,25 @@ class kolab_sync_data_email extends kolab_sync_data implements Syncroton_Data_ID
     /**
      * add entry from xml data
      *
-     * @param string           $folderId
-     * @param Syncroton_Model_IEntry $entry
+     * @param string                 $folderId Folder identifier
+     * @param Syncroton_Model_IEntry $entry    Entry
      *
      * @return array
      */
     public function createEntry($folderId, Syncroton_Model_IEntry $entry)
     {
+        // Throw exception here for better handling of unsupported
+        // entry creation, it can be object of class Email or SMS here
+        throw new Syncroton_Exception_Status_Sync(Syncroton_Exception_Status_Sync::SYNC_SERVER_ERROR);
     }
 
     /**
      * update existing entry
      *
-     * @param string           $folderId
-     * @param string           $serverId
-     * @param Syncroton_Model_IEntry $entry
+     * @param string                 $folderId Folder identifier
+     * @param string                 $serverId Entry identifier
+     * @param Syncroton_Model_IEntry $entry    Entry
+     *
      * @return array
      */
     public function updateEntry($folderId, $serverId, Syncroton_Model_IEntry $entry)


commit b4a4dc45f84c0bd71843ad6aa2adecde247237c7
Author: Aleksander Machniak <alec at alec.pl>
Date:   Tue Apr 30 09:01:33 2013 +0200

    Check type before cloning variable

diff --git a/lib/kolab_sync_data_calendar.php b/lib/kolab_sync_data_calendar.php
index f93a91d..f54f56e 100644
--- a/lib/kolab_sync_data_calendar.php
+++ b/lib/kolab_sync_data_calendar.php
@@ -205,7 +205,7 @@ class kolab_sync_data_calendar extends kolab_sync_data implements Syncroton_Data
             case 'start':
                 // For all-day events Kolab uses different times
                 // At least Android doesn't display such event as all-day event
-                if ($value) {
+                if ($value && is_a($value, 'DateTime')) {
                     $date = clone $value;
                     if ($event['allday']) {
                         if ($name == 'start') {


commit 3ccde16e5e6d6669a804f20c6d81c5d0d4b235a8
Author: Aleksander Machniak <alec at alec.pl>
Date:   Fri May 3 08:45:06 2013 +0200

    Update Syncroton with codepage 254

diff --git a/lib/ext/Syncroton/Backend/SyncState.php b/lib/ext/Syncroton/Backend/SyncState.php
index 87dc39c..8c90a76 100644
--- a/lib/ext/Syncroton/Backend/SyncState.php
+++ b/lib/ext/Syncroton/Backend/SyncState.php
@@ -184,26 +184,25 @@ class Syncroton_Backend_SyncState extends Syncroton_Backend_ABackend implements
                 'is_deleted = ?'       => 1
             ));
             
-            // remove entries added during latest sync in Syncroton_content table
-            $this->_db->delete($this->_tablePrefix . 'content', array(
-                'device_id = ?'        => $deviceId,
-                'folder_id = ?'        => $folderId,
-                'creation_synckey > ?' => $state->counter,
-            ));
-            
         } else {
-            // finaly delete all entries marked for removal in Syncroton_content table    
+            // finally delete all entries marked for removal in Syncroton_content table    
             $this->_db->delete($this->_tablePrefix . 'content', array(
                 'device_id = ?'  => $deviceId,
                 'folder_id = ?'  => $folderId,
                 'is_deleted = ?' => 1
             ));
-            
         }
         
         // remove all other synckeys
         $this->_deleteOtherStates($state);
         
+        // remove entries from Syncroton_content table with an creation_synckey bigger than current one
+        $this->_db->delete($this->_tablePrefix . 'content', array(
+            'device_id = ?'        => $deviceId,
+            'folder_id = ?'        => $folderId,
+            'creation_synckey > ?' => $state->counter,
+        ));
+        
         return $state;
     }
 }
diff --git a/lib/ext/Syncroton/Wbxml/Dtd/ActiveSync/CodePage254.php b/lib/ext/Syncroton/Wbxml/Dtd/ActiveSync/CodePage254.php
new file mode 100644
index 0000000..07ca1d9
--- /dev/null
+++ b/lib/ext/Syncroton/Wbxml/Dtd/ActiveSync/CodePage254.php
@@ -0,0 +1,31 @@
+<?php
+/**
+ * Syncroton
+ *
+ * @package     Wbxml
+ * @subpackage  ActiveSync
+ * @license     http://www.tine20.org/licenses/lgpl.html LGPL Version 3
+ * @copyright   Copyright (c) 2013-2013 Metaways Infosystems GmbH (http://www.metaways.de)
+ * @author      Lars Kneschke <l.kneschke at metaways.de>
+ */
+
+/**
+ * class documentation
+ *
+ * @link        http://msdn.microsoft.com/en-us/live/jj572363.aspx
+ * @package     Wbxml
+ * @subpackage  ActiveSync
+ */
+class Syncroton_Wbxml_Dtd_ActiveSync_CodePage254 extends Syncroton_Wbxml_Dtd_ActiveSync_Abstract
+{
+    protected $_codePageNumber  = 254;
+    
+    protected $_codePageName    = 'WindowsLive';
+        
+    protected $_tags = array(
+        'Annotations'            => 0x05,
+        'Annotation'             => 0x06,
+        'Name'                   => 0x07,
+        'Value'                  => 0x08
+    );
+}
\ No newline at end of file


commit 6ffd4c6a4fe2eb91abcb0329b64153d79bbc27c6
Author: Aleksander Machniak <alec at alec.pl>
Date:   Sun May 26 10:47:44 2013 +0200

    Avoid sending HTTP header "Content-Type: text/html" for empty sync responses

diff --git a/lib/ext/Syncroton/Server.php b/lib/ext/Syncroton/Server.php
index a938ffb..1b1f418 100644
--- a/lib/ext/Syncroton/Server.php
+++ b/lib/ext/Syncroton/Server.php
@@ -134,6 +134,9 @@ class Syncroton_Server
         
         header("MS-Server-ActiveSync: 14.00.0536.000");
 
+        // avoid sending HTTP header "Content-Type: text/html" for empty sync responses
+        ini_set('default_mimetype', null);
+        
         try {
             $command = new $className($requestBody, $device, $requestParameters);
         





More information about the commits mailing list