Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added new function to allow keeping the flags original case #35

Open
wants to merge 1 commit into
base: FRAMEWORK_6_0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions lib/Horde/Imap/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,8 @@ class Horde_Imap_Client
/* @since 2.11.0 */
const FETCH_DOWNGRADED = 16;

const FETCH_FLAGS_ORIGINAL_CASE = 999;

/* Namespace constants. @deprecated */
const NS_PERSONAL = 1;
const NS_OTHER = 2;
Expand Down
16 changes: 15 additions & 1 deletion lib/Horde/Imap/Client/Data/Fetch.php
Original file line number Diff line number Diff line change
Expand Up @@ -325,9 +325,11 @@ public function getEnvelope()
*/
public function setFlags(array $flags)
{
$trimmed = array_map('trim', $flags);
$this->_data[Horde_Imap_Client::FETCH_FLAGS_ORIGINAL_CASE] = $trimmed;
$this->_data[Horde_Imap_Client::FETCH_FLAGS] = array_map(
'Horde_String::lower',
array_map('trim', $flags)
$trimmed
);
}

Expand All @@ -343,6 +345,18 @@ public function getFlags()
: array();
}

/**
* Get IMAP flags without changing their case.
*
* @return array An array of IMAP flags with their original case
*/
public function getFlagsOriginalCase()
{
return isset($this->_data[Horde_Imap_Client::FETCH_FLAGS_ORIGINAL_CASE])
? $this->_data[Horde_Imap_Client::FETCH_FLAGS_ORIGINAL_CASE]
: array();
}

/**
* Set IMAP internal date.
*
Expand Down