Skip to content
Snippets Groups Projects
Commit 054af755 authored by Peter Rotich's avatar Peter Rotich Committed by GitHub
Browse files

Merge pull request #3419 from protich/issue/passive-threading

Passive Threading Revisited
parents 8c8cd1fa 85bfc48b
Branches
Tags
No related merge requests found
...@@ -1122,11 +1122,13 @@ implements TemplateVariable { ...@@ -1122,11 +1122,13 @@ implements TemplateVariable {
function lookupByEmailHeaders(&$mailinfo, &$seen=false) { function lookupByEmailHeaders(&$mailinfo, &$seen=false) {
// Search for messages using the References header, then the // Search for messages using the References header, then the
// in-reply-to header // in-reply-to header
if ($entry = ThreadEntry::objects() if ($mailinfo['mid'] &&
->filter(array('email_info__mid' => $mailinfo['mid'])) ($entry = ThreadEntry::objects()
->order_by(false) ->filter(array('email_info__mid' => $mailinfo['mid']))
->first() ->order_by(false)
) { ->first()
)
) {
$seen = true; $seen = true;
return $entry; return $entry;
} }
...@@ -1189,15 +1191,15 @@ implements TemplateVariable { ...@@ -1189,15 +1191,15 @@ implements TemplateVariable {
return $t; return $t;
} }
} }
// Passive threading - listen mode // Passive threading - listen mode
$entry = ThreadEntry::objects() if (count($possibles)
->filter(array( && ($entry = ThreadEntry::objects()
'email_info__mid__in' => array_map( ->filter(array('email_info__mid__in' => array_map(
function ($a) { return "<$a>"; }, function ($a) { return "<$a>"; },
$possibles))) $possibles)))
->first(); ->first()
if ($entry) { )
) {
$mailinfo['passive'] = true; $mailinfo['passive'] = true;
return $entry; return $entry;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment