From: Michael M Slusarz Date: Fri, 23 Jul 2010 21:32:19 +0000 (-0600) Subject: Don't search own addresses when doing tied/recipient check X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=ebb072950dc84bff70ce606b69da5130c8a82d3a;p=horde.git Don't search own addresses when doing tied/recipient check --- diff --git a/imp/lib/Compose.php b/imp/lib/Compose.php index 5cfc69cc6..22a876adb 100644 --- a/imp/lib/Compose.php +++ b/imp/lib/Compose.php @@ -463,7 +463,7 @@ class IMP_Compose if (!$this->getMetadata('identity_check') && (count($recip['list']) === 1) && isset($opts['identity'])) { - $identity_search = $opts['identity']->getMatchingIdentity($recip['list']); + $identity_search = $opts['identity']->getMatchingIdentity($recip['list'], false); if (!is_null($identity_search) && ($opts['identity']->getDefault() != $identity_search)) { $this->_metadata['identity_check'] = true; diff --git a/imp/lib/Prefs/Identity.php b/imp/lib/Prefs/Identity.php index 81c654944..34c7777aa 100644 --- a/imp/lib/Prefs/Identity.php +++ b/imp/lib/Prefs/Identity.php @@ -332,16 +332,16 @@ class Imp_Prefs_Identity extends Horde_Prefs_Identity /** * Returns the identity's id that matches the passed addresses. * - * @param mixed $addresses Either an array or a single string or a - * comma-separated list of email addresses. - * @param boolean $search_ties Search for a matching identity in tied - * addresses too? + * @param mixed $addresses Either an array or a single string or a + * comma-separated list of email addresses. + * @param boolean $search_own Search for a matching identity in own + * addresses also? * * @return integer The id of the first identity that from or alias * addresses match (one of) the passed addresses or * null if none matches. */ - public function getMatchingIdentity($addresses, $search_ties = true) + public function getMatchingIdentity($addresses, $search_own = true) { if (!isset($this->_cached['tie_addresses'])) { $this->_cached['tie_addresses'] = $this->getAllTieAddresses(); @@ -365,6 +365,7 @@ class Imp_Prefs_Identity extends Horde_Prefs_Identity if (empty($address['mailbox'])) { continue; } + $find_address = $address['mailbox']; if (!empty($address['host'])) { $find_address .= '@' . $address['host']; @@ -373,23 +374,19 @@ class Imp_Prefs_Identity extends Horde_Prefs_Identity /* Search 'tieto' addresses first. */ /* Check for this address explicitly. */ - if ($search_ties && - isset($this->_cached['tie_addresses'][$find_address])) { + if (isset($this->_cached['tie_addresses'][$find_address])) { return $this->_cached['tie_addresses'][$find_address]; } /* If we didn't find the address, check for the domain. */ - if (!empty($address['host'])) { - $host = '@' . $address['host']; - if ($search_ties && - isset($this->_cached['tie_addresses'][$host]) && - ($host != '@')) { - return $this->_cached['tie_addresses'][$host]; - } + if (!empty($address['host']) && + isset($this->_cached['tie_addresses']['@' . $host])) { + return $this->_cached['tie_addresses']['@' . $host]; } /* Next, search all from addresses. */ - if (isset($this->_cached['own_addresses'][$find_address])) { + if ($search_own && + isset($this->_cached['own_addresses'][$find_address])) { return $this->_cached['own_addresses'][$find_address]; } }