From 387db8ea1a8362b97d78d206e32bde69fed135ca Mon Sep 17 00:00:00 2001 From: Thomas Bruederli Date: Wed, 6 Nov 2013 12:43:37 +0100 Subject: [PATCH] Allow users to accept iTip invitations also if not listed as attendee (can be disabled by config) --- plugins/calendar/calendar.php | 13 ++++++++++++- plugins/calendar/calendar_ui.js | 2 +- plugins/calendar/config.inc.php.dist | 4 ++++ 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/plugins/calendar/calendar.php b/plugins/calendar/calendar.php index 97ec1b13..d9db4e10 100644 --- a/plugins/calendar/calendar.php +++ b/plugins/calendar/calendar.php @@ -825,7 +825,7 @@ class calendar extends rcube_plugin $calendar_select = null; } - if ($status == 'unknown') { + if ($status == 'unknown' && !$this->rc->config->get('calendar_allow_itip_uninvited', true)) { $html = html::div('rsvp-status', $this->gettext('notanattendee')); $action = 'import'; } @@ -2084,6 +2084,17 @@ class calendar extends rcube_plugin $reply_sender = $attendee['email']; } } + + // add attendee with this user's default identity if not listed + if (!$reply_sender) { + $sender_identity = $this->rc->user->get_identity(); + $event['attendees'][] = array( + 'name' => $sender_identity['name'], + 'email' => $sender_identity['email'], + 'role' => 'OPT-PARTICIPANT', + 'status' => strtoupper($status), + ); + } } // save to calendar diff --git a/plugins/calendar/calendar_ui.js b/plugins/calendar/calendar_ui.js index 4a633eb0..20fa3301 100644 --- a/plugins/calendar/calendar_ui.js +++ b/plugins/calendar/calendar_ui.js @@ -377,7 +377,7 @@ function rcube_calendar_ui(settings) } } - $('#event-rsvp')[(rsvp&&!organizer?'show':'hide')](); + $('#event-rsvp')[(rsvp && !is_organizer(event) ? 'show' : 'hide')](); $('#event-rsvp .rsvp-buttons input').prop('disabled', false).filter('input[rel='+rsvp+']').prop('disabled', true); } diff --git a/plugins/calendar/config.inc.php.dist b/plugins/calendar/config.inc.php.dist index 449041cb..4ec3c08f 100644 --- a/plugins/calendar/config.inc.php.dist +++ b/plugins/calendar/config.inc.php.dist @@ -107,6 +107,10 @@ $rcmail_config['calendar_categories'] = array( // enable users to invite/edit attendees for shared events organized by others $rcmail_config['calendar_allow_invite_shared'] = false; +// allow users to accecpt iTip invitations who are no explicitly listed as attendee. +// this can be the case if invitations are sent to mailing lists or alias email addresses. +$rcmail_config['calendar_allow_itip_uninvited'] = true; + // enable asynchronous free-busy triggering after data changed $rcmail_config['calendar_freebusy_trigger'] = false;