protected function _getMatchingIdentity($h, array $only = array())
{
global $injector;
$identity = $injector->getInstance('IMP_Identity');
$msgAddresses = array();
if (empty($only)) {
/* Bug #9271: Check 'from' address first; if replying to a message
* originally sent by user, this should be the identity used for
* the reply also. */
$only = array('from', 'to', 'cc', 'bcc');
}
foreach ($only as $val) {
$msgAddresses[] = $h[$val];
}
$match = $identity->getMatchingIdentity(array_filter($msgAddresses));
return is_null($match) ? $identity->getDefault() : $match;
}