Fix iTip REPLY to only list the replying attendee (#2025)
This commit is contained in:
parent
92aee8213a
commit
f3f4ae828d
2 changed files with 29 additions and 0 deletions
|
@ -747,10 +747,12 @@ class calendar extends rcube_plugin
|
||||||
$organizer = $attendee;
|
$organizer = $attendee;
|
||||||
else if ($attendee['email'] && in_array(strtolower($attendee['email']), $emails)) {
|
else if ($attendee['email'] && in_array(strtolower($attendee['email']), $emails)) {
|
||||||
$old['attendees'][$i]['status'] = 'DECLINED';
|
$old['attendees'][$i]['status'] = 'DECLINED';
|
||||||
|
$reply_sender = $attendee['email'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$itip = $this->load_itip();
|
$itip = $this->load_itip();
|
||||||
|
$itip->set_sender_email($reply_sender);
|
||||||
if ($organizer && $itip->send_itip_message($old, 'REPLY', $organizer, 'itipsubjectdeclined', 'itipmailbodydeclined'))
|
if ($organizer && $itip->send_itip_message($old, 'REPLY', $organizer, 'itipsubjectdeclined', 'itipmailbodydeclined'))
|
||||||
$this->rc->output->command('display_message', $this->gettext(array('name' => 'sentresponseto', 'vars' => array('mailto' => $organizer['name'] ? $organizer['name'] : $organizer['email']))), 'confirmation');
|
$this->rc->output->command('display_message', $this->gettext(array('name' => 'sentresponseto', 'vars' => array('mailto' => $organizer['name'] ? $organizer['name'] : $organizer['email']))), 'confirmation');
|
||||||
else
|
else
|
||||||
|
@ -1953,6 +1955,7 @@ class calendar extends rcube_plugin
|
||||||
}
|
}
|
||||||
else if ($attendee['email'] && in_array(strtolower($attendee['email']), $emails)) {
|
else if ($attendee['email'] && in_array(strtolower($attendee['email']), $emails)) {
|
||||||
$event['attendees'][$i]['status'] = strtoupper($status);
|
$event['attendees'][$i]['status'] = strtoupper($status);
|
||||||
|
$reply_sender = $attendee['email'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2037,6 +2040,7 @@ class calendar extends rcube_plugin
|
||||||
// send iTip reply
|
// send iTip reply
|
||||||
if ($this->ical->method == 'REQUEST' && $organizer && !in_array(strtolower($organizer['email']), $emails) && !$error_msg) {
|
if ($this->ical->method == 'REQUEST' && $organizer && !in_array(strtolower($organizer['email']), $emails) && !$error_msg) {
|
||||||
$itip = $this->load_itip();
|
$itip = $this->load_itip();
|
||||||
|
$itip->set_sender_email($reply_sender);
|
||||||
if ($itip->send_itip_message($event, 'REPLY', $organizer, 'itipsubject' . $status, 'itipmailbody' . $status))
|
if ($itip->send_itip_message($event, 'REPLY', $organizer, 'itipsubject' . $status, 'itipmailbody' . $status))
|
||||||
$this->rc->output->command('display_message', $this->gettext(array('name' => 'sentresponseto', 'vars' => array('mailto' => $organizer['name'] ? $organizer['name'] : $organizer['email']))), 'confirmation');
|
$this->rc->output->command('display_message', $this->gettext(array('name' => 'sentresponseto', 'vars' => array('mailto' => $organizer['name'] ? $organizer['name'] : $organizer['email']))), 'confirmation');
|
||||||
else
|
else
|
||||||
|
|
|
@ -40,6 +40,12 @@ class calendar_itip
|
||||||
$this->cal->add_hook('smtp_connect', array($this, 'smtp_connect_hook'));
|
$this->cal->add_hook('smtp_connect', array($this, 'smtp_connect_hook'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function set_sender_email($email)
|
||||||
|
{
|
||||||
|
if (!empty($email))
|
||||||
|
$this->sender['email'] = $email;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Send an iTip mail message
|
* Send an iTip mail message
|
||||||
*
|
*
|
||||||
|
@ -135,8 +141,27 @@ class calendar_itip
|
||||||
public function compose_itip_message($event, $method)
|
public function compose_itip_message($event, $method)
|
||||||
{
|
{
|
||||||
$from = rcube_idn_to_ascii($this->sender['email']);
|
$from = rcube_idn_to_ascii($this->sender['email']);
|
||||||
|
$from_utf = rcube_idn_to_utf8($from);
|
||||||
$sender = format_email_recipient($from, $this->sender['name']);
|
$sender = format_email_recipient($from, $this->sender['name']);
|
||||||
|
|
||||||
|
// truncate list attendees down to the recipient of the iTip Reply.
|
||||||
|
// constraints for a METHOD:REPLY according to RFC 5546
|
||||||
|
if ($method == 'REPLY') {
|
||||||
|
$replying_attendee = null; $reply_attendees = array();
|
||||||
|
foreach ($event['attendees'] as $attendee) {
|
||||||
|
if ($attendee['role'] == 'ORGANIZER') {
|
||||||
|
$reply_attendees[] = $attendee;
|
||||||
|
}
|
||||||
|
else if (strcasecmp($attedee['email'], $from) == 0 || strcasecmp($attendee['email'], $from_utf) == 0) {
|
||||||
|
$replying_attendee = $attendee;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($replying_attendee) {
|
||||||
|
$reply_attendees[] = $replying_attendee;
|
||||||
|
$event['attendees'] = $reply_attendees;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// compose multipart message using PEAR:Mail_Mime
|
// compose multipart message using PEAR:Mail_Mime
|
||||||
$message = new Mail_mime("\r\n");
|
$message = new Mail_mime("\r\n");
|
||||||
$message->setParam('text_encoding', 'quoted-printable');
|
$message->setParam('text_encoding', 'quoted-printable');
|
||||||
|
|
Loading…
Add table
Reference in a new issue