/**
  * Implementation of FeedsParser::parse().
  */
 public function parse(FeedsSource $source, FeedsFetcherResult $fetcher_result)
 {
     $fetched = $fetcher_result->getRaw();
     $mailbox = $fetched['mailbox'];
     $result = new FeedsParserResult();
     if (!empty($fetched['messages'])) {
         foreach ($fetched['messages'] as $mid => &$message) {
             $this->authenticate($message, $mailbox);
             if ($class = mailhandler_plugin_load_class('mailhandler', $mailbox->settings['retrieve'], 'retrieve', 'handler')) {
                 $class->purge_message($mailbox, $message);
             }
             if ($message['authenticated_uid'] == 0) {
                 // User was not authenticated
                 module_invoke_all('mailhandler_auth_failed', $message);
                 $source_config = $source->getConfigFor($this);
                 if ($source_config['auth_required']) {
                     mailhandler_report('warning', 'User could not be authenticated. Please check your Mailhandler authentication plugin settings.');
                     continue;
                 }
             }
             $this->commands($message, $source);
             $result->items[] = $message;
         }
     }
     return $result;
 }
Esempio n. 2
0
 /**
  * Implementation of FeedsFetcher::fetch().
  */
 public function fetch(FeedsSource $source)
 {
     $source_config = $source->getConfigFor($this);
     return new MailhandlerFetcherResult($source_config['mailbox'], $this->config['filter']);
 }