2 commits - plugins/libkolab
Aleksander Machniak
machniak at kolabsys.com
Sun Dec 9 12:23:58 CET 2012
plugins/libkolab/lib/kolab_storage.php | 2 -
plugins/libkolab/lib/kolab_storage_folder.php | 33 +++++++++++++++-----------
2 files changed, 21 insertions(+), 14 deletions(-)
New commits:
commit a72a0ca097cc9f9838dbe40d9c4cc6e29717ba8c
Author: Aleksander Machniak <machniak at kolabsys.com>
Date: Sun Dec 9 12:23:38 2012 +0100
RCMAIL_CHARSET -> RCUBE_CHARSET
diff --git a/plugins/libkolab/lib/kolab_storage.php b/plugins/libkolab/lib/kolab_storage.php
index 05cb08d..6151b9a 100644
--- a/plugins/libkolab/lib/kolab_storage.php
+++ b/plugins/libkolab/lib/kolab_storage.php
@@ -257,7 +257,7 @@ class kolab_storage
{
self::setup();
- $folder = rcube_charset::convert($prop['name'], RCMAIL_CHARSET, 'UTF7-IMAP');
+ $folder = rcube_charset::convert($prop['name'], RCUBE_CHARSET, 'UTF7-IMAP');
$oldfolder = $prop['oldname']; // UTF7
$parent = $prop['parent']; // UTF7
$delimiter = self::$imap->get_hierarchy_delimiter();
diff --git a/plugins/libkolab/lib/kolab_storage_folder.php b/plugins/libkolab/lib/kolab_storage_folder.php
index 1670a1b..363745e 100644
--- a/plugins/libkolab/lib/kolab_storage_folder.php
+++ b/plugins/libkolab/lib/kolab_storage_folder.php
@@ -818,7 +818,7 @@ class kolab_storage_folder
false, // is_file
'8bit', // encoding
'attachment', // disposition
- RCMAIL_CHARSET // charset
+ RCUBE_CHARSET // charset
);
$part_id++;
@@ -840,15 +840,15 @@ class kolab_storage_folder
}
}
- $headers = array('Content-ID' => Mail_mimePart::encodeHeader('Content-ID', '<' . $key . '>', RCMAIL_CHARSET, 'quoted-printable'));
+ $headers = array('Content-ID' => Mail_mimePart::encodeHeader('Content-ID', '<' . $key . '>', RCUBE_CHARSET, 'quoted-printable'));
$name = !empty($att['name']) ? $att['name'] : $key;
if (!empty($att['content'])) {
- $mime->addAttachment($att['content'], $att['mimetype'], $name, false, $encoding, 'attachment', '', '', '', null, null, '', RCMAIL_CHARSET, $headers);
+ $mime->addAttachment($att['content'], $att['mimetype'], $name, false, $encoding, 'attachment', '', '', '', null, null, '', RCUBE_CHARSET, $headers);
$part_id++;
}
else if (!empty($att['path'])) {
- $mime->addAttachment($att['path'], $att['mimetype'], $name, true, $encoding, 'attachment', '', '', '', null, null, '', RCMAIL_CHARSET, $headers);
+ $mime->addAttachment($att['path'], $att['mimetype'], $name, true, $encoding, 'attachment', '', '', '', null, null, '', RCUBE_CHARSET, $headers);
$part_id++;
}
commit bbfa7ad97fd1b717c5ed74adb5e9d27333901eac
Author: Aleksander Machniak <machniak at kolabsys.com>
Date: Sun Dec 9 12:22:22 2012 +0100
Save 'file' objects in binary format
diff --git a/plugins/libkolab/lib/kolab_storage_folder.php b/plugins/libkolab/lib/kolab_storage_folder.php
index c762822..1670a1b 100644
--- a/plugins/libkolab/lib/kolab_storage_folder.php
+++ b/plugins/libkolab/lib/kolab_storage_folder.php
@@ -619,13 +619,19 @@ class kolab_storage_folder
}
}
- if ($raw_msg = $this->build_message($object, $type)) {
+ // check IMAP BINARY extension support for 'file' objects
+ // allow configuration to workaround bug in Cyrus < 2.4.17
+ $rcmail = rcube::get_instance();
+ $binary = $type == 'file' && !$rcmail->config->get('kolab_binary_disable') && $this->imap->get_capability('BINARY');
+
+ // generate and save object message
+ if ($raw_msg = $this->build_message($object, $type, $binary)) {
if (is_array($raw_msg)) {
- $result = $this->imap->save_message($this->name, $raw_msg[0], $raw_msg[1], true);
+ $result = $this->imap->save_message($this->name, $raw_msg[0], $raw_msg[1], true, null, null, $binary);
@unlink($raw_msg[0]);
}
else {
- $result = $this->imap->save_message($this->name, $raw_msg);
+ $result = $this->imap->save_message($this->name, $raw_msg, null, false, null, null, $binary);
}
// delete old message
@@ -738,7 +744,7 @@ class kolab_storage_folder
* @return mixed Message as string or array with two elements
* (one for message file path, second for message headers)
*/
- private function build_message(&$object, $type)
+ private function build_message(&$object, $type, $binary)
{
// load old object to preserve data we don't understand/process
if (is_object($object['_formatobj']))
@@ -762,10 +768,11 @@ class kolab_storage_folder
return false;
}
- $mime = new Mail_mime("\r\n");
- $rcmail = rcube::get_instance();
- $headers = array();
- $part_id = 1;
+ $mime = new Mail_mime("\r\n");
+ $rcmail = rcube::get_instance();
+ $headers = array();
+ $part_id = 1;
+ $encoding = $binary ? 'binary' : 'base64';
if ($ident = $rcmail->user->get_identity()) {
$headers['From'] = $ident['email'];
@@ -788,7 +795,7 @@ class kolab_storage_folder
}
// 1.33 is for base64, we need at least 2x more memory than the message size
- if ($memory * 1.33 * 2 > $mem_limit) {
+ if ($memory * ($binary ? 1 : 1.33) * 2 > $mem_limit) {
$is_file = true;
$temp_dir = unslashify($rcmail->config->get('temp_dir'));
$mime->setParam('delay_file_io', true);
@@ -837,11 +844,11 @@ class kolab_storage_folder
$name = !empty($att['name']) ? $att['name'] : $key;
if (!empty($att['content'])) {
- $mime->addAttachment($att['content'], $att['mimetype'], $name, false, 'base64', 'attachment', '', '', '', null, null, '', RCMAIL_CHARSET, $headers);
+ $mime->addAttachment($att['content'], $att['mimetype'], $name, false, $encoding, 'attachment', '', '', '', null, null, '', RCMAIL_CHARSET, $headers);
$part_id++;
}
else if (!empty($att['path'])) {
- $mime->addAttachment($att['path'], $att['mimetype'], $name, true, 'base64', 'attachment', '', '', '', null, null, '', RCMAIL_CHARSET, $headers);
+ $mime->addAttachment($att['path'], $att['mimetype'], $name, true, $encoding, 'attachment', '', '', '', null, null, '', RCMAIL_CHARSET, $headers);
$part_id++;
}
More information about the commits
mailing list