-
Notifications
You must be signed in to change notification settings - Fork 165
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
Add event organizer #260
Merged
Merged
Add event organizer #260
Changes from 1 commit
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the eluceo/iCal package. | ||
* | ||
* (c) 2021 Markus Poerschke <markus@poerschke.nrw> | ||
* | ||
* This source file is subject to the MIT license that is bundled | ||
* with this source code in the file LICENSE. | ||
*/ | ||
|
||
namespace Eluceo\iCal\Domain\ValueObject; | ||
|
||
use InvalidArgumentException; | ||
|
||
final class EmailAddress | ||
{ | ||
private string $emailAddress; | ||
|
||
public function __construct(string $emailAddress) | ||
{ | ||
if (!filter_var($emailAddress, FILTER_VALIDATE_EMAIL)) { | ||
throw new InvalidArgumentException("$emailAddress is no valid e-mail address"); | ||
} | ||
|
||
$this->emailAddress = $emailAddress; | ||
} | ||
|
||
public function getEmailAddress(): string | ||
{ | ||
return $this->emailAddress; | ||
} | ||
|
||
public function toUri(): Uri | ||
{ | ||
return new Uri('mailto:' . urlencode($this->emailAddress)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the eluceo/iCal package. | ||
* | ||
* (c) 2021 Markus Poerschke <markus@poerschke.nrw> | ||
* | ||
* This source file is subject to the MIT license that is bundled | ||
* with this source code in the file LICENSE. | ||
*/ | ||
|
||
namespace Eluceo\iCal\Domain\ValueObject; | ||
|
||
final class Organizer | ||
{ | ||
private EmailAddress $emailAddress; | ||
private ?string $displayName; | ||
|
||
/** | ||
* The e-mail address of another user that is acting on behalf of the "Organizer". | ||
*/ | ||
private ?EmailAddress $sentBy; | ||
|
||
/** | ||
* To specify reference to a directory entry associated wit the calendar user specified by the property. | ||
* | ||
* @see https://tools.ietf.org/html/rfc5545#section-3.2.6 | ||
*/ | ||
private ?Uri $directoryEntry; | ||
|
||
public function __construct( | ||
EmailAddress $emailAddress, | ||
?string $displayName = null, | ||
?Uri $directoryEntry = null, | ||
?EmailAddress $sentBy = null | ||
) { | ||
$this->emailAddress = $emailAddress; | ||
$this->displayName = $displayName; | ||
$this->directoryEntry = $directoryEntry; | ||
$this->sentBy = $sentBy; | ||
} | ||
|
||
public function getEmailAddress(): EmailAddress | ||
{ | ||
return $this->emailAddress; | ||
} | ||
|
||
public function hasDisplayName(): bool | ||
{ | ||
return $this->displayName !== null; | ||
} | ||
|
||
public function getDisplayName(): string | ||
{ | ||
assert($this->displayName !== null); | ||
|
||
return $this->displayName; | ||
} | ||
|
||
public function isSentInBehalfOf(): bool | ||
{ | ||
return $this->sentBy !== null; | ||
} | ||
|
||
public function getSentBy(): EmailAddress | ||
{ | ||
assert($this->sentBy !== null); | ||
|
||
return $this->sentBy; | ||
} | ||
|
||
public function hasDirectoryEntry(): bool | ||
{ | ||
return $this->directoryEntry !== null; | ||
} | ||
|
||
public function getDirectoryEntry(): Uri | ||
{ | ||
assert($this->directoryEntry !== null); | ||
|
||
return $this->directoryEntry; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Outlook 2016 is having trouble with the encoded "@" character in the email address.
According to RFC standard, the
mailto:
doesn't require the url-encoding of that character. From the RFC 5545 3.8.4.3 (Organizer) section, see its examples, but it says "Value Type: CAL-ADDRESS" -> look for that in the RFC, find definition here -> says "the value must be a mailto URI, as defined by [RFC2368].", see its examples.By RFC 2368's examples, it seems that it implies the "@" should remain unencoded. The solution then would mean parsing the email address, such as is seen in this related StackOverflow discussion on the topic: https://stackoverflow.com/questions/8940445/what-is-the-correct-way-to-escape-a-string-for-a-mailto-link
In our case, we're going to just look for
%40
in theORGANIZER
property and convert it back to@
, which will suffice.