Esempio n. 1
0
 public function process($raw_mail)
 {
     $raw_mail_parsed = $this->parser->parse($raw_mail);
     try {
         $incoming_message = $this->incoming_message_factory->build($raw_mail_parsed);
         $body = $this->citation_stripper->stripText($incoming_message->getBody());
         $tracker_artifactbyemail = new Tracker_ArtifactByEmailStatus($incoming_message->getTracker(), $this->tracker_plugin_config);
         if ($tracker_artifactbyemail->canCreateArtifact() || $tracker_artifactbyemail->canUpdateArtifact()) {
             $this->createChangeset($incoming_message, $body, $raw_mail);
         } else {
             $this->logger->info('An artifact for the tracker #' . $incoming_message->getTracker()->getId() . ' has been received but this tracker does not allow create/reply by mail or' . ' his configuration is not compatible with this feature');
             $this->notifier->sendErrorMailTrackerGeneric($raw_mail_parsed);
         }
     } catch (Tracker_Artifact_MailGateway_MultipleUsersExistException $e) {
         $this->logger->debug('Multiple users match with ' . $raw_mail_parsed['headers']['from']);
         $this->notifier->sendErrorMailMultipleUsers($raw_mail_parsed);
     } catch (Tracker_Artifact_MailGateway_RecipientUserDoesNotExistException $e) {
         $this->logger->debug('No user match with ' . $raw_mail_parsed['headers']['from']);
         $this->notifier->sendErrorMailNoUserMatch($raw_mail_parsed);
     } catch (Tracker_Exception $e) {
         $this->logger->error($e->getMessage());
         $this->notifier->sendErrorMailTrackerGeneric($raw_mail_parsed);
     }
 }
 private function getCustomReplyToHeader()
 {
     $config = $this->getTrackerPluginConfig();
     $artifactbymail = new Tracker_ArtifactByEmailStatus($config);
     if ($config->isTokenBasedEmailgatewayEnabled()) {
         return array("name" => "Reply-to", "value" => $this->getArtifact()->getTokenBasedEmailAddress());
     } else {
         if ($artifactbymail->canUpdateArtifactInInsecureMode($this->getArtifact()->getTracker())) {
             return array("name" => "Reply-to", "value" => $this->getArtifact()->getInsecureEmailAddress());
         }
     }
 }
 public function are_required_fields_configured_for_insecure_emailgateway()
 {
     return $this->artifactbyemail_status->isRequiredFieldsConfigured($this->tracker);
 }
Esempio n. 4
0
 /**
  * @return Tracker_ArtifactByEmailStatus
  */
 private function canUpdateArtifactByMail()
 {
     $config = new TrackerPluginConfig(new TrackerPluginConfigDao());
     $status = new Tracker_ArtifactByEmailStatus($config);
     return $status->canUpdateArtifactInInsecureMode($this->artifact->getTracker());
 }
 public function itChecksSemantic()
 {
     stub($this->tracker_plugin_conf)->isInsecureEmailgatewayEnabled()->returns(true);
     stub($this->tracker)->isEmailgatewayEnabled()->returns(true);
     $tracker_artifactbyemailstatus = new Tracker_ArtifactByEmailStatus($this->tracker_plugin_conf);
     $this->assertFalse($tracker_artifactbyemailstatus->isSemanticConfigured($this->tracker));
     $field_title = mock('Tracker_FormElement_Field_String');
     stub($this->tracker)->getTitleField()->returns($field_title);
     $this->assertFalse($tracker_artifactbyemailstatus->isSemanticConfigured($this->tracker));
     $field_description = mock('Tracker_FormElement_Field_Text');
     stub($this->tracker)->getDescriptionField()->returns($field_description);
     $this->assertTrue($tracker_artifactbyemailstatus->isSemanticConfigured($this->tracker));
 }