Skip to content

Commit

Permalink
Don't include system flags in the list of user flags for EAS clients.
Browse files Browse the repository at this point in the history
Also, prevent corrupt msgFlag prefs from killing other flags on the
client.
  • Loading branch information
mrubinsk committed Feb 23, 2016
1 parent d07e880 commit ec08ea1
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion framework/Core/lib/Horde/Core/ActiveSync/Imap/Factory.php
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,24 @@ public function getMsgFlags()

$msgFlags = array();
$flags = unserialize($registry->horde->getPreference($registry->hasInterface('mail'), 'msgflags'));

// Remove any system flags, as these should never be user (un)set.
$system_flags = array(
Horde_Imap_Client::FLAG_ANSWERED,
Horde_Imap_Client::FLAG_DELETED,
Horde_Imap_Client::FLAG_DRAFT,
Horde_Imap_Client::FLAG_FLAGGED,
Horde_Imap_Client::FLAG_RECENT,
Horde_Imap_Client::FLAG_SEEN
);
foreach ($system_flags as $flag) {
unset($flags[$flag]);
}

foreach ($flags as $flag) {
$msgFlags[Horde_String::lower($flag->imapflag)] = $flag->label;
if ($flag->imapflag) {
$msgFlags[Horde_String::lower($flag->imapflag)] = $flag->label;
}
}

return $msgFlags;
Expand Down

0 comments on commit ec08ea1

Please sign in to comment.