/**
* @see showInlineImage
*/
protected function _showInlineImage(IMP_Contents $contents)
{
global $injector, $prefs;
if ($this->alwaysShow || !$prefs->getValue('image_replacement')) {
return true;
}
if (!$contents || !($tmp = $contents->getHeader()->getHeader('from')) || !($from = $tmp->getAddressList(true))) {
return false;
}
$res = $injector->getInstance('IMP_Contacts')->searchEmail($from->first()->bare_address, array('email_exact' => true));
if (count($res)) {
/* Don't allow personal addresses by default - this is the only
* e-mail address a Spam sender for sure knows you will recognize
* so it is too much of a loophole. */
$res->setIteratorFilter(0, $injector->getInstance('IMP_Identity')->getAllFromAddresses());
foreach ($from as $val) {
if ($res->contains($val)) {
return true;
}
}
}
/* Check safe address list. */
$safeAddrs = $injector->getInstance('IMP_Prefs_Special_ImageReplacement')->safeAddrList();
foreach ($from as $val) {
if ($safeAddrs->contains($val)) {
return true;
}
}
return false;
}