summaryrefslogtreecommitdiff
path: root/lib/kolab_sync_data_email.php
diff options
context:
space:
mode:
authorAleksander Machniak <alec@alec.pl>2012-08-23 07:39:54 (GMT)
committerAleksander Machniak <alec@alec.pl>2012-08-23 07:39:54 (GMT)
commit6772ebd0223eff2773c972fc9de22b3ba5e524c6 (patch)
treef4d01aad28ddf3627b3e3bfa49d226546bbd1ee2 /lib/kolab_sync_data_email.php
parentc5ce4e2dc08661a062b31318b145487e32808175 (diff)
downloadkolab-syncroton-6772ebd0223eff2773c972fc9de22b3ba5e524c6.tar.gz
Update Syncroton, update code for API changes
Diffstat (limited to 'lib/kolab_sync_data_email.php')
-rw-r--r--lib/kolab_sync_data_email.php91
1 files changed, 45 insertions, 46 deletions
diff --git a/lib/kolab_sync_data_email.php b/lib/kolab_sync_data_email.php
index 311ef70..6b6778d 100644
--- a/lib/kolab_sync_data_email.php
+++ b/lib/kolab_sync_data_email.php
@@ -34,21 +34,20 @@ class kolab_sync_data_email extends kolab_sync_data implements Syncroton_Data_ID
* Mapping from ActiveSync Email namespace fields
*/
protected $mapping = array(
- 'Cc' => 'cc',
- //'ContentClass' => 'contentclass',
- 'DateReceived' => 'internaldate',
- //'DisplayTo' => 'displayto', //?
- //'Flag' => 'flag',
- //'FlagType' => 'flagtype', // child of Flag element
- 'From' => 'from',
- //'Importance' => 'importance',
- 'InternetCPID' => 'charset',
- //'MessageClass' => 'messageclass',
- 'ReplyTo' => 'replyto',
- //'Read' => 'read',
- 'Subject' => 'subject',
- //'ThreadTopic' => 'threadtopic',
- 'To' => 'to',
+ 'cc' => 'cc',
+ //'contentClass' => 'contentclass',
+ 'dateReceived' => 'internaldate',
+ //'displayTo' => 'displayto', //?
+ //'flag' => 'flag',
+ 'from' => 'from',
+ //'importance' => 'importance',
+ 'internetCPID' => 'charset',
+ //'messageClass' => 'messageclass',
+ 'replyTo' => 'replyto',
+ //'read' => 'read',
+ 'subject' => 'subject',
+ //'threadTopic' => 'threadtopic',
+ 'to' => 'to',
);
/**
@@ -162,14 +161,14 @@ class kolab_sync_data_email extends kolab_sync_data implements Syncroton_Data_ID
// $result['ConversationIndex'] = 'CA2CFA8A23';
// Read flag
- $result['Read'] = intval(!empty($headers->flags['SEEN']));
+ $result['read'] = intval(!empty($headers->flags['SEEN']));
// Flagged message
if (!empty($headers->flags['FLAGGED'])) {
// Use FollowUp flag which is used in Android when message is marked with a star
- $result['Flag'] = new Syncroton_Model_EmailFlag(array(
- 'FlagType' => 'FollowUp',
- 'Status' => Syncroton_Model_EmailFlag::STATUS_ACTIVE,
+ $result['flag'] = new Syncroton_Model_EmailFlag(array(
+ 'flagType' => 'FollowUp',
+ 'status' => Syncroton_Model_EmailFlag::STATUS_ACTIVE,
));
}
@@ -179,7 +178,7 @@ class kolab_sync_data_email extends kolab_sync_data implements Syncroton_Data_ID
$result['importance'] = 2; // High
}
else if ($headers->priority > 3) {
- $result['Importance'] = 0; // Low
+ $result['importance'] = 0; // Low
}
}
@@ -271,24 +270,24 @@ class kolab_sync_data_email extends kolab_sync_data implements Syncroton_Data_ID
}
$body_params = array(
- 'Type' => $airSyncBaseType,
- 'Truncated' => $isTruncacted,
+ 'type' => $airSyncBaseType,
+ 'truncated' => $isTruncacted,
);
if ($isTruncated) {
- $body_params['EstimatedDataSize'] = $real_length;
+ $body_params['estimatedDataSize'] = $real_length;
}
- $result['Body'] = $this->setBody($messageBody, $body_params);
- $result['NativeBodyType'] = intval($message->has_html_part(false));
+ $result['body'] = $this->setBody($messageBody, $body_params);
+ $result['nativeBodyType'] = intval($message->has_html_part(false));
// Message class
- $result['MessageClass'] = 'IPM.Note' . ($airSyncBaseType == Syncroton_Command_Sync::MIMESUPPORT_SEND_MIME ? '.SMIME' : '');
- $result['ContentClass'] = 'urn:content-classes:message';
+ $result['messageClass'] = 'IPM.Note' . ($airSyncBaseType == Syncroton_Command_Sync::MIMESUPPORT_SEND_MIME ? '.SMIME' : '');
+ $result['contentClass'] = 'urn:content-classes:message';
// attachments
$attachments = array_merge($message->attachments, $message->inline_parts);
if (!empty($attachments)) {
- $result['Attachments'] = array();
+ $result['attachments'] = array();
foreach ($attachments as $attachment) {
$att = array();
@@ -298,23 +297,23 @@ class kolab_sync_data_email extends kolab_sync_data implements Syncroton_Data_ID
$filename = 'HTML Part';
}
- $att['DisplayName'] = $filename;
- $att['FileReference'] = $serverId . '::' . $attachment->mime_id;
- $att['Method'] = 1;
- $att['EstimatedDataSize'] = $attachment->size;
+ $att['displayName'] = $filename;
+ $att['fileReference'] = $serverId . '::' . $attachment->mime_id;
+ $att['method'] = 1;
+ $att['estimatedDataSize'] = $attachment->size;
if (!empty($attachment->content_id)) {
- $att['ContentId'] = $attachment->content_id;
+ $att['contentId'] = $attachment->content_id;
}
if (!empty($attachment->content_location)) {
- $att['ContentLocation'] = $attachment->content_location;
+ $att['contentLocation'] = $attachment->content_location;
}
if (in_array($attachment, $message->inline_parts)) {
- $att['IsInline'] = 1;
+ $att['isInline'] = 1;
}
- $result['Attachments'][] = new Syncroton_Model_EmailAttachment($att);
+ $result['attachments'][] = new Syncroton_Model_EmailAttachment($att);
}
}
@@ -456,20 +455,20 @@ class kolab_sync_data_email extends kolab_sync_data implements Syncroton_Data_ID
$is_flagged = !empty($message->headers->flags['FLAGGED']);
// Read status change
- if (isset($entry->Read)) {
+ if (isset($entry->read)) {
// here we update only Read flag
- $flag = (((int)$entry->Read != 1) ? 'UN' : '') . 'SEEN';
+ $flag = (((int)$entry->read != 1) ? 'UN' : '') . 'SEEN';
$this->storage->set_flag($msg['uid'], $flag, $msg['foldername']);
}
// Flag change
- if (empty($entry->Flag)) {
+ if (empty($entry->flag)) {
if ($is_flagged) {
$this->storage->set_flag($msg['uid'], 'UNFLAGGED', $msg['foldername']);
}
}
- else if (!$is_flagged && !empty($entry->Flag)) {
- if ($entry->Flag->FlagType && preg_match('/^follow\s*up/i', $entry->Flag->FlagType)) {
+ else if (!$is_flagged && !empty($entry->flag)) {
+ if ($entry->flag->flagType && preg_match('/^follow\s*up/i', $entry->flag->flagType)) {
$this->storage->set_flag($msg['uid'], 'FLAGGED', $msg['foldername']);
}
}
@@ -740,9 +739,9 @@ class kolab_sync_data_email extends kolab_sync_data implements Syncroton_Data_ID
$uids = $search->get();
foreach ($uids as $idx => $uid) {
$uids[$idx] = new Syncroton_Model_StoreResponseResult(array(
- 'LongId' => $this->createMessageId($folderid, $uid),
- 'CollectionId' => $folderid,
- 'Class' => 'Email',
+ 'longId' => $this->createMessageId($folderid, $uid),
+ 'collectionId' => $folderid,
+ 'class' => 'Email',
));
}
$result = array_merge($result, $uids);
@@ -853,8 +852,8 @@ class kolab_sync_data_email extends kolab_sync_data implements Syncroton_Data_ID
$content_type = $part->mimetype;
return new Syncroton_Model_FileReference(array(
- 'ContentType' => $content_type,
- 'Data' => $body,
+ 'contentType' => $content_type,
+ 'data' => $body,
));
}