Fix method check after refactoring iTip message parsing

This commit is contained in:
Thomas Bruederli 2014-08-04 19:22:08 +02:00
parent 517e9720d4
commit c4dec32034
2 changed files with 10 additions and 11 deletions

View file

@ -2398,7 +2398,7 @@ class calendar extends rcube_plugin
'changed' => is_object($event['changed']) ? $event['changed']->format('U') : 0, 'changed' => is_object($event['changed']) ? $event['changed']->format('U') : 0,
'sequence' => intval($event['sequence']), 'sequence' => intval($event['sequence']),
'fallback' => strtoupper($status), 'fallback' => strtoupper($status),
'method' => $this->ical->method, 'method' => $event['_method'],
'task' => 'calendar', 'task' => 'calendar',
); );
@ -2442,7 +2442,7 @@ class calendar extends rcube_plugin
if ($existing) { if ($existing) {
// only update attendee status // only update attendee status
if ($this->ical->method == 'REPLY') { if ($$event['_method'] == 'REPLY') {
// try to identify the attendee using the email sender address // try to identify the attendee using the email sender address
$existing_attendee = -1; $existing_attendee = -1;
foreach ($existing['attendees'] as $i => $attendee) { foreach ($existing['attendees'] as $i => $attendee) {
@ -2502,7 +2502,7 @@ class calendar extends rcube_plugin
} }
// set status=CANCELLED on CANCEL messages // set status=CANCELLED on CANCEL messages
if ($this->ical->method == 'CANCEL') if ($event['_method'] == 'CANCEL')
$event['status'] = 'CANCELLED'; $event['status'] = 'CANCELLED';
// show me as free when declined (#1670) // show me as free when declined (#1670)
if ($status == 'declined' || $event['status'] == 'CANCELLED') if ($status == 'declined' || $event['status'] == 'CANCELLED')
@ -2532,7 +2532,7 @@ class calendar extends rcube_plugin
} }
if ($success) { if ($success) {
$message = $this->ical->method == 'REPLY' ? 'attendeupdateesuccess' : ($deleted ? 'successremoval' : ($existing ? 'updatedsuccessfully' : 'importedsuccessfully')); $message = $event['_method'] == 'REPLY' ? 'attendeupdateesuccess' : ($deleted ? 'successremoval' : ($existing ? 'updatedsuccessfully' : 'importedsuccessfully'));
$this->rc->output->command('display_message', $this->gettext(array('name' => $message, 'vars' => array('calendar' => $calendar['name']))), 'confirmation'); $this->rc->output->command('display_message', $this->gettext(array('name' => $message, 'vars' => array('calendar' => $calendar['name']))), 'confirmation');
$metadata['rsvp'] = intval($metadata['rsvp']); $metadata['rsvp'] = intval($metadata['rsvp']);
@ -2543,9 +2543,8 @@ class calendar extends rcube_plugin
else if ($error_msg) else if ($error_msg)
$this->rc->output->command('display_message', $error_msg, 'error'); $this->rc->output->command('display_message', $error_msg, 'error');
// send iTip reply // send iTip reply
if ($this->ical->method == 'REQUEST' && $organizer && !$noreply && !in_array(strtolower($organizer['email']), $emails) && !$error_msg) { if ($event['_method'] == 'REQUEST' && $organizer && !$noreply && !in_array(strtolower($organizer['email']), $emails) && !$error_msg) {
$event['comment'] = get_input_value('_comment', RCUBE_INPUT_POST); $event['comment'] = get_input_value('_comment', RCUBE_INPUT_POST);
$itip = $this->load_itip(); $itip = $this->load_itip();
$itip->set_sender_email($reply_sender); $itip->set_sender_email($reply_sender);

View file

@ -1555,7 +1555,7 @@ class tasklist extends rcube_plugin
'changed' => is_object($task['changed']) ? $task['changed']->format('U') : 0, 'changed' => is_object($task['changed']) ? $task['changed']->format('U') : 0,
'sequence' => intval($task['sequence']), 'sequence' => intval($task['sequence']),
'fallback' => strtoupper($status), 'fallback' => strtoupper($status),
'method' => $this->ical->method, 'method' => $task['_method'],
'task' => 'tasks', 'task' => 'tasks',
); );
@ -1599,7 +1599,7 @@ class tasklist extends rcube_plugin
if ($existing) { if ($existing) {
// only update attendee status // only update attendee status
if ($this->ical->method == 'REPLY') { if ($task['_method'] == 'REPLY') {
// try to identify the attendee using the email sender address // try to identify the attendee using the email sender address
$existing_attendee = -1; $existing_attendee = -1;
foreach ($existing['attendees'] as $i => $attendee) { foreach ($existing['attendees'] as $i => $attendee) {
@ -1660,7 +1660,7 @@ class tasklist extends rcube_plugin
} }
// set status=CANCELLED on CANCEL messages // set status=CANCELLED on CANCEL messages
if ($this->ical->method == 'CANCEL') { if ($task['_method'] == 'CANCEL') {
$task['status'] = 'CANCELLED'; $task['status'] = 'CANCELLED';
} }
// show me as free when declined (#1670) // show me as free when declined (#1670)
@ -1698,7 +1698,7 @@ class tasklist extends rcube_plugin
} }
if ($success) { if ($success) {
$message = $this->ical->method == 'REPLY' ? 'attendeupdateesuccess' : ($deleted ? 'successremoval' : ($existing ? 'updatedsuccessfully' : 'importedsuccessfully')); $message = $task['_method'] == 'REPLY' ? 'attendeupdateesuccess' : ($deleted ? 'successremoval' : ($existing ? 'updatedsuccessfully' : 'importedsuccessfully'));
$this->rc->output->command('display_message', $this->gettext(array('name' => $message, 'vars' => array('list' => $list['name']))), 'confirmation'); $this->rc->output->command('display_message', $this->gettext(array('name' => $message, 'vars' => array('list' => $list['name']))), 'confirmation');
$metadata['rsvp'] = intval($metadata['rsvp']); $metadata['rsvp'] = intval($metadata['rsvp']);
@ -1712,7 +1712,7 @@ class tasklist extends rcube_plugin
} }
// send iTip reply // send iTip reply
if ($this->ical->method == 'REQUEST' && $organizer && !$noreply && !in_array(strtolower($organizer['email']), $emails) && !$error_msg) { if ($task['_method'] == 'REQUEST' && $organizer && !$noreply && !in_array(strtolower($organizer['email']), $emails) && !$error_msg) {
$task['comment'] = rcube_utils::get_input_value('_comment', rcube_utils::INPUT_POST); $task['comment'] = rcube_utils::get_input_value('_comment', rcube_utils::INPUT_POST);
$itip = $this->load_itip(); $itip = $this->load_itip();
$itip->set_sender_email($reply_sender); $itip->set_sender_email($reply_sender);