diff options
author | Thomas Bruederli <bruederli@kolabsys.com> | 2014-07-08 10:36:34 (GMT) |
---|---|---|
committer | Thomas Bruederli <bruederli@kolabsys.com> | 2014-07-08 10:38:52 (GMT) |
commit | 7affe524f1d9b3f9a301394091f9e632e0de82f2 (patch) | |
tree | b5b1e608ba61d0246af0db1623d172870665c77a /plugins/libcalendaring/libcalendaring.php | |
parent | bdf2faafae42282e52694af90c3d21ceed69949c (diff) | |
download | roundcubemail-plugins-kolab-7affe524f1d9b3f9a301394091f9e632e0de82f2.tar.gz |
List virtual calendars showing pending/declined inivtations (#1796)
Diffstat (limited to 'plugins/libcalendaring/libcalendaring.php')
-rw-r--r-- | plugins/libcalendaring/libcalendaring.php | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/plugins/libcalendaring/libcalendaring.php b/plugins/libcalendaring/libcalendaring.php index 5888ff0..5a1a8b0 100644 --- a/plugins/libcalendaring/libcalendaring.php +++ b/plugins/libcalendaring/libcalendaring.php @@ -329,6 +329,13 @@ class libcalendaring extends rcube_plugin */ public function get_user_emails() { + static $emails; + + // return cached result + if (is_array($emails)) { + return $emails; + } + $emails = array(); $plugin = $this->rc->plugins->exec_hook('calendar_user_emails', array('emails' => $emails)); $emails = array_map('strtolower', $plugin['emails']); @@ -342,7 +349,28 @@ class libcalendaring extends rcube_plugin $emails[] = strtolower($identity['email']); } - return array_unique($emails); + $emails = array_unique($emails); + return $emails; + } + + /** + * Set the given participant status to the attendee matching the current user's identities + * + * @param array Hash array with event struct + * @param string The PARTSTAT value to set + * @return mixed Email address of the updated attendee or False if none matching found + */ + public function set_partstat(&$event, $status) + { + $emails = $this->get_user_emails(); + foreach ((array)$event['attendees'] as $i => $attendee) { + if ($attendee['email'] && in_array(strtolower($attendee['email']), $emails)) { + $event['attendees'][$i]['status'] = strtoupper($status); + return $attendee['email']; + } + } + + return false; } |