|
|
|
|
@ -366,7 +366,7 @@ class IMipService { |
|
|
|
|
* @param bool $isModified |
|
|
|
|
*/ |
|
|
|
|
public function addSubjectAndHeading(IEMailTemplate $template, |
|
|
|
|
string $method, string $sender, string $summary, bool $isModified): void { |
|
|
|
|
string $method, string $sender, string $summary, bool $isModified, ?Property $replyingAttendee = null): void { |
|
|
|
|
if ($method === IMipPlugin::METHOD_CANCEL) { |
|
|
|
|
// TRANSLATORS Subject for email, when an invitation is cancelled. Ex: "Cancelled: {{Event Name}}" |
|
|
|
|
$template->setSubject($this->l10n->t('Cancelled: %1$s', [$summary])); |
|
|
|
|
@ -374,7 +374,24 @@ class IMipService { |
|
|
|
|
} elseif ($method === IMipPlugin::METHOD_REPLY) { |
|
|
|
|
// TRANSLATORS Subject for email, when an invitation is replied to. Ex: "Re: {{Event Name}}" |
|
|
|
|
$template->setSubject($this->l10n->t('Re: %1$s', [$summary])); |
|
|
|
|
$template->addHeading($this->l10n->t('%1$s has responded to your invitation', [$sender])); |
|
|
|
|
// Build the strings |
|
|
|
|
$partstat = (isset($replyingAttendee)) ? $replyingAttendee->offsetGet('PARTSTAT') : null; |
|
|
|
|
$partstat = ($partstat instanceof Parameter) ? $partstat->getValue() : null; |
|
|
|
|
switch ($partstat) { |
|
|
|
|
case 'ACCEPTED': |
|
|
|
|
$template->addHeading($this->l10n->t('%1$s has accepted your invitation', [$sender])); |
|
|
|
|
break; |
|
|
|
|
case 'TENTATIVE': |
|
|
|
|
$template->addHeading($this->l10n->t('%1$s has tentatively accepted your invitation', [$sender])); |
|
|
|
|
break; |
|
|
|
|
case 'DECLINED': |
|
|
|
|
$template->addHeading($this->l10n->t('%1$s has declined your invitation', [$sender])); |
|
|
|
|
break; |
|
|
|
|
case null: |
|
|
|
|
default: |
|
|
|
|
$template->addHeading($this->l10n->t('%1$s has responded to your invitation', [$sender])); |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
} elseif ($method === IMipPlugin::METHOD_REQUEST && $isModified) { |
|
|
|
|
// TRANSLATORS Subject for email, when an invitation is updated. Ex: "Invitation updated: {{Event Name}}" |
|
|
|
|
$template->setSubject($this->l10n->t('Invitation updated: %1$s', [$summary])); |
|
|
|
|
@ -603,4 +620,17 @@ class IMipService { |
|
|
|
|
|
|
|
|
|
$template->addBodyText($html, $text); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public function getReplyingAttendee(Message $iTipMessage): ?Property { |
|
|
|
|
/** @var VEvent $vevent */ |
|
|
|
|
$vevent = $iTipMessage->message->VEVENT; |
|
|
|
|
$attendees = $vevent->select('ATTENDEE'); |
|
|
|
|
foreach ($attendees as $attendee) { |
|
|
|
|
/** @var Property $attendee */ |
|
|
|
|
if (strcasecmp($attendee->getValue(), $iTipMessage->sender) === 0) { |
|
|
|
|
return $attendee; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return null; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|