Projects
Kolab:3.4
kolab-syncroton
kolab-syncroton-2.2.4-fix-from-and-recode-colla...
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File kolab-syncroton-2.2.4-fix-from-and-recode-collated.patch of Package kolab-syncroton (Revision 50)
Currently displaying revision
50
,
Show latest
diff -ur kolab-syncroton-2.2.4.orig/lib/kolab_sync_message.php kolab-syncroton-2.2.4/lib/kolab_sync_message.php --- kolab-syncroton-2.2.4.orig/lib/kolab_sync_message.php 2014-01-24 12:23:35.000000000 +0100 +++ kolab-syncroton-2.2.4/lib/kolab_sync_message.php 2014-02-06 17:58:49.433769832 +0100 @@ -169,6 +169,22 @@ if (empty($headers['From'])) { $headers['From'] = $this->get_identity(); } + // make sure there's sender name in From: + else if ($rcube->config->get('activesync_fix_from') + && preg_match('/^<?((\S+|("[^"]+"))@\S+)>?$/', trim($headers['From']), $m) + ) { + $identities = kolab_sync::get_instance()->user->list_identities(); + $email = $m[1]; + + foreach ((array) $identities as $ident) { + if ($ident['email'] == $email) { + if ($ident['name']) { + $headers['From'] = format_email_recipient($email, $ident['name']); + } + break; + } + } + } if (empty($headers['Message-ID'])) { $headers['Message-ID'] = $rcube->gen_message_id(); @@ -297,15 +313,15 @@ $hdrs = self::parse_headers($headers); // multipart message - if (preg_match('/boundary="?([a-z0-9-_]+)"?/i', $hdrs['Content-Type'], $matches)) { + if (preg_match('/boundary="?([a-z0-9-\'\(\)+_\,\.\/:=\? ]+)"?/i', $hdrs['Content-Type'], $matches)) { $boundary = '--' . $matches[1]; $message = explode($boundary, $message); for ($x=1, $parts = count($message) - 1; $x<$parts; $x++) { - $message[$x] = "\r\n" . self::recode_message($message[$x]); + $message[$x] = "\r\n" . self::recode_message(ltrim($message[$x])); } - return $headers . "\r\n\r\n" . implode($boundary, $message); + return $headers . "\r\n\r\n" . implode($boundary , $message); } // single part Only in kolab-syncroton-2.2.4/lib: kolab_sync_message.php.orig diff -ur kolab-syncroton-2.2.4.orig/tests/message.php kolab-syncroton-2.2.4/tests/message.php --- kolab-syncroton-2.2.4.orig/tests/message.php 2014-01-24 12:23:35.000000000 +0100 +++ kolab-syncroton-2.2.4/tests/message.php 2014-02-06 17:58:49.433769832 +0100 @@ -135,4 +135,17 @@ $this->assertEquals($result, $message); } + + /** + * Test recoding the message + */ + function test_recode_message_4() + { + $source = file_get_contents(TESTS_DIR . '/src/mail.recode4'); + $result = file_get_contents(TESTS_DIR . '/src/mail.recode4.out'); + + $message = kolab_sync_message::recode_message($source); + + $this->assertEquals($result, $message); + } } diff -ur kolab-syncroton-2.2.4.orig/tests/src/mail.recode2.out kolab-syncroton-2.2.4/tests/src/mail.recode2.out --- kolab-syncroton-2.2.4.orig/tests/src/mail.recode2.out 2014-01-24 12:23:35.000000000 +0100 +++ kolab-syncroton-2.2.4/tests/src/mail.recode2.out 2014-02-06 17:58:49.433769832 +0100 @@ -9,7 +9,6 @@ This is a multi-part message in MIME format. --------------000801030509090203070207 - Content-Type: multipart/alternative; boundary="------------060305070900000101080707" @@ -31,7 +30,6 @@ --------------060305070900000101080707-- --------------000801030509090203070207 - Content-Type: application/pdf; name="Weihnachtsbrief13.pdf" Content-Transfer-Encoding: base64 Only in kolab-syncroton-2.2.4/tests/src: mail.recode4 Only in kolab-syncroton-2.2.4/tests/src: mail.recode4.out
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.