@@ -366,15 +366,32 @@ public function getAttendeeRsvpOrReqForParticipant(?Property $attendee = null) {
366366 * @param bool $isModified
367367 */
368368 public function addSubjectAndHeading (IEMailTemplate $ template ,
369- string $ method , string $ sender , string $ summary , bool $ isModified ): void {
369+ string $ method , string $ sender , string $ summary , bool $ isModified, ? Property $ replyingAttendee = null ): void {
370370 if ($ method === IMipPlugin::METHOD_CANCEL ) {
371371 // TRANSLATORS Subject for email, when an invitation is cancelled. Ex: "Cancelled: {{Event Name}}"
372372 $ template ->setSubject ($ this ->l10n ->t ('Cancelled: %1$s ' , [$ summary ]));
373373 $ template ->addHeading ($ this ->l10n ->t ('"%1$s" has been canceled ' , [$ summary ]));
374374 } elseif ($ method === IMipPlugin::METHOD_REPLY ) {
375375 // TRANSLATORS Subject for email, when an invitation is replied to. Ex: "Re: {{Event Name}}"
376376 $ template ->setSubject ($ this ->l10n ->t ('Re: %1$s ' , [$ summary ]));
377- $ template ->addHeading ($ this ->l10n ->t ('%1$s has responded to your invitation ' , [$ sender ]));
377+ // Build the strings
378+ $ partstat = (isset ($ replyingAttendee )) ? $ replyingAttendee ->offsetGet ('PARTSTAT ' ) : null ;
379+ $ partstat = ($ partstat instanceof Parameter) ? $ partstat ->getValue () : null ;
380+ switch ($ partstat ) {
381+ case 'ACCEPTED ' :
382+ $ template ->addHeading ($ this ->l10n ->t ('%1$s has accepted your invitation ' , [$ sender ]));
383+ break ;
384+ case 'TENTATIVE ' :
385+ $ template ->addHeading ($ this ->l10n ->t ('%1$s has tentatively accepted your invitation ' , [$ sender ]));
386+ break ;
387+ case 'DECLINED ' :
388+ $ template ->addHeading ($ this ->l10n ->t ('%1$s has declined your invitation ' , [$ sender ]));
389+ break ;
390+ case null :
391+ default :
392+ $ template ->addHeading ($ this ->l10n ->t ('%1$s has responded to your invitation ' , [$ sender ]));
393+ break ;
394+ }
378395 } elseif ($ method === IMipPlugin::METHOD_REQUEST && $ isModified ) {
379396 // TRANSLATORS Subject for email, when an invitation is updated. Ex: "Invitation updated: {{Event Name}}"
380397 $ template ->setSubject ($ this ->l10n ->t ('Invitation updated: %1$s ' , [$ summary ]));
@@ -603,4 +620,17 @@ public function addMoreOptionsButton(IEMailTemplate $template, $token) {
603620
604621 $ template ->addBodyText ($ html , $ text );
605622 }
623+
624+ public function getReplyingAttendee (Message $ iTipMessage ): ?Property {
625+ /** @var VEvent $vevent */
626+ $ vevent = $ iTipMessage ->message ->VEVENT ;
627+ $ attendees = $ vevent ->select ('ATTENDEE ' );
628+ foreach ($ attendees as $ attendee ) {
629+ /** @var Property $attendee */
630+ if (strcasecmp ($ attendee ->getValue (), $ iTipMessage ->sender ) === 0 ) {
631+ return $ attendee ;
632+ }
633+ }
634+ return null ;
635+ }
606636}
0 commit comments