Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support iMIP requests #6782

Merged
merged 2 commits into from
Jul 14, 2022
Merged

Support iMIP requests #6782

merged 2 commits into from
Jul 14, 2022

Conversation

miaulalala
Copy link
Contributor

@miaulalala miaulalala commented Jun 23, 2022

Fixes #160

To Do

Server - see nextcloud/server#33001

Backend:

  • Parse Data for frontend in IMAPMessage
  • Send the parsed data to the frontend

Frontend:

  • Display REQUEST in frontend like discussed in Render iMIP invitations #160 (comment)
  • Display REPLY messages appropriately, the design is still unclear but could be anything from a oneliner to a design that emulates the above (if the message doesn't contain any text at all, some calendars will show text)
  • Display CANCEL

Still unclear:

  • Recurrences: What to do when a processing fails and a calendar isn't updated?

Frontend

Invitation

image

Update (e.g. participant accepted)

image

Cancelled

image

@miaulalala
Copy link
Contributor Author

Example of a REPLY ics when clicking the integrated "accept" button in gmail:

BEGIN:VCALENDAR
PRODID:-//Google Inc//Google Calendar 70.9054//EN
VERSION:2.0
CALSCALE:GREGORIAN
METHOD:REPLY
BEGIN:VEVENT
DTSTART:20220623T200015Z
DTEND:20220623T210015Z
DTSTAMP:20220623T211813Z
ORGANIZER;CN=admin:mailto:[email protected]
UID:0043c2ad-a2c9-4ac8-9c36-c9f1d36a5d54
ATTENDEE;CUTYPE=INDIVIDUAL;ROLE=REQ-PARTICIPANT;PARTSTAT=ACCEPTED;[email protected];X-NUM-GUESTS=0:mailto:[email protected]
CREATED:20220623T194731Z
DESCRIPTION:
LAST-MODIFIED:20220623T211813Z
LOCATION:
SEQUENCE:2
STATUS:CONFIRMED
SUMMARY:Test
TRANSP:OPAQUE
END:VEVENT
END:VCALENDAR

Interesting to note there will only ever be one ATTENDEE in such a REPLY.

@miaulalala miaulalala changed the title Add iMIP parsing for Mail Support iMIP requests Jun 23, 2022
@ChristophWurst ChristophWurst removed this from the v1.14.0 milestone Jun 28, 2022
@miaulalala miaulalala added the feature:imip For all tasks related to the iMIP functionality label Jun 30, 2022
@miaulalala
Copy link
Contributor Author

miaulalala commented Jun 30, 2022

a reminder that events that I get a REQUEST for that are in the past should not display any accept / decline options. I can't parse VCALENDARs in the backend without introducing dependencies on Sabre so this will need to be done in the frontend.

@st3iny

This comment was marked as resolved.

@miaulalala

This comment was marked as resolved.

@st3iny st3iny marked this pull request as ready for review July 5, 2022 14:42
@st3iny
Copy link
Member

st3iny commented Jul 5, 2022

Note to reviewers: This is only about displaying iMIP messages. The buttons are not supposed to work (yet).

EDIT: The buttons are not rendered anymore.

@ChristophWurst

This comment was marked as resolved.

@st3iny

This comment was marked as resolved.

@miaulalala miaulalala requested a review from st3iny July 12, 2022 08:23
Copy link
Member

@st3iny st3iny left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested this extensively together with Anna. I contributed some code so my review might be biased but we should move on with this.

@miaulalala miaulalala force-pushed the enh/imip-invitations-responses branch from 4ae567e to f030aec Compare July 12, 2022 12:06
@miaulalala
Copy link
Contributor Author

php 8.2 failure is unrelated

@kesselb
Copy link
Contributor

kesselb commented Jul 12, 2022

Index: lib/Model/IMAPMessage.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/lib/Model/IMAPMessage.php b/lib/Model/IMAPMessage.php
--- a/lib/Model/IMAPMessage.php	(revision f030aec06ea22037d4cbe4fee43e9aa28c028a9f)
+++ b/lib/Model/IMAPMessage.php	(date 1657640660009)
@@ -406,7 +406,7 @@
 		$allContentTypeParameters = $p->getAllContentTypeParameters();
 		if ($p->getType() === 'text/calendar') {
 			// Also handle event data like a regular attachment
-			if ($p->getDisposition() === 'attachment') {
+//			if ($p->getDisposition() === 'attachment') {
 				$this->attachments[] = [
 					'id' => $p->getMimeId(),
 					'messageId' => $this->messageId,
@@ -416,7 +416,7 @@
 					'cid' => $p->getContentId(),
 					'disposition' => $p->getDisposition()
 				];
-			}
+//			}
 
 			// return if this is a true attachment
 			// the method parameter determines if this is a iMIP message

Before After
image image

If we don't check $p->getDisposition() === 'attachment' it's possible to download the attachment for outlook too.

image

Downside is that for other invitations two attachments are shown. Thunderbird seems to use the following logic (it's my guess): Show the invitation as attachment when a file name is set.

Index: lib/Model/IMAPMessage.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/lib/Model/IMAPMessage.php b/lib/Model/IMAPMessage.php
--- a/lib/Model/IMAPMessage.php	(revision f030aec06ea22037d4cbe4fee43e9aa28c028a9f)
+++ b/lib/Model/IMAPMessage.php	(date 1657641289322)
@@ -406,11 +406,12 @@
 		$allContentTypeParameters = $p->getAllContentTypeParameters();
 		if ($p->getType() === 'text/calendar') {
 			// Also handle event data like a regular attachment
-			if ($p->getDisposition() === 'attachment') {
+			$attachmentName = $p->getName();
+			if ($attachmentName !== null) {
 				$this->attachments[] = [
 					'id' => $p->getMimeId(),
 					'messageId' => $this->messageId,
-					'fileName' => $p->getName() ?? 'calendar.ics',
+					'fileName' => $attachmentName,
 					'mime' => $p->getType(),
 					'size' => $p->getBytes(),
 					'cid' => $p->getContentId(),

With this patch I can download the Outlook invitation as attachment. For a Google invitation only one attachment is shown.

Invitation from Outlook:

Content-Type: text/calendar;method=REQUEST;
	charset="US-ASCII";name="meeting.ics"
Content-transfer-encoding: 7bit

Invitation from Google:

Content-Type: text/calendar; charset="UTF-8"; method=REQUEST
Content-Transfer-Encoding: 7bit
Content-Type: application/ics; name="invite.ics"
Content-Disposition: attachment; filename="invite.ics"
Content-Transfer-Encoding: base64

The difference is that Google include a second version of the invitation (with a different content type).

I think we should allow the user to download the invitation from Outlook. I don't have a strong opinion about the second point (show one or two attachment). Roundcube for example show's two attachments for a Google invitation.

@miaulalala miaulalala force-pushed the enh/imip-invitations-responses branch from f030aec to 47def62 Compare July 13, 2022 11:54
@miaulalala
Copy link
Contributor Author

Implemented your suggestions @kesselb, I think it's a good way to provide operability for Outlook. Just wondering if there is ever a case where the filename is not set.

@kesselb
Copy link
Contributor

kesselb commented Jul 13, 2022

Just wondering if there is ever a case where the filename is not set.

Content-Type: text/calendar; charset="UTF-8"; method=REQUEST
Content-Transfer-Encoding: 7bit

Here ;) From a Google Calendar invitation. It's the part we read to show the scheduling data. The user will download the other version (base64 encoded).

@miaulalala
Copy link
Contributor Author

Just wondering if there is ever a case where the filename is not set.

Content-Type: text/calendar; charset="UTF-8"; method=REQUEST
Content-Transfer-Encoding: 7bit

Here ;) From a Google Calendar invitation. It's the part we read to show the scheduling data. The user will download the other version (base64 encoded).

That's fine the, that's handled by the second case.

miaulalala and others added 2 commits July 14, 2022 12:36
Signed-off-by: Anna Larch <[email protected]>
Signed-off-by: Richard Steinmetz <[email protected]>
@miaulalala miaulalala force-pushed the enh/imip-invitations-responses branch from 47def62 to d0c4181 Compare July 14, 2022 10:36
@miaulalala miaulalala merged commit 775df21 into main Jul 14, 2022
@miaulalala miaulalala deleted the enh/imip-invitations-responses branch July 14, 2022 16:10
@Luncheon3462
Copy link

@ChristophWurst @miaulalala @st3iny snappymail plug-in for nextcloud handles this perfectly. I’m not a coder but if the MIME is the same, and snappymail works as needed, can code be reused?

Snappymail is Rainloop fork by @the-djmaze. https://github.com/the-djmaze/snappymail

1 similar comment
@Luncheon3462
Copy link

@ChristophWurst @miaulalala @st3iny snappymail plug-in for nextcloud handles this perfectly. I’m not a coder but if the MIME is the same, and snappymail works as needed, can code be reused?

Snappymail is Rainloop fork by @the-djmaze. https://github.com/the-djmaze/snappymail

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3. to review enhancement feature:imip For all tasks related to the iMIP functionality feature:integration
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Render iMIP invitations
7 participants