protected function get_references_for_comment($comment)
{
$references = array();
if (!empty($comment->comment_parent)) {
// Add parent's references
$parent = get_comment($comment->comment_parent);
$references = array_merge($references, $this->get_references_for_comment($parent));
// Add reference to the parent itself
$references[] = $this->get_message_id_for_comment($parent);
} else {
// Parent is a post
$parent = get_post($comment->comment_post_ID);
$references[] = $this->get_message_id_for_post($parent);
}
return $references;
}