mirror of
https://github.com/YunoHost-Apps/z-push_ynh.git
synced 2024-09-03 18:05:58 +02:00
Merge pull request #9 from polytan02/master
Lastest sources and improvements
This commit is contained in:
commit
ea13eccd90
15 changed files with 124 additions and 30 deletions
|
@ -244,4 +244,5 @@ php_value[mail.add_x_header] = Off
|
|||
php_value[max_execution_time] = 600
|
||||
php_value[max_input_time] = 300
|
||||
php_value[memory_limit] = 256M
|
||||
php_value[short_open_tag] = On
|
||||
|
||||
|
|
|
@ -158,8 +158,25 @@ function parse_meeting_calendar($part, &$output, $is_sent_folder) {
|
|||
$uid = $props[0]->Value();
|
||||
}
|
||||
|
||||
if (isset($part->ctype_parameters["method"])) {
|
||||
switch (strtolower($part->ctype_parameters["method"])) {
|
||||
$method = false;
|
||||
$props = $ical->GetPropertiesByPath("VCALENDAR/METHOD");
|
||||
if (count($props) > 0) {
|
||||
$method = strtolower($props[0]->Value());
|
||||
ZLog::Write(LOGLEVEL_DEBUG, sprintf("BackendIMAP->parse_meeting_calendar(): Using method from vcalendar object: %s", $method));
|
||||
}
|
||||
else {
|
||||
if (isset($part->ctype_parameters["method"])) {
|
||||
$method = strtolower($part->ctype_parameters["method"]);
|
||||
ZLog::Write(LOGLEVEL_DEBUG, sprintf("BackendIMAP->parse_meeting_calendar(): Using method from mime part object: %s", $method));
|
||||
}
|
||||
}
|
||||
|
||||
if ($method === false) {
|
||||
ZLog::Write(LOGLEVEL_WARN, sprintf("BackendIMAP->parse_meeting_calendar() - No method header, please report it to the developers"));
|
||||
$output->messageclass = "IPM.Appointment";
|
||||
}
|
||||
else {
|
||||
switch ($method) {
|
||||
case "cancel":
|
||||
$output->messageclass = "IPM.Schedule.Meeting.Canceled";
|
||||
$output->meetingrequest->disallownewtimeproposal = 1;
|
||||
|
@ -227,10 +244,6 @@ function parse_meeting_calendar($part, &$output, $is_sent_folder) {
|
|||
break;
|
||||
}
|
||||
}
|
||||
else {
|
||||
ZLog::Write(LOGLEVEL_WARN, sprintf("BackendIMAP->parse_meeting_calendar() - No method header, please report it to the developers"));
|
||||
$output->messageclass = "IPM.Appointment";
|
||||
}
|
||||
|
||||
$props = $ical->GetPropertiesByPath('VEVENT/DTSTAMP');
|
||||
if (count($props) == 1) {
|
||||
|
@ -291,7 +304,7 @@ function parse_meeting_calendar($part, &$output, $is_sent_folder) {
|
|||
else {
|
||||
$tz = TimezoneUtil::GetFullTZ();
|
||||
}
|
||||
$output->meetingrequest->timezone = base64_encode(TimezoneUtil::getSyncBlobFromTZ($tz));
|
||||
$output->meetingrequest->timezone = base64_encode(TimezoneUtil::GetSyncBlobFromTZ($tz));
|
||||
|
||||
// Fixed values
|
||||
$output->meetingrequest->instancetype = 0;
|
||||
|
@ -341,4 +354,4 @@ function reply_meeting_calendar($part, $response, $username) {
|
|||
$ical->SetCPParameterValue("VEVENT", "ATTENDEE", "RSVP", null, sprintf("MAILTO:%s", $username));
|
||||
|
||||
return $ical->Render();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -234,7 +234,7 @@ class ExportChangesICS implements IExportChanges{
|
|||
|
||||
$changes = mapi_exportchanges_getchangecount($this->exporter);
|
||||
if($changes || !($this->flags & BACKEND_DISCARD_DATA))
|
||||
ZLog::Write(LOGLEVEL_DEBUG, sprintf("ExportChangesICS->InitializeExporter() successfully. %d changes ready to sync.", $changes));
|
||||
ZLog::Write(LOGLEVEL_DEBUG, sprintf("ExportChangesICS->InitializeExporter() successfully. %d changes ready to sync for '%s'.", $changes, ($this->folderid)?bin2hex($this->folderid) : 'hierarchy'));
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
|
|
@ -453,7 +453,6 @@ class ImportChangesICS implements IImportChanges {
|
|||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Imports a move of a message. This occurs when a user moves an item to another folder
|
||||
*
|
||||
|
@ -694,4 +693,4 @@ class ImportChangesICS implements IImportChanges {
|
|||
|
||||
return $ret;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2679,4 +2679,4 @@ class MAPIProvider {
|
|||
}
|
||||
return $this->inboxProps;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -63,7 +63,6 @@ include_once('backend/zarafa/mapi/class.meetingrequest.php');
|
|||
include_once('backend/zarafa/mapi/class.freebusypublish.php');
|
||||
|
||||
// processing of RFC822 messages
|
||||
include_once('include/mimeDecode.php');
|
||||
require_once('include/z_RFC822.php');
|
||||
|
||||
// components of Zarafa backend
|
||||
|
@ -167,7 +166,7 @@ class BackendZarafa implements IBackend, ISearchProvider {
|
|||
// send Z-Push version and user agent to ZCP - ZP-589
|
||||
if (Utils::CheckMapiExtVersion('7.2.0')) {
|
||||
$zpush_version = 'Z-Push_' . @constant('ZPUSH_VERSION');
|
||||
$user_agent = $_SERVER['HTTP_USER_AGENT'];
|
||||
$user_agent = ZPush::GetDeviceManager()->GetUserAgent();
|
||||
$this->session = @mapi_logon_zarafa($user, $pass, MAPI_SERVER, null, null, 0, $zpush_version, $user_agent);
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -26,6 +26,8 @@
|
|||
* The views and conclusions contained in the software and documentation are those of the
|
||||
* authors and should not be interpreted as representing official policies, either expressed
|
||||
* or implied, of Leon van Kammen / Coder of Salvation
|
||||
*
|
||||
* https://github.com/coderofsalvation/syslog-flexible
|
||||
*/
|
||||
|
||||
class ZSyslog {
|
||||
|
@ -103,4 +105,4 @@ class ZSyslog {
|
|||
case LOGLEVEL_WBXMLSTACK: return LOG_DEBUG; break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -247,15 +247,7 @@ if (defined('LOG_MEMORY_PROFILER') && LOG_MEMORY_PROFILER) {
|
|||
ZPush::GetDeviceManager()->Save();
|
||||
|
||||
// end gracefully
|
||||
if (version_compare(phpversion(), '5.4.0') < 0) {
|
||||
$time_used = number_format(time() - $_SERVER["REQUEST_TIME"], 4);
|
||||
}
|
||||
else {
|
||||
$time_used = number_format(microtime(true) - $_SERVER["REQUEST_TIME_FLOAT"], 4);
|
||||
}
|
||||
|
||||
ZLog::Write(LOGLEVEL_DEBUG, sprintf("-------- End - max mem: %s/%s - time: %s - code: %s", memory_get_peak_usage(false), memory_get_peak_usage(true), $time_used, http_response_code()));
|
||||
|
||||
ZLog::WriteEnd();
|
||||
|
||||
if (defined('LOG_MEMORY_PROFILER') && LOG_MEMORY_PROFILER) {
|
||||
if (function_exists('memprof_enable')) {
|
||||
|
|
|
@ -316,8 +316,8 @@ class StateManager {
|
|||
*/
|
||||
public function SetBackendStorage($data, $type = self::BACKENDSTORAGE_PERMANENT) {
|
||||
if ($type == self::BACKENDSTORAGE_STATE) {
|
||||
if (!$this->uuid)
|
||||
throw new StateNotYetAvailableException();
|
||||
if (!$this->uuid)
|
||||
throw new StateNotYetAvailableException();
|
||||
|
||||
// TODO serialization should be done in the StateMachine
|
||||
return $this->statemachine->SetState($data, $this->device->GetDeviceId(), IStateMachine::BACKENDSTORAGE, $this->uuid, $this->newStateCounter);
|
||||
|
|
|
@ -44,7 +44,6 @@
|
|||
class ImportChangesStream implements IImportChanges {
|
||||
private $encoder;
|
||||
private $objclass;
|
||||
private $classAsString;
|
||||
private $seenObjects;
|
||||
private $importedMsgs;
|
||||
private $checkForIgnoredMessages;
|
||||
|
|
|
@ -172,6 +172,27 @@ class ZLog {
|
|||
return (isset(self::$lastLogs[$loglevel]))?self::$lastLogs[$loglevel]:false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Writes info at the end of the request but only if the LOGLEVEL is DEBUG or more verbose
|
||||
*
|
||||
* @access public
|
||||
* @return
|
||||
*/
|
||||
static public function WriteEnd() {
|
||||
if (LOGLEVEL_DEBUG <= LOGLEVEL) {
|
||||
if (version_compare(phpversion(), '5.4.0') < 0) {
|
||||
$time_used = number_format(time() - $_SERVER["REQUEST_TIME"], 4);
|
||||
}
|
||||
else {
|
||||
$time_used = number_format(microtime(true) - $_SERVER["REQUEST_TIME_FLOAT"], 4);
|
||||
}
|
||||
|
||||
ZLog::Write(LOGLEVEL_DEBUG, sprintf("Memory usage information: %s/%s - Execution time: %s - HTTP responde code: %s", memory_get_peak_usage(false), memory_get_peak_usage(true), $time_used, http_response_code()));
|
||||
ZLog::Write(LOGLEVEL_DEBUG, "-------- End");
|
||||
}
|
||||
}
|
||||
|
||||
/**----------------------------------------------------------------------------------------------------------
|
||||
* private log stuff
|
||||
*/
|
||||
|
|
|
@ -529,7 +529,7 @@ class ZPush {
|
|||
$loaded = false;
|
||||
foreach (self::$autoloadBackendPreference as $autoloadBackend) {
|
||||
ZLog::Write(LOGLEVEL_DEBUG, sprintf("ZPush::GetBackend(): trying autoload backend '%s'", $autoloadBackend));
|
||||
$loaded = self::IncludeBackend($autoloadBackend);
|
||||
$loaded = class_exists($autoloadBackend) || self::IncludeBackend($autoloadBackend);
|
||||
if ($loaded) {
|
||||
$ourBackend = $autoloadBackend;
|
||||
break;
|
||||
|
@ -538,7 +538,7 @@ class ZPush {
|
|||
if (!$ourBackend || !$loaded)
|
||||
throw new FatalMisconfigurationException("No Backend provider can not be loaded. Check your installation and configuration!");
|
||||
}
|
||||
else
|
||||
elseif (!class_exists($ourBackend))
|
||||
self::IncludeBackend($ourBackend);
|
||||
|
||||
if (class_exists($ourBackend))
|
||||
|
|
|
@ -110,7 +110,7 @@ class ExportChangesDiff extends DiffState implements IExportChanges{
|
|||
$this->changes = $this->getDiffTo($folderlist);
|
||||
}
|
||||
|
||||
ZLog::Write(LOGLEVEL_INFO, sprintf("ExportChangesDiff->InitializeExporter(): Found %d changes", count($this->changes)));
|
||||
ZLog::Write(LOGLEVEL_INFO, sprintf("ExportChangesDiff->InitializeExporter(): Found '%d' changes for '%s'", count($this->changes), ($this->folderid)?$this->folderid : 'hierarchy' ));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
43
sources/testing/samples/meeting_reply_rim.txt
Normal file
43
sources/testing/samples/meeting_reply_rim.txt
Normal file
|
@ -0,0 +1,43 @@
|
|||
BEGIN:VCALENDAR
|
||||
PRODID:-//Research In Motion//RIM App//EN
|
||||
VERSION:2.0
|
||||
CALSCALE:GREGORIAN
|
||||
METHOD:REPLY
|
||||
BEGIN:VTIMEZONE
|
||||
TZID:Europe/London
|
||||
BEGIN:STANDARD
|
||||
DTSTART:20001029T020000
|
||||
RRULE:FREQ=YEARLY;BYDAY=4SU;BYMONTH=10
|
||||
TZNAME:GMT
|
||||
TZOFFSETFROM:+0100
|
||||
TZOFFSETTO:+0000
|
||||
END:STANDARD
|
||||
BEGIN:DAYLIGHT
|
||||
DTSTART:20000326T010000
|
||||
RRULE:FREQ=YEARLY;BYDAY=4SU;BYMONTH=3
|
||||
TZNAME:BST
|
||||
TZOFFSETFROM:+0000
|
||||
TZOFFSETTO:+0100
|
||||
END:DAYLIGHT
|
||||
END:VTIMEZONE
|
||||
BEGIN:VEVENT
|
||||
ATTENDEE;RSVP=TRUE;ROLE=REQ-PARTICIPANT;CN=User1;PARTSTAT=ACCEPTED:mailto:user1
|
||||
@domain1.tld
|
||||
COMMENT:ok for me
|
||||
CREATED:20150823T184526Z
|
||||
DTEND;TZID=Europe/London:20150823T220000
|
||||
DTSTAMP:20150823T184527Z
|
||||
DTSTART;TZID=Europe/London:20150823T210000
|
||||
ORGANIZER:mailto:user3@domain3.tld
|
||||
SEQUENCE:0
|
||||
STATUS:CONFIRMED
|
||||
SUMMARY:Test of meeting with Z-push
|
||||
TRANSP:OPAQUE
|
||||
UID:f503ce50-49c6-11e5-9533-693764eab43f
|
||||
BEGIN:VALARM
|
||||
ACTION:DISPLAY
|
||||
DESCRIPTION:Test of meeting with Z-push in 15 minutes.
|
||||
TRIGGER;RELATED=START:-PT15M
|
||||
END:VALARM
|
||||
END:VEVENT
|
||||
END:VCALENDAR
|
25
sources/testing/testing-imap_meeting_method.php
Normal file
25
sources/testing/testing-imap_meeting_method.php
Normal file
|
@ -0,0 +1,25 @@
|
|||
<?php
|
||||
|
||||
require_once 'vendor/autoload.php';
|
||||
|
||||
define('LOGLEVEL', LOGLEVEL_DEBUG);
|
||||
define('LOGUSERLEVEL', LOGLEVEL_DEVICEID);
|
||||
|
||||
date_default_timezone_set('Europe/Madrid');
|
||||
|
||||
function testing_get_method($filename) {
|
||||
$body = file_get_contents($filename);
|
||||
|
||||
$ical = new iCalComponent();
|
||||
$ical->ParseFrom($body);
|
||||
|
||||
$props = $ical->GetPropertiesByPath("VCALENDAR/METHOD");
|
||||
if (count($props) > 0) {
|
||||
printf("METHOD %s\n", $props[0]->Value());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
testing_get_method('testing/samples/meeting_request.txt');
|
||||
testing_get_method('testing/samples/meeting_request_rim.txt');
|
||||
testing_get_method('testing/samples/meeting_reply_rim.txt');
|
Loading…
Add table
Reference in a new issue