Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[mms] Add support for the IMAP UTF-8 extension (RFC 6855).
- Loading branch information
Showing
16 changed files
with
1,087 additions
and
441 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
framework/Imap_Client/lib/Horde/Imap/Client/Data/Format/ListMailbox/Utf8.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<?php | ||
/** | ||
* Copyright 2014 Horde LLC (http://www.horde.org/) | ||
* | ||
* See the enclosed file COPYING for license information (LGPL). If you | ||
* did not receive this file, see http://www.horde.org/licenses/lgpl21. | ||
* | ||
* @category Horde | ||
* @copyright 2014 Horde LLC | ||
* @license http://www.horde.org/licenses/lgpl21 LGPL 2.1 | ||
* @package Imap_Client | ||
*/ | ||
|
||
/** | ||
* Object representation of an IMAP mailbox string used in a LIST command | ||
* when UTF8=ACCEPT is supported/enabled on the server (RFC 6855 [3]). | ||
* | ||
* @author Michael Slusarz <slusarz@horde.org> | ||
* @category Horde | ||
* @copyright 2014 Horde LLC | ||
* @license http://www.horde.org/licenses/lgpl21 LGPL 2.1 | ||
* @package Imap_Client | ||
*/ | ||
class Horde_Imap_Client_Data_Format_ListMailbox_Utf8 | ||
extends Horde_Imap_Client_Data_Format_Mailbox_Utf8 | ||
{ | ||
/** | ||
*/ | ||
protected function _filterParams() | ||
{ | ||
$ob = parent::_filterParams(); | ||
|
||
/* Don't quote % or * characters. */ | ||
$ob->no_quote_list = true; | ||
|
||
return $ob; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
framework/Imap_Client/lib/Horde/Imap/Client/Data/Format/Mailbox/Utf8.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
<?php | ||
/** | ||
* Copyright 2014 Horde LLC (http://www.horde.org/) | ||
* | ||
* See the enclosed file COPYING for license information (LGPL). If you | ||
* did not receive this file, see http://www.horde.org/licenses/lgpl21. | ||
* | ||
* @category Horde | ||
* @copyright 2014 Horde LLC | ||
* @license http://www.horde.org/licenses/lgpl21 LGPL 2.1 | ||
* @package Imap_Client | ||
*/ | ||
|
||
/** | ||
* Object representation of an IMAP mailbox string allowed when UTF8=ACCEPT | ||
* is supported/enabled on the server (RFC 6855 [3]). | ||
* | ||
* @author Michael Slusarz <slusarz@horde.org> | ||
* @category Horde | ||
* @copyright 2014 Horde LLC | ||
* @license http://www.horde.org/licenses/lgpl21 LGPL 2.1 | ||
* @package Imap_Client | ||
*/ | ||
class Horde_Imap_Client_Data_Format_Mailbox_Utf8 | ||
extends Horde_Imap_Client_Data_Format_Mailbox | ||
{ | ||
/** | ||
*/ | ||
protected $_encoding = 'utf8'; | ||
|
||
/** | ||
*/ | ||
public function __construct($data) | ||
{ | ||
parent::__construct($data); | ||
|
||
/* RFC 3501 allows any US-ASCII character, except null (\0), in | ||
* mailbox data. | ||
* RFC 6855 [3] institutes additional limitations on valid mailbox | ||
* characters, to comply with RFC 5198 [2] (Net-Unicode Definition): | ||
* "MUST NOT contain control characters (U+0000-U+001F and | ||
* U+0080-U+009F), a delete character (U+007F), a line separator | ||
* (U+2028), or a paragraph separator (U+2029)." */ | ||
if ($this->quoted() && | ||
preg_match('/[\x00-\x1f\x7f\x80-\x9f\x{2028}\x{2029}]/u', strval($this))) { | ||
throw new Horde_Imap_Client_Data_Format_Exception( | ||
'Invalid character found in mailbox data.' | ||
); | ||
} | ||
|
||
if ($this->literal()) { | ||
$this->forceQuoted(); | ||
} | ||
} | ||
|
||
} |
66 changes: 66 additions & 0 deletions
66
framework/Imap_Client/lib/Horde/Imap/Client/Data/SearchCharset/Utf8.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
<?php | ||
/** | ||
* Copyright 2014 Horde LLC (http://www.horde.org/) | ||
* | ||
* See the enclosed file COPYING for license information (LGPL). If you | ||
* did not receive this file, see http://www.horde.org/licenses/lgpl21. | ||
* | ||
* @category Horde | ||
* @copyright 2014 Horde LLC | ||
* @license http://www.horde.org/licenses/lgpl21 LGPL 2.1 | ||
* @package Imap_Client | ||
*/ | ||
|
||
/** | ||
* Query the search charsets available on a server that supports the UTF-8 | ||
* IMAP extension (RFC 6855). | ||
* | ||
* @author Michael Slusarz <slusarz@horde.org> | ||
* @category Horde | ||
* @copyright 2014 Horde LLC | ||
* @license http://www.horde.org/licenses/lgpl21 LGPL 2.1 | ||
* @package Imap_Client | ||
* @since 2.24.0 | ||
*/ | ||
class Horde_Imap_Client_Data_SearchCharset_Utf8 | ||
extends Horde_Imap_Client_Data_SearchCharset | ||
{ | ||
/** | ||
* Charset data. | ||
* | ||
* @var array | ||
*/ | ||
protected $_charsets = array( | ||
'US-ASCII' => true, | ||
'UTF-8' => true | ||
); | ||
|
||
/** | ||
*/ | ||
public function query($charset, $cached = false) | ||
{ | ||
return isset($this->_charsets[strtoupper($charset)]); | ||
} | ||
|
||
/** | ||
*/ | ||
public function setValid($charset, $valid = true) | ||
{ | ||
} | ||
|
||
/* Serializable methods. */ | ||
|
||
/** | ||
*/ | ||
public function serialize() | ||
{ | ||
return ''; | ||
} | ||
|
||
/** | ||
*/ | ||
public function unserialize($data) | ||
{ | ||
} | ||
|
||
} |
Oops, something went wrong.