/** * Whether or not to fetch message, based on headers. * * @param $header * Message headers * @return * TRUE if comment, FALSE otherwise */ function fetch($header) { // For a comment it must be a reply. if (!isset($header->in_reply_to)) { return FALSE; } $node = oa_mailhandler_get_node_from_subject($header->subject); return !empty($node); }
/** * Whether or not to fetch message, based on headers. * * @param $header * Message headers * @return * TRUE if comment, FALSE otherwise */ function fetch($header) { // For a comment it must be a reply. if (!isset($header->in_reply_to)) { return FALSE; } // Filter out-of-office autoresponders. if (strpos($header->subject, t('Automatic reply:')) !== FALSE || strpos($header->subject, t('Undeliverable:')) !== FALSE) { return FALSE; } $node = oa_mailhandler_get_node_from_subject($header->subject); return !empty($node); }
/** * Implementation of FeedsParser::parse(). */ public function parse(FeedsSource $source, FeedsFetcherResult $fetcher_result) { $result = parent::parse($source, $fetcher_result); foreach ($result->items as &$item) { // Parse the subject for a contextual nid $context = oa_mailhandler_get_node_from_subject($item['subject']); if ($context) { $item['contextual_nid'] = $context->nid; $space = current(field_get_items('node', $context, 'og_group_ref')); if ($space) { $item['contextual_space_id'] = $space['target_id']; } $section = current(field_get_items('node', $context, 'oa_section_ref')); if ($section) { $item['contextual_section_id'] = $section['target_id']; } } elseif ($this->config['require_contextual_nid']) { $item = array(); } } return $result; }