Z-Push is an open source implementation of Microsoft's ActiveSync protocol, an “over-the-air” synchronisation protocol for email, calendars and contacts.
This patch was created against revision 295 from the Z-Push SVN repository. As newer code is checked in, this patch my not apply cleanly. At the time of writing, it probably won't apply cleanly to the latest stable release of Z-Push.
This patch is based on various fixes found on the Z-Push forums. This patch currently addresses the following issues:
This patch also implements the following new features:
Checkout the latest Z-Push from SVN, or specifically checkout revision 295. Download the patch. Apply using the patch command:
$ svn checkout http://svn.berlios.de/svnroot/repos/z-push/trunk z-push $ wget -O z-push.patch http://0wned.it/wiki/_export/code/patches:z-push?codeblock=1 $ cd z-push $ patch -p0 < ../z-push.patch
Index: backend/diffbackend.php =================================================================== --- backend/diffbackend.php (revision 295) +++ backend/diffbackend.php (working copy) @@ -265,6 +265,7 @@ } function ImportMessageMove($id, $newfolder) { + $this->_backend->MoveMessage($this->_folderid, $id, $newfolder); return true; } }; @@ -745,4 +746,4 @@ return array(); } } -?> \ No newline at end of file +?> Index: backend/imap.php =================================================================== --- backend/imap.php (revision 295) +++ backend/imap.php (working copy) @@ -597,7 +597,7 @@ if ($stat) { $this->imap_reopenFolder($folderid); - $mail = @imap_fetchheader($this->_mbox, $id, FT_PREFETCHTEXT | FT_UID) . @imap_body($this->_mbox, $id, FT_PEEK | FT_UID); + $mail = @imap_fetchheader($this->_mbox, $id, FT_UID) . @imap_body($this->_mbox, $id, FT_PEEK | FT_UID); $mobj = new Mail_mimeDecode($mail); $message = $mobj->decode(array('decode_headers' => true, 'decode_bodies' => true, 'include_bodies' => true, 'input' => $mail, 'crlf' => "\n", 'charset' => 'utf-8')); @@ -632,7 +632,7 @@ $n = 0; if(isset($message->parts)) { foreach($message->parts as $part) { - if(isset($part->disposition) && ($part->disposition == "attachment" || $part->disposition == "inline")) { + if(isset($part->ctype_parameters['name'])) { $attachment = new SyncAttachment(); if (isset($part->body)) @@ -649,7 +649,6 @@ $attachment->displayname = $attname; $attachment->attname = $folderid . ":" . $id . ":" . $n; $attachment->attmethod = 1; - $attachment->attoid = isset($part->headers['content-id']) ? $part->headers['content-id'] : ""; array_push($output->attachments, $attachment); } $n++; @@ -903,4 +902,4 @@ }; -?> \ No newline at end of file +?> Index: index.php =================================================================== --- index.php (revision 295) +++ index.php (working copy) @@ -77,7 +77,22 @@ } // Get the request headers so we can see the versions -$requestheaders = apache_request_headers(); +if (!function_exists('getallheaders')) +{ + function getallheaders() + { + foreach ($_SERVER as $name => $value) + { + if (substr($name, 0, 5) == 'HTTP_') + { + $headers[str_replace(' ', '-', ucwords(strtolower(str_replace('_', ' ', substr($name, 5)))))] = $value; + } + } + return $headers; + } +} + +$requestheaders = getallheaders(); if (isset($requestheaders["Ms-Asprotocolversion"])) $requestheaders["MS-ASProtocolVersion"] = $requestheaders["Ms-Asprotocolversion"]; if(isset($requestheaders["MS-ASProtocolVersion"])) { global $protocolversion; @@ -221,4 +236,4 @@ debugLog("end"); debugLog("--------"); -?> \ No newline at end of file +?> Index: zpushdefs.php =================================================================== --- zpushdefs.php (revision 295) +++ zpushdefs.php (working copy) @@ -10,6 +10,8 @@ * This file is distributed under GPL v2. * Consult LICENSE file for details ************************************************/ +define('DEBUGGING', false); + define("SYNC_SYNCHRONIZE","Synchronize"); define("SYNC_REPLIES","Replies"); define("SYNC_ADD","Add"); @@ -449,4 +451,4 @@ define("SYNC_PROVISION_RWSTATUS_OK", 1); define("SYNC_PROVISION_RWSTATUS_PENDING", 2); define("SYNC_PROVISION_RWSTATUS_WIPED", 3); -?> \ No newline at end of file +?> Index: debug.php =================================================================== --- debug.php (revision 295) +++ debug.php (working copy) @@ -25,6 +25,8 @@ } function debugLog($message) { + if (!DEBUGGING) return; + @$fp = fopen(BASE_PATH . "/debug.txt","a"); @$date = strftime("%x %X"); @fwrite($fp, "$date [". getmypid() ."] $message\n"); @@ -38,4 +40,4 @@ error_reporting(E_ALL); set_error_handler("zarafa_error_handler"); -?> \ No newline at end of file +?>