ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
Sabre\CalDAV\Schedule\IMipPlugin Class Reference

iMIP handler. More...

+ Inheritance diagram for Sabre\CalDAV\Schedule\IMipPlugin:
+ Collaboration diagram for Sabre\CalDAV\Schedule\IMipPlugin:

Public Member Functions

 __construct ($senderEmail)
 Creates the email handler. More...
 
 initialize (DAV\Server $server)
 
 getPluginName ()
 Returns a plugin name. More...
 
 schedule (ITip\Message $iTipMessage)
 Event handler for the 'schedule' event. More...
 
 getPluginInfo ()
 Returns a bunch of meta-data about the plugin. More...
 
- Public Member Functions inherited from Sabre\DAV\ServerPlugin
 initialize (Server $server)
 This initializes the plugin. More...
 
 getFeatures ()
 This method should return a list of server-features. More...
 
 getHTTPMethods ($path)
 Use this method to tell the server this plugin defines additional HTTP methods. More...
 
 getPluginName ()
 Returns a plugin name. More...
 
 getSupportedReportSet ($uri)
 Returns a list of reports this plugin supports. More...
 
 getPluginInfo ()
 Returns a bunch of meta-data about the plugin. More...
 

Protected Member Functions

 mail ($to, $subject, $body, array $headers)
 This function is responsible for sending the actual email. More...
 

Protected Attributes

 $senderEmail
 
 $itipMessage
 

Detailed Description

iMIP handler.

This class is responsible for sending out iMIP messages. iMIP is the email-based transport for iTIP. iTIP deals with scheduling operations for iCalendar objects.

If you want to customize the email that gets sent out, you can do so by extending this class and overriding the sendMessage method.

Author
Evert Pot (http://evertpot.com/) http://sabre.io/license/ Modified BSD License

Definition at line 22 of file IMipPlugin.php.

Constructor & Destructor Documentation

◆ __construct()

Sabre\CalDAV\Schedule\IMipPlugin::__construct (   $senderEmail)

Creates the email handler.

Parameters
string$senderEmail,.The 'senderEmail' is the email that shows up in the 'From:' address. This should generally be some kind of no-reply email address you own.

Definition at line 46 of file IMipPlugin.php.

References Sabre\CalDAV\Schedule\IMipPlugin\$senderEmail.

46  {
47 
48  $this->senderEmail = $senderEmail;
49 
50  }

Member Function Documentation

◆ getPluginInfo()

Sabre\CalDAV\Schedule\IMipPlugin::getPluginInfo ( )

Returns a bunch of meta-data about the plugin.

Providing this information is optional, and is mainly displayed by the Browser plugin.

The description key in the returned array may contain html and will not be sanitized.

Returns
array

Definition at line 180 of file IMipPlugin.php.

References Sabre\CalDAV\Schedule\IMipPlugin\getPluginName().

180  {
181 
182  return [
183  'name' => $this->getPluginName(),
184  'description' => 'Email delivery (rfc6047) for CalDAV scheduling',
185  'link' => 'http://sabre.io/dav/scheduling/',
186  ];
187 
188  }
getPluginName()
Returns a plugin name.
Definition: IMipPlugin.php:77
+ Here is the call graph for this function:

◆ getPluginName()

Sabre\CalDAV\Schedule\IMipPlugin::getPluginName ( )

Returns a plugin name.

Using this name other plugins will be able to access other plugins using ::getPlugin

Returns
string

Definition at line 77 of file IMipPlugin.php.

Referenced by Sabre\CalDAV\Schedule\IMipPlugin\getPluginInfo().

77  {
78 
79  return 'imip';
80 
81  }
+ Here is the caller graph for this function:

◆ initialize()

Sabre\CalDAV\Schedule\IMipPlugin::initialize ( DAV\Server  $server)

Definition at line 63 of file IMipPlugin.php.

63  {
64 
65  $server->on('schedule', [$this, 'schedule'], 120);
66 
67  }
$server
Definition: sabredav.php:48

◆ mail()

Sabre\CalDAV\Schedule\IMipPlugin::mail (   $to,
  $subject,
  $body,
array  $headers 
)
protected

This function is responsible for sending the actual email.

Parameters
string$toRecipient email address
string$subjectSubject of the email
string$bodyiCalendar body
array$headersList of headers
Returns
void

Definition at line 161 of file IMipPlugin.php.

Referenced by Sabre\CalDAV\Schedule\IMipPlugin\schedule().

161  {
162 
163  mail($to, $subject, $body, implode("\r\n", $headers));
164 
165  }
mail($to, $subject, $body, array $headers)
This function is responsible for sending the actual email.
Definition: IMipPlugin.php:161
+ Here is the caller graph for this function:

◆ schedule()

Sabre\CalDAV\Schedule\IMipPlugin::schedule ( ITip\Message  $iTipMessage)

Event handler for the 'schedule' event.

Parameters
ITip\Message$iTipMessage
Returns
void

Definition at line 89 of file IMipPlugin.php.

References Sabre\DAV\Server\$exposeVersion, Sabre\CalDAV\Schedule\IMipPlugin\$senderEmail, $summary, Sabre\CalDAV\Schedule\IMipPlugin\mail(), and Sabre\DAV\Version\VERSION.

89  {
90 
91  // Not sending any emails if the system considers the update
92  // insignificant.
93  if (!$iTipMessage->significantChange) {
94  if (!$iTipMessage->scheduleStatus) {
95  $iTipMessage->scheduleStatus = '1.0;We got the message, but it\'s not significant enough to warrant an email';
96  }
97  return;
98  }
99 
100  $summary = $iTipMessage->message->VEVENT->SUMMARY;
101 
102  if (parse_url($iTipMessage->sender, PHP_URL_SCHEME) !== 'mailto')
103  return;
104 
105  if (parse_url($iTipMessage->recipient, PHP_URL_SCHEME) !== 'mailto')
106  return;
107 
108  $sender = substr($iTipMessage->sender, 7);
109  $recipient = substr($iTipMessage->recipient, 7);
110 
111  if ($iTipMessage->senderName) {
112  $sender = $iTipMessage->senderName . ' <' . $sender . '>';
113  }
114  if ($iTipMessage->recipientName) {
115  $recipient = $iTipMessage->recipientName . ' <' . $recipient . '>';
116  }
117 
118  $subject = 'SabreDAV iTIP message';
119  switch (strtoupper($iTipMessage->method)) {
120  case 'REPLY' :
121  $subject = 'Re: ' . $summary;
122  break;
123  case 'REQUEST' :
124  $subject = $summary;
125  break;
126  case 'CANCEL' :
127  $subject = 'Cancelled: ' . $summary;
128  break;
129  }
130 
131  $headers = [
132  'Reply-To: ' . $sender,
133  'From: ' . $this->senderEmail,
134  'Content-Type: text/calendar; charset=UTF-8; method=' . $iTipMessage->method,
135  ];
136  if (DAV\Server::$exposeVersion) {
137  $headers[] = 'X-Sabre-Version: ' . DAV\Version::VERSION;
138  }
139  $this->mail(
140  $recipient,
141  $subject,
142  $iTipMessage->message->serialize(),
143  $headers
144  );
145  $iTipMessage->scheduleStatus = '1.1; Scheduling message is sent via iMip';
146 
147  }
$summary
Definition: cron.php:24
const VERSION
Full version number.
Definition: Version.php:17
mail($to, $subject, $body, array $headers)
This function is responsible for sending the actual email.
Definition: IMipPlugin.php:161
static $exposeVersion
Definition: Server.php:184
+ Here is the call graph for this function:

Field Documentation

◆ $itipMessage

Sabre\CalDAV\Schedule\IMipPlugin::$itipMessage
protected

Definition at line 36 of file IMipPlugin.php.

◆ $senderEmail

Sabre\CalDAV\Schedule\IMipPlugin::$senderEmail
protected

The documentation for this class was generated from the following file: