From: Michael M Slusarz Date: Tue, 20 Apr 2010 21:14:40 +0000 (-0600) Subject: Use more human-readable keyword names, for use with other MUAs X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=8ba0ff419073af09a5fabd56a3c27f467af2bf60;p=horde.git Use more human-readable keyword names, for use with other MUAs --- diff --git a/imp/lib/Imap/Flags.php b/imp/lib/Imap/Flags.php index 6edf5d18a..7053e6404 100644 --- a/imp/lib/Imap/Flags.php +++ b/imp/lib/Imap/Flags.php @@ -13,9 +13,6 @@ */ class IMP_Imap_Flags { - /* IMAP flag prefix for IMP-specific flags/keywords. */ - const PREFIX = 'impflag'; - /** * The cached list of flags. * @@ -179,20 +176,19 @@ class IMP_Imap_Flags $this->_loadList(); - /* Flags are named PREFIX{$i}. Keep incrementing until we find the - * next available flag. */ - for ($i = 0;; ++$i) { - $curr = self::PREFIX . $i; - if (!isset($this->_flags[$curr])) { - $entry = $this->_createEntry($label); + /* IMAP keywords must conform to RFC 3501 [9] (flag-keyword). Convert + * whitespace to underscore. */ + $key = $GLOBALS['imp_imap']->ob()->utils->stripNonAtomChars(Horde_String::convertCharset(strtr($label, ' ', '_'), Horde_Nls::getCharset(), 'UTF7-IMAP')); + if (!isset($this->_flags[$key])) { + $entry = $this->_createEntry($label); - $this->_flags[$curr] = $entry; - $this->_userflags[$curr] = $entry; + $this->_flags[$key] = $entry; + $this->_userflags[$key] = $entry; - $this->_save(); - return $curr; - } + $this->_save(); } + + return $key; } /**