From 8ba0ff419073af09a5fabd56a3c27f467af2bf60 Mon Sep 17 00:00:00 2001 From: Michael M Slusarz Date: Tue, 20 Apr 2010 15:14:40 -0600 Subject: [PATCH] Use more human-readable keyword names, for use with other MUAs --- imp/lib/Imap/Flags.php | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) 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; } /** -- 2.11.0