mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-23 00:13:35 +01:00
commit for Lars: latest SyncML updates
This commit is contained in:
parent
f4703004e3
commit
83b0801533
@ -19,6 +19,8 @@
|
||||
function exportVTODO($_taskID, $_version)
|
||||
{
|
||||
$taskData = $this->read($_taskID);
|
||||
|
||||
$taskData = $GLOBALS['egw']->translation->convert($taskData,$GLOBALS['egw']->translation->charset(),'UTF-8');
|
||||
|
||||
//_debug_array($taskData);
|
||||
|
||||
@ -88,13 +90,14 @@
|
||||
foreach($component->_attributes as $attributes)
|
||||
{
|
||||
#print $attributes['name'].' - '.$attributes['value'].'<br>';
|
||||
#$attributes['value'] = $GLOBALS['egw']->translation->convert($attributes['value'],'UTF-8');
|
||||
switch($attributes['name'])
|
||||
{
|
||||
case 'CLASS':
|
||||
$taskData['info_access'] = strtolower($attributes['value']);
|
||||
$taskData['info_access'] = strtolower($attributes['value']);
|
||||
break;
|
||||
case 'DESCRIPTION':
|
||||
$taskData['info_des'] = $botranslation->convert($attributes['value'],'utf-8');
|
||||
$taskData['info_des'] = $attributes['value'];
|
||||
break;
|
||||
case 'DUE':
|
||||
$taskData['info_enddate'] = $attributes['value'];
|
||||
|
@ -39,7 +39,7 @@ class Horde_RPC_syncml extends Horde_RPC {
|
||||
/**
|
||||
* Debug directory, if set will store copies of all packets.
|
||||
*/
|
||||
var $_debugDir = '/var/www/groupware.groupwareappliance.com/htdocs/syncml/';
|
||||
var $_debugDir = '/var/www/html/syncdebug/';
|
||||
|
||||
/**
|
||||
* Default character set. Only supports UTF-8(ASCII?).
|
||||
|
@ -536,8 +536,8 @@ class Horde_SyncML_SyncMLBody extends Horde_SyncML_ContentHandler {
|
||||
}
|
||||
Horde::logMessage('SyncML: summary:' . $s, __FILE__, __LINE__, PEAR_LOG_INFO);
|
||||
// session can be closed here!
|
||||
session_unset();
|
||||
session_destroy();
|
||||
//session_unset();
|
||||
//session_destroy();
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -66,6 +66,10 @@ class Horde_SyncML_Command {
|
||||
|
||||
function characters($str)
|
||||
{
|
||||
$tempValue = trim($str);
|
||||
|
||||
if(empty($tempValue)) return;
|
||||
|
||||
if (isset($this->_chars)) {
|
||||
$this->_chars = $this->_chars . $str;
|
||||
} else {
|
||||
|
@ -200,6 +200,19 @@ class Horde_SyncML_Command_Alert extends Horde_SyncML_Command {
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$status = &new Horde_SyncML_Command_Status(RESPONSE_OK, 'Alert');
|
||||
$status->setCmdRef($this->_cmdID);
|
||||
if ($this->_sourceLocURI != null) {
|
||||
$status->setSourceRef($this->_sourceLocURI);
|
||||
}
|
||||
if ($this->_targetLocURI != null) {
|
||||
$status->setTargetRef((isset($this->_targetLocURIParameters) ? $this->_targetLocURI.'?/'.$this->_targetLocURIParameters : $this->_targetLocURI));
|
||||
}
|
||||
|
||||
$currentCmdID = $status->output($currentCmdID, $output);
|
||||
}
|
||||
/* else
|
||||
{
|
||||
if ($state->isAuthorized()) {
|
||||
$output->startElement($state->getURI(), 'Alert', $attrs);
|
||||
@ -238,8 +251,7 @@ class Horde_SyncML_Command_Alert extends Horde_SyncML_Command {
|
||||
|
||||
$currentCmdID++;
|
||||
}
|
||||
}
|
||||
|
||||
}*/
|
||||
|
||||
return $currentCmdID;
|
||||
}
|
||||
|
@ -97,7 +97,8 @@ class Horde_SyncML_Command_Sync extends Horde_Syncml_Command {
|
||||
$state = $_SESSION['SyncML.state'];
|
||||
if($state->getSyncStatus() == CLIENT_SYNC_FINNISHED || $state->getSyncStatus() == SERVER_SYNC_DATA_PENDING)
|
||||
{
|
||||
##############
|
||||
##############
|
||||
$state->setSyncStatus(SERVER_SYNC_DATA_PENDING);
|
||||
$targets = $state->getTargets();
|
||||
Horde::logMessage('SyncML: starting sync to client '.$targets[0], __FILE__, __LINE__, PEAR_LOG_DEBUG);
|
||||
$attrs = array();
|
||||
@ -139,7 +140,7 @@ class Horde_SyncML_Command_Sync extends Horde_Syncml_Command {
|
||||
|
||||
$output->endElement($state->getURI(), 'Sync');
|
||||
|
||||
if($currentCmdID > MAX_DATA) break;
|
||||
break;
|
||||
}
|
||||
#Horde::logMessage('SyncML: ending sync to client '.$targets[0], __FILE__, __LINE__, PEAR_LOG_DEBUG);
|
||||
|
||||
|
@ -17,9 +17,11 @@ include_once 'Horde/SyncML/Command/Sync/SyncElement.php';
|
||||
*/
|
||||
class Horde_SyncML_Command_Sync_Add extends Horde_SyncML_Command_Sync_SyncElement {
|
||||
|
||||
var $_status = RESPONSE_ITEM_ADDED;
|
||||
|
||||
function output($currentCmdID, &$output)
|
||||
{
|
||||
$status = &new Horde_SyncML_Command_Status(RESPONSE_ITEM_ADDED, 'Add');
|
||||
$status = &new Horde_SyncML_Command_Status($this->_status, 'Add');
|
||||
$status->setCmdRef($this->_cmdID);
|
||||
|
||||
if (isset($this->_luid)) {
|
||||
|
@ -127,7 +127,7 @@ class Horde_SyncML_Command_Sync_ContentSyncElement extends Horde_SyncML_Command_
|
||||
}
|
||||
if (isset($this->_content)) {
|
||||
$output->startElement($state->getURI(), 'Data', $attrs);
|
||||
$chars = $this->_content;
|
||||
$chars = '<![CDATA['.$this->_content.']]>';
|
||||
$output->characters($chars);
|
||||
$output->endElement($state->getURI(), 'Data');
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ class Horde_SyncML_Command_Sync_Delete extends Horde_SyncML_Command_Sync_SyncEle
|
||||
|
||||
function output($currentCmdID, &$output)
|
||||
{
|
||||
$status = &new Horde_SyncML_Command_Status(RESPONSE_OK, 'Delete');
|
||||
$status = &new Horde_SyncML_Command_Status($this->_status, 'Delete');
|
||||
$status->setCmdRef($this->_cmdID);
|
||||
|
||||
if (isset($this->_luid)) {
|
||||
|
@ -19,7 +19,7 @@ class Horde_SyncML_Command_Sync_Replace extends Horde_SyncML_Command_Sync_SyncEl
|
||||
|
||||
function output($currentCmdID, &$output)
|
||||
{
|
||||
$status = &new Horde_SyncML_Command_Status(RESPONSE_OK, 'Replace');
|
||||
$status = &new Horde_SyncML_Command_Status($this->_status, 'Replace');
|
||||
$status->setCmdRef($this->_cmdID);
|
||||
|
||||
if (isset($this->_luid)) {
|
||||
|
@ -22,6 +22,7 @@ class Horde_SyncML_Command_Sync_SyncElement extends Horde_SyncML_Command {
|
||||
var $_isSource;
|
||||
var $_content;
|
||||
var $_contentType;
|
||||
var $_status = RESPONSE_OK;
|
||||
|
||||
function &factory($command, $params = null)
|
||||
{
|
||||
@ -52,6 +53,8 @@ class Horde_SyncML_Command_Sync_SyncElement extends Horde_SyncML_Command {
|
||||
|
||||
function endElement($uri, $element)
|
||||
{
|
||||
$search = array('/ *\n/','/ *$/m');
|
||||
$replace = array('','');
|
||||
switch ($this->_xmlStack) {
|
||||
case 1:
|
||||
// Need to add sync elements to the Sync method?
|
||||
@ -61,7 +64,9 @@ class Horde_SyncML_Command_Sync_SyncElement extends Horde_SyncML_Command {
|
||||
if ($element == 'Source') {
|
||||
$this->_isSource = false;
|
||||
} elseif ($element == 'Data') {
|
||||
$this->_content = trim($this->_chars);
|
||||
$this->_content = $this->_chars;
|
||||
} elseif ($element == 'MoreData') {
|
||||
$this->_moreData = TRUE;
|
||||
} elseif ($element == 'Type') {
|
||||
if(!isset($this->_contentType))
|
||||
$this->_contentType = trim($this->_chars);
|
||||
@ -73,6 +78,8 @@ class Horde_SyncML_Command_Sync_SyncElement extends Horde_SyncML_Command {
|
||||
$this->_luid = trim($this->_chars);
|
||||
} elseif ($element == 'Type') {
|
||||
$this->_contentType = trim($this->_chars);
|
||||
} elseif ($element == 'Size') {
|
||||
$this->_contentSize = trim($this->_chars);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -119,5 +126,9 @@ class Horde_SyncML_Command_Sync_SyncElement extends Horde_SyncML_Command {
|
||||
{
|
||||
$this->_content = $content;
|
||||
}
|
||||
|
||||
|
||||
function setStatus($_status)
|
||||
{
|
||||
$this->_status = $_status;
|
||||
}
|
||||
}
|
||||
|
@ -129,7 +129,8 @@ define('CLIENT_SYNC_FINNISHED', 2);
|
||||
define('SERVER_SYNC_DATA_PENDING', 3);
|
||||
define('SERVER_SYNC_FINNISHED', 4);
|
||||
|
||||
define('MAX_DATA', 30);
|
||||
define('MAX_DATA', 19);
|
||||
define('MAX_ENTRIES', 10);
|
||||
|
||||
/**
|
||||
* The Horde_SyncML_State class provides a SyncML state object.
|
||||
|
@ -89,9 +89,9 @@ class Horde_SyncML_Sync {
|
||||
* Command takes place. Entries are added, deleted or replaced
|
||||
* from the server database by using Horde API (Registry) calls.
|
||||
*/
|
||||
function runSyncCommand($command)
|
||||
function runSyncCommand(&$command)
|
||||
{
|
||||
Horde::logMessage('SyncML: content type is ' . $command->getContentType(), __FILE__, __LINE__, PEAR_LOG_DEBUG);
|
||||
Horde::logMessage('SyncML: content type is ' . $command->getContentType() .' moreData '. $command->_moreData, __FILE__, __LINE__, PEAR_LOG_DEBUG);
|
||||
global $registry;
|
||||
|
||||
#require_once 'Horde/History.php';
|
||||
@ -99,6 +99,63 @@ class Horde_SyncML_Sync {
|
||||
$history = $GLOBALS['phpgw']->contenthistory;
|
||||
|
||||
$state = &$_SESSION['SyncML.state'];
|
||||
|
||||
if(isset($state->_moreData['luid']))
|
||||
{
|
||||
if(($command->_luid == $state->_moreData['luid']))
|
||||
{
|
||||
$lastChunks = implode('',$state->_moreData['chunks']);
|
||||
$command->_content = $lastChunks.$command->_content;
|
||||
$stringlen1 = strlen($lastChunks);
|
||||
$stringlen2 = strlen($command->_content);
|
||||
|
||||
if(!$command->_moreData &&
|
||||
strlen($command->_content)
|
||||
!= $state->_moreData['contentSize']
|
||||
)
|
||||
{
|
||||
$command->_status = RESPONSE_SIZE_MISMATCH;
|
||||
$state->_moreData = array();
|
||||
|
||||
return;
|
||||
}
|
||||
elseif(!$command->_moreData &&
|
||||
strlen($command->_content)
|
||||
== $state->_moreData['contentSize']
|
||||
)
|
||||
{
|
||||
$state->_moreData = array();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
// alert 223 needed too
|
||||
#$command->_status = ALERT_NO_END_OF_DATA;
|
||||
|
||||
$state->_moreData = array();
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// don't add/replace the data currently, they are not yet complete
|
||||
if($command->_moreData == TRUE)
|
||||
{
|
||||
$state->_moreData['chunks'][] = $command->_content;
|
||||
$state->_moreData['luid'] = $command->_luid;
|
||||
|
||||
// gets only set with the first chunk of data
|
||||
if(isset($command->_contentSize))
|
||||
$state->_moreData['contentSize'] = $command->_contentSize;
|
||||
|
||||
$command->_status = RESPONSE_CHUNKED_ITEM_ACCEPTED_AND_BUFFERED;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$hordeType = $type = $this->_targetLocURI;
|
||||
// remove the './' from the beginning
|
||||
$hordeType = str_replace('./','',$hordeType);
|
||||
|
@ -64,7 +64,7 @@ class Horde_SyncML_Sync_OneWayFromServerSync extends Horde_SyncML_Sync {
|
||||
|
||||
$syncItems++;
|
||||
// return if we have to much data
|
||||
if($syncItems > MAX_DATA)
|
||||
if($syncItems >= MAX_ENTRIES)
|
||||
{
|
||||
$state->setMoreDataPending();
|
||||
return $currentCmdID;
|
||||
|
@ -47,7 +47,7 @@ class Horde_SyncML_Sync_RefreshFromServerSync extends Horde_SyncML_Sync {
|
||||
|
||||
$syncItems++;
|
||||
// return if we have to much data
|
||||
if($syncItems > MAX_DATA)
|
||||
if($syncItems >= MAX_ENTRIES)
|
||||
{
|
||||
$state->setMoreDataPending();
|
||||
return $currentCmdID;
|
||||
|
@ -38,18 +38,19 @@ class Horde_SyncML_Sync_SlowSync extends Horde_SyncML_Sync_TwoWaySync {
|
||||
|
||||
Horde::logMessage("SyncML: ".count($adds). ' added items found for '.$hordeType , __FILE__, __LINE__, PEAR_LOG_DEBUG);
|
||||
$serverAnchorNext = $state->getServerAnchorNext($syncType);
|
||||
$counter = 0;
|
||||
|
||||
while($guid = array_shift($adds))
|
||||
{
|
||||
#$guid_ts = max($history->getTSforAction($guid, 'add'),$history->getTSforAction($guid, 'modify'));
|
||||
$sync_ts = $state->getChangeTS($syncType, $guid);
|
||||
#Horde::logMessage("SyncML: timestamp add: $guid sync_ts: $sync_ts anchorNext: ". $serverAnchorNext.' / '.time(), __FILE__, __LINE__, PEAR_LOG_DEBUG);
|
||||
Horde::logMessage("SyncML: slowsync timestamp add: $guid sync_ts: $sync_ts anchorNext: ". $serverAnchorNext.' / '.time(), __FILE__, __LINE__, PEAR_LOG_DEBUG);
|
||||
// $sync_ts it got synced from client to server someone
|
||||
// $sync_ts >= $serverAnchorNext it got synced from client to server in this sync package already
|
||||
if ($sync_ts && $sync_ts >= $serverAnchorNext) {
|
||||
// Change was done by us upon request of client.
|
||||
// Don't mirror that back to the client.
|
||||
#Horde::logMessage("SyncML: add: $guid ignored, came from client", __FILE__, __LINE__, PEAR_LOG_DEBUG);
|
||||
//Horde::logMessage("SyncML: slowsync add: $guid ignored, came from client", __FILE__, __LINE__, PEAR_LOG_DEBUG);
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -64,6 +65,7 @@ class Horde_SyncML_Sync_SlowSync extends Horde_SyncML_Sync_TwoWaySync {
|
||||
$c = $registry->call($hordeType . '/export',
|
||||
array('guid' => $guid,
|
||||
'contentType' => $contentType));
|
||||
Horde::logMessage("SyncML: slowsync add to server $c", __FILE__, __LINE__, PEAR_LOG_DEBUG);
|
||||
if (!is_a($c, 'PEAR_Error')) {
|
||||
// Item in history but not in database. Strange, but
|
||||
// can happen.
|
||||
@ -75,7 +77,7 @@ class Horde_SyncML_Sync_SlowSync extends Horde_SyncML_Sync_TwoWaySync {
|
||||
$state->log('Server-Add');
|
||||
|
||||
// return if we have to much data
|
||||
if($currentCmdID > MAX_DATA)
|
||||
if(++$counter >= MAX_ENTRIES)
|
||||
{
|
||||
$state->setSyncStatus(SERVER_SYNC_DATA_PENDING);
|
||||
return $currentCmdID;
|
||||
@ -100,7 +102,6 @@ class Horde_SyncML_Sync_SlowSync extends Horde_SyncML_Sync_TwoWaySync {
|
||||
Horde::logMessage("SyncML: reading added items from database for $hordeType", __FILE__, __LINE__, PEAR_LOG_DEBUG);
|
||||
$state->setAddedItems($hordeType, $registry->call($hordeType. '/list', array()));
|
||||
$adds = &$state->getAddedItems($hordeType);
|
||||
|
||||
$this->_syncDataLoaded = TRUE;
|
||||
|
||||
return count($state->getAddedItems($hordeType));
|
||||
|
@ -56,6 +56,7 @@ class Horde_SyncML_Sync_TwoWaySync extends Horde_SyncML_Sync {
|
||||
#$history = &Horde_History::singleton();
|
||||
$history = $GLOBALS['phpgw']->contenthistory;
|
||||
$state = &$_SESSION['SyncML.state'];
|
||||
$counter = 0;
|
||||
|
||||
$changes = &$state->getChangedItems($hordeType);
|
||||
$deletes = &$state->getDeletedItems($hordeType);
|
||||
@ -104,7 +105,7 @@ class Horde_SyncML_Sync_TwoWaySync extends Horde_SyncML_Sync {
|
||||
$state->log('Server-Replace');
|
||||
|
||||
// return if we have to much data
|
||||
if($currentCmdID > MAX_DATA)
|
||||
if(++$counter >= MAX_ENTRIES)
|
||||
{
|
||||
$state->setSyncStatus(SERVER_SYNC_DATA_PENDING);
|
||||
return $currentCmdID;
|
||||
@ -141,7 +142,7 @@ class Horde_SyncML_Sync_TwoWaySync extends Horde_SyncML_Sync {
|
||||
$state->removeUID($syncType, $locid);
|
||||
|
||||
// return if we have to much data
|
||||
if($currentCmdID > MAX_DATA)
|
||||
if(++$counter >= MAX_ENTRIES)
|
||||
{
|
||||
$state->setSyncStatus(SERVER_SYNC_DATA_PENDING);
|
||||
return $currentCmdID;
|
||||
@ -200,7 +201,7 @@ class Horde_SyncML_Sync_TwoWaySync extends Horde_SyncML_Sync {
|
||||
$state->log('Server-Add');
|
||||
|
||||
// return if we have to much data
|
||||
if($currentCmdID > MAX_DATA)
|
||||
if(++$counter >= MAX_ENTRIES)
|
||||
{
|
||||
$state->setSyncStatus(SERVER_SYNC_DATA_PENDING);
|
||||
return $currentCmdID;
|
||||
|
@ -406,7 +406,6 @@ class Horde_iCalendar {
|
||||
*/
|
||||
function parsevCalendar($text, $base = 'VCALENDAR', $charset = 'utf-8', $clear = true)
|
||||
{
|
||||
$botranslation = CreateObject('phpgwapi.translation');
|
||||
if ($clear) {
|
||||
$this->clear();
|
||||
}
|
||||
@ -494,18 +493,18 @@ class Horde_iCalendar {
|
||||
$value = quoted_printable_decode($value);
|
||||
// Quoted printable is normally encoded as utf-8.
|
||||
if (isset($params['CHARSET'])) {
|
||||
$value = $botranslation->convert($value, $params['CHARSET']);
|
||||
$value = $GLOBALS['egw']->translation->convert($value, $params['CHARSET'],'iso-8859-1');
|
||||
} else {
|
||||
$value = $botranslation->convert($value, 'utf-8');
|
||||
$value = $GLOBALS['egw']->translation->convert($value, 'utf-8');
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($params['CHARSET'])) {
|
||||
$value = $botranslation->convert($value, $params['CHARSET']);
|
||||
$value = $GLOBALS['egw']->translation->convert($value, $params['CHARSET']);
|
||||
} else {
|
||||
// As per RFC 2279, assume UTF8 if we don't have
|
||||
// an explicit charset parameter.
|
||||
$value = $botranslation->convert($value, $charset);
|
||||
$value = $GLOBALS['egw']->translation->convert($value, 'utf-8');
|
||||
}
|
||||
|
||||
switch ($tag) {
|
||||
@ -1177,7 +1176,7 @@ class Horde_iCalendar {
|
||||
* @access private
|
||||
* @return string
|
||||
*/
|
||||
function EncodeQP ($str) {
|
||||
function EncodeQP_old ($str) {
|
||||
$encoded = $this->FixEOL($str);
|
||||
#$encoded = $str;
|
||||
#if (substr($encoded, -(strlen($this->LE))) != $this->LE)
|
||||
@ -1189,6 +1188,8 @@ class Horde_iCalendar {
|
||||
$encoded = preg_replace('/([\000-\012\015\016\020-\037\075\177-\377])/e',
|
||||
"'='.sprintf('%02X', ord('\\1'))", $encoded);
|
||||
// Replace every spaces and tabs when it's the last character on a line
|
||||
#$encoded = preg_replace("/([\011\040])".$this->LE."/e",
|
||||
# "'='.sprintf('%02X', ord('\\1')).'".$this->LE."'", $encoded);
|
||||
$encoded = preg_replace("/([\011\040])".$this->LE."/e",
|
||||
"'='.sprintf('%02X', ord('\\1')).'".$this->LE."'", $encoded);
|
||||
|
||||
@ -1205,7 +1206,7 @@ class Horde_iCalendar {
|
||||
* @access private
|
||||
* @return string
|
||||
*/
|
||||
function WrapText($message, $length, $qp_mode = false) {
|
||||
function WrapText_old($message, $length, $qp_mode = false) {
|
||||
$soft_break = ($qp_mode) ? "=\r\n" : $this->LE;
|
||||
|
||||
#$message = $this->FixEOL($message);
|
||||
@ -1291,5 +1292,110 @@ class Horde_iCalendar {
|
||||
return $str;
|
||||
}
|
||||
|
||||
/**
|
||||
* Encode string to quoted-printable.
|
||||
* @access private
|
||||
* @return string
|
||||
*/
|
||||
function EncodeQP ($str) {
|
||||
$encoded = $this->FixEOL($str);
|
||||
if (substr($encoded, -(strlen($this->LE))) != $this->LE)
|
||||
$encoded .= $this->LE;
|
||||
|
||||
// Replace every high ascii, control and = characters
|
||||
#$encoded = preg_replace('/([\000-\010\013\014\016-\037\075\177-\377])/e',
|
||||
# "'='.sprintf('%02X', ord('\\1'))", $encoded);
|
||||
$encoded = preg_replace('/([\000-\012\015\016\020-\037\075\177-\377])/e',
|
||||
"'='.sprintf('%02X', ord('\\1'))", $encoded);
|
||||
// Replace every spaces and tabs when it's the last character on a line
|
||||
$encoded = preg_replace("/([\011\040])".$this->LE."/e",
|
||||
"'='.sprintf('%02X', ord('\\1')).'".$this->LE."'", $encoded);
|
||||
|
||||
// Maximum line length of 76 characters before CRLF (74 + space + '=')
|
||||
#$encoded = $this->WrapText($encoded, 74, true);
|
||||
|
||||
return $encoded;
|
||||
}
|
||||
|
||||
/**
|
||||
* Wraps message for use with mailers that do not
|
||||
* automatically perform wrapping and for quoted-printable.
|
||||
* Original written by philippe.
|
||||
* @access private
|
||||
* @return string
|
||||
*/
|
||||
function WrapText($message, $length, $qp_mode = false) {
|
||||
$soft_break = ($qp_mode) ? sprintf(" =%s", $this->LE) : $this->LE;
|
||||
$soft_break = "..=";
|
||||
|
||||
$message = $this->FixEOL($message);
|
||||
if (substr($message, -1) == $this->LE)
|
||||
$message = substr($message, 0, -1);
|
||||
|
||||
$line = explode($this->LE, $message);
|
||||
$message = "";
|
||||
for ($i=0 ;$i < count($line); $i++)
|
||||
{
|
||||
$line_part = explode(" ", $line[$i]);
|
||||
$buf = "";
|
||||
for ($e = 0; $e<count($line_part); $e++)
|
||||
{
|
||||
$word = $line_part[$e];
|
||||
if ($qp_mode and (strlen($word) > $length))
|
||||
{
|
||||
$space_left = $length - strlen($buf) - 1;
|
||||
if ($e != 0)
|
||||
{
|
||||
if ($space_left > 20)
|
||||
{
|
||||
$len = $space_left;
|
||||
if (substr($word, $len - 1, 1) == "=")
|
||||
$len--;
|
||||
elseif (substr($word, $len - 2, 1) == "=")
|
||||
$len -= 2;
|
||||
$part = substr($word, 0, $len);
|
||||
$word = substr($word, $len);
|
||||
$buf .= " " . $part;
|
||||
$message .= $buf . sprintf("=%s", $this->LE);
|
||||
}
|
||||
else
|
||||
{
|
||||
$message .= $buf . $soft_break;
|
||||
}
|
||||
$buf = "";
|
||||
}
|
||||
while (strlen($word) > 0)
|
||||
{
|
||||
$len = $length;
|
||||
if (substr($word, $len - 1, 1) == "=")
|
||||
$len--;
|
||||
elseif (substr($word, $len - 2, 1) == "=")
|
||||
$len -= 2;
|
||||
$part = substr($word, 0, $len);
|
||||
$word = substr($word, $len);
|
||||
|
||||
if (strlen($word) > 0)
|
||||
$message .= $part . sprintf("=%s", $this->LE);
|
||||
else
|
||||
$buf = $part;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$buf_o = $buf;
|
||||
$buf .= ($e == 0) ? $word : (" " . $word);
|
||||
|
||||
if (strlen($buf) > $length and $buf_o != "")
|
||||
{
|
||||
$message .= $buf_o . $soft_break;
|
||||
$buf = $word;
|
||||
}
|
||||
}
|
||||
}
|
||||
$message .= $buf . $this->LE;
|
||||
}
|
||||
|
||||
return $message;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -33,6 +33,7 @@ class XML_WBXML_ContentHandler {
|
||||
function XML_WBXML_ContentHandler()
|
||||
{
|
||||
$this->_currentUri = &new XML_WBXML_LifoQueue();
|
||||
$this->_output = '<?xml version="1.0" encoding="UTF-8" ?>';
|
||||
}
|
||||
|
||||
function raiseError($error)
|
||||
|
@ -100,3 +100,13 @@ $this->applications['egwcalendarsync'] = array(
|
||||
'menu_parent' => 'organizing'
|
||||
);
|
||||
|
||||
$this->applications['egwtaskssync'] = array(
|
||||
'fileroot' => EGW_SERVER_ROOT.'/syncml/tasks',
|
||||
'webroot' => $this->applications['horde']['webroot'] . '/mnemo',
|
||||
'icon' => $this->applications['horde']['webroot'] . '/mnemo/graphics/mnemo.gif',
|
||||
'name' => _("Tasks"),
|
||||
'status' => 'active',
|
||||
'provides' => 'tasks',
|
||||
'menu_parent' => 'organizing'
|
||||
);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user