summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Bruederli <bruederli@kolabsys.com>2013-07-10 09:59:33 (GMT)
committerThomas Bruederli <bruederli@kolabsys.com>2013-07-10 10:02:57 (GMT)
commitd00d3da92492cfade722ea040d4752871dcdc2bc (patch)
tree32c42aefdf7a400d80cf93a05cfd0348c39e81b2
parentc5a2eba629202bc6fb42db770ac828634d110101 (diff)
downloadroundcubemail-plugins-kolab-d00d3da92492cfade722ea040d4752871dcdc2bc.tar.gz
Fix iTip REPLY to only list the replying attendee (#2025)
-rw-r--r--plugins/calendar/calendar.php4
-rw-r--r--plugins/calendar/lib/calendar_itip.php25
2 files changed, 29 insertions, 0 deletions
diff --git a/plugins/calendar/calendar.php b/plugins/calendar/calendar.php
index af700d1..2379c90 100644
--- a/plugins/calendar/calendar.php
+++ b/plugins/calendar/calendar.php
@@ -674,10 +674,12 @@ class calendar extends rcube_plugin
$organizer = $attendee;
else if ($attendee['email'] && in_array(strtolower($attendee['email']), $emails)) {
$old['attendees'][$i]['status'] = 'DECLINED';
+ $reply_sender = $attendee['email'];
}
}
$itip = $this->load_itip();
+ $itip->set_sender_email($reply_sender);
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');
else
@@ -1871,6 +1873,7 @@ class calendar extends rcube_plugin
}
else if ($attendee['email'] && in_array(strtolower($attendee['email']), $emails)) {
$event['attendees'][$i]['status'] = strtoupper($status);
+ $reply_sender = $attendee['email'];
}
}
}
@@ -1955,6 +1958,7 @@ class calendar extends rcube_plugin
// send iTip reply
if ($this->ical->method == 'REQUEST' && $organizer && !in_array(strtolower($organizer['email']), $emails) && !$error_msg) {
$itip = $this->load_itip();
+ $itip->set_sender_email($reply_sender);
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');
else
diff --git a/plugins/calendar/lib/calendar_itip.php b/plugins/calendar/lib/calendar_itip.php
index 30fb812..51a1c92 100644
--- a/plugins/calendar/lib/calendar_itip.php
+++ b/plugins/calendar/lib/calendar_itip.php
@@ -40,6 +40,12 @@ class calendar_itip
$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
*
@@ -135,8 +141,27 @@ class calendar_itip
public function compose_itip_message($event, $method)
{
$from = rcube_idn_to_ascii($this->sender['email']);
+ $from_utf = rcube_idn_to_utf8($from);
$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
$message = new Mail_mime("\r\n");
$message->setParam('text_encoding', 'quoted-printable');