[packaging] Branch 'ucs/3.1/kolab-2.3' - 9 commits - debian/changelog debian/patches

Christoph Wickert wickert at kolabsys.com
Wed Jul 3 18:05:55 CEST 2013


 debian/changelog                                                               |   13 
 debian/patches/0001-Do-case-insensitive-checks-whether-the-current-user-.patch |  143 ++++++++++
 debian/patches/0002-Small-fixes-after-static-code-analysis-1851.patch          |   57 +++
 debian/patches/0003-Only-temporarily-split-alarms-string-into-array-1905.patch |   28 +
 debian/patches/0004-Fix-recurring-events-when-last-instance-is-turned-in.patch |   50 +++
 debian/patches/0005-Replace-recursive-calls-with-while-loop-when-waiting.patch |   76 +++++
 debian/patches/0006-No-need-to-set_env-in-ajax-request-limits-size-of-aj.patch |   42 ++
 debian/patches/0008-Make-sure-only-the-first-path-segment-is-removed.patch     |   25 +
 debian/patches/0009-Send-iTip-messages-als-multipart-alternative-to-make.patch |   25 +
 debian/patches/series                                                          |    8 
 10 files changed, 467 insertions(+)

New commits:
commit ac806764976ca33f3b39f0da9567bfc83e08043d
Author: Christoph Wickert <wickert at kolabsys.com>
Date:   Wed Jul 3 17:34:10 2013 +0200

    3.0~horde-20130418git60ff6713-3: Update changelog

diff --git a/debian/changelog b/debian/changelog
index e4b8692..b6bfce6 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,16 @@
+roundcube-plugins-kolab (3.0~horde-20130418git60ff6713-3) unstable; urgency=low
+
+  * Do case-insensitive checks whether the current user is an event attendee or organizer (#1838)
+  * Small fixes after static code analysis (#1851)
+  * Only temporarily split alarms string into array (#1905)
+  * Fix recurring events when last instance is turned into an exception (#1897)
+  * Replace recursive calls with while loop when waiting for sync-lock (#1637)
+  * No need to set_env in ajax request (limits size of ajax response)
+  * Make sure only the first path segment is removed
+  * Send iTip messages als multipart/alternative to make Outlook recognize them correctly (#1103)
+
+ -- Christoph Wickert <wickert at kolabsys.com>  Wed, 03 Jul 2013 17:32:38 +0200
+
 roundcube-plugins-kolab (3.0~horde-20130418git60ff6713-2) unstable; urgency=low
 
   * Remove duplicated 'changed' data entry with invalid value (and type)


commit d1eefb1cdbf94b8ea819f601a81e47076d7b4d8e
Author: Christoph Wickert <wickert at kolabsys.com>
Date:   Wed Jul 3 17:32:18 2013 +0200

    Send iTip messages als multipart/alternative to make Outlook recognize them correctly (#1103)

diff --git a/debian/patches/0009-Send-iTip-messages-als-multipart-alternative-to-make.patch b/debian/patches/0009-Send-iTip-messages-als-multipart-alternative-to-make.patch
new file mode 100644
index 0000000..8280402
--- /dev/null
+++ b/debian/patches/0009-Send-iTip-messages-als-multipart-alternative-to-make.patch
@@ -0,0 +1,25 @@
+From fc73732cc6c994fa20c6c3c6c501fcac0bcf6535 Mon Sep 17 00:00:00 2001
+From: Thomas Bruederli <thomas at roundcube.net>
+Date: Thu, 27 Jun 2013 23:40:11 +0200
+Subject: [PATCH 9/9] Send iTip messages als multipart/alternative to make
+ Outlook recognize them correctly (#1103)
+
+---
+ plugins/calendar/lib/calendar_itip.php |    1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/plugins/calendar/lib/calendar_itip.php b/plugins/calendar/lib/calendar_itip.php
+index d0ee59c..e70a9bf 100644
+--- a/plugins/calendar/lib/calendar_itip.php
++++ b/plugins/calendar/lib/calendar_itip.php
+@@ -143,6 +143,7 @@ class calendar_itip
+     $message->setParam('head_encoding', 'quoted-printable');
+     $message->setParam('head_charset', RCMAIL_CHARSET);
+     $message->setParam('text_charset', RCMAIL_CHARSET . ";\r\n format=flowed");
++    $message->setContentType('multipart/alternative');
+     
+     // compose common headers array
+     $headers = array(
+-- 
+1.7.10.4
+
diff --git a/debian/patches/series b/debian/patches/series
index cdbf41e..0bceb3f 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -11,3 +11,4 @@
 0005-Replace-recursive-calls-with-while-loop-when-waiting.patch
 0006-No-need-to-set_env-in-ajax-request-limits-size-of-aj.patch
 0008-Make-sure-only-the-first-path-segment-is-removed.patch
+0009-Send-iTip-messages-als-multipart-alternative-to-make.patch


commit 49dde0110391f1dfb52b6d444ed9d1ee4f7790e4
Author: Christoph Wickert <wickert at kolabsys.com>
Date:   Wed Jul 3 17:31:43 2013 +0200

    Make sure only the first path segment is removed

diff --git a/debian/patches/0008-Make-sure-only-the-first-path-segment-is-removed.patch b/debian/patches/0008-Make-sure-only-the-first-path-segment-is-removed.patch
new file mode 100644
index 0000000..6d99b60
--- /dev/null
+++ b/debian/patches/0008-Make-sure-only-the-first-path-segment-is-removed.patch
@@ -0,0 +1,25 @@
+From dc5e3cb968288c8c0e708231a406e8772317ad13 Mon Sep 17 00:00:00 2001
+From: Thomas Bruederli <bruederli at kolabsys.com>
+Date: Thu, 27 Jun 2013 22:42:44 +0200
+Subject: [PATCH 8/9] Make sure only the first path segment is removed
+
+---
+ plugins/libkolab/lib/kolab_storage_folder.php |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/plugins/libkolab/lib/kolab_storage_folder.php b/plugins/libkolab/lib/kolab_storage_folder.php
+index 9facc8d..93e081e 100644
+--- a/plugins/libkolab/lib/kolab_storage_folder.php
++++ b/plugins/libkolab/lib/kolab_storage_folder.php
+@@ -204,7 +204,7 @@ class kolab_storage_folder
+         if (is_array($nsdata[0]) && strlen($nsdata[0][0]) && strpos($this->name, $nsdata[0][0]) === 0) {
+             $subpath = substr($this->name, strlen($nsdata[0][0]));
+             if ($ns == 'other') {
+-                list($user, $suffix) = explode($nsdata[0][1], $subpath);
++                list($user, $suffix) = explode($nsdata[0][1], $subpath, 2);
+                 $subpath = $suffix;
+             }
+         }
+-- 
+1.7.10.4
+
diff --git a/debian/patches/series b/debian/patches/series
index 7ae9e9a..cdbf41e 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -10,3 +10,4 @@
 0004-Fix-recurring-events-when-last-instance-is-turned-in.patch
 0005-Replace-recursive-calls-with-while-loop-when-waiting.patch
 0006-No-need-to-set_env-in-ajax-request-limits-size-of-aj.patch
+0008-Make-sure-only-the-first-path-segment-is-removed.patch


commit b6c42e522d924208ec75b0da6db31fda078cec2b
Author: Christoph Wickert <wickert at kolabsys.com>
Date:   Wed Jul 3 17:30:07 2013 +0200

    No need to set_env in ajax request (limits size of ajax response)

diff --git a/debian/patches/0006-No-need-to-set_env-in-ajax-request-limits-size-of-aj.patch b/debian/patches/0006-No-need-to-set_env-in-ajax-request-limits-size-of-aj.patch
new file mode 100644
index 0000000..234581b
--- /dev/null
+++ b/debian/patches/0006-No-need-to-set_env-in-ajax-request-limits-size-of-aj.patch
@@ -0,0 +1,42 @@
+From 07e1b2596044e230dedefe8dae4983ddac11ba74 Mon Sep 17 00:00:00 2001
+From: Aleksander Machniak <machniak at kolabsys.com>
+Date: Sat, 11 May 2013 09:09:13 +0200
+Subject: [PATCH 6/9] No need to set_env in ajax request (limits size of ajax
+ response)
+
+---
+ plugins/libcalendaring/libcalendaring.php |   17 ++++++++++-------
+ 1 file changed, 10 insertions(+), 7 deletions(-)
+
+diff --git a/plugins/libcalendaring/libcalendaring.php b/plugins/libcalendaring/libcalendaring.php
+index 423a271..d842dc5 100644
+--- a/plugins/libcalendaring/libcalendaring.php
++++ b/plugins/libcalendaring/libcalendaring.php
+@@ -84,14 +84,17 @@ class libcalendaring extends rcube_plugin
+         $this->add_texts('localization/', false);
+ 
+         // include client scripts and styles
+-        $this->include_script('libcalendaring.js');
+-        $this->rc->output->set_env('libcal_settings', $this->load_settings());
+-
+-        $this->include_stylesheet($this->local_skin_path() . '/libcal.css');
++        if ($this->rc->output) {
++            if ($this->rc->output->type == 'html') {
++                $this->rc->output->set_env('libcal_settings', $this->load_settings());
++                $this->include_script('libcalendaring.js');
++                $this->include_stylesheet($this->local_skin_path() . '/libcal.css');
++            }
+ 
+-        // add hook to display alarms
+-        $this->add_hook('refresh', array($this, 'refresh'));
+-        $this->register_action('plugin.alarms', array($this, 'alarms_action'));
++            // add hook to display alarms
++            $this->add_hook('refresh', array($this, 'refresh'));
++            $this->register_action('plugin.alarms', array($this, 'alarms_action'));
++        }
+     }
+ 
+ 
+-- 
+1.7.10.4
+
diff --git a/debian/patches/series b/debian/patches/series
index 0bb27e8..7ae9e9a 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -9,3 +9,4 @@
 0003-Only-temporarily-split-alarms-string-into-array-1905.patch
 0004-Fix-recurring-events-when-last-instance-is-turned-in.patch
 0005-Replace-recursive-calls-with-while-loop-when-waiting.patch
+0006-No-need-to-set_env-in-ajax-request-limits-size-of-aj.patch


commit 6d64c5a47ff5d307a63a02831b8083949f95370f
Author: Christoph Wickert <wickert at kolabsys.com>
Date:   Wed Jul 3 17:28:32 2013 +0200

    Replace recursive calls with while loop when waiting for sync-lock (#1637)

diff --git a/debian/patches/0005-Replace-recursive-calls-with-while-loop-when-waiting.patch b/debian/patches/0005-Replace-recursive-calls-with-while-loop-when-waiting.patch
new file mode 100644
index 0000000..b07bfbc
--- /dev/null
+++ b/debian/patches/0005-Replace-recursive-calls-with-while-loop-when-waiting.patch
@@ -0,0 +1,76 @@
+From e82aea4ee04542f7a0c136c98f6c087d77185b32 Mon Sep 17 00:00:00 2001
+From: Thomas Bruederli <thomas at roundcube.net>
+Date: Mon, 27 May 2013 17:27:53 +0200
+Subject: [PATCH 5/9] Replace recursive calls with while loop when waiting for
+ sync-lock (#1637)
+
+---
+ plugins/libkolab/lib/kolab_storage_cache.php |   24 +++++++++++-------------
+ 1 file changed, 11 insertions(+), 13 deletions(-)
+
+diff --git a/plugins/libkolab/lib/kolab_storage_cache.php b/plugins/libkolab/lib/kolab_storage_cache.php
+index f5dbe01..4d62b4b 100644
+--- a/plugins/libkolab/lib/kolab_storage_cache.php
++++ b/plugins/libkolab/lib/kolab_storage_cache.php
+@@ -36,6 +36,7 @@ class kolab_storage_cache
+     private $synclock = false;
+     private $ready = false;
+     private $max_sql_packet = 1046576;  // 1 MB - 2000 bytes
++    private $max_sync_lock_time = 600;
+     private $binary_cols = array('photo','pgppublickey','pkcs7publickey');
+ 
+ 
+@@ -92,7 +93,7 @@ class kolab_storage_cache
+             return;
+ 
+         // increase time limit
+-        @set_time_limit(500);
++        @set_time_limit($this->max_sync_lock_time);
+ 
+         // lock synchronization for this folder or wait if locked
+         $this->_sync_lock();
+@@ -646,12 +647,9 @@ class kolab_storage_cache
+         if (!$this->ready)
+             return;
+ 
+-        $sql_arr = $this->db->fetch_assoc($this->db->query(
+-            "SELECT msguid AS locked, ".$this->db->unixtimestamp('created')." AS created FROM kolab_cache ".
+-            "WHERE resource=? AND type=?",
+-            $this->resource_uri,
+-            'lock'
+-        ));
++        $sql_query = "SELECT msguid AS locked, ".$this->db->unixtimestamp('created')." AS created FROM kolab_cache ".
++            "WHERE resource=? AND type=?";
++        $sql_arr = $this->db->fetch_assoc($this->db->query($sql_query, $this->resource_uri, 'lock'));
+ 
+         // abort if database is not set-up
+         if ($this->db->is_error()) {
+@@ -661,6 +659,12 @@ class kolab_storage_cache
+ 
+         $this->synclock = true;
+ 
++        // wait if locked (expire locks after 10 minutes)
++        while ($sql_arr && intval($sql_arr['locked']) > 0 && $sql_arr['created'] + $this->max_sync_lock_time > time()) {
++            usleep(500000);
++            $sql_arr = $this->db->fetch_assoc($this->db->query($sql_query, $this->resource_uri, 'lock'));
++        }
++
+         // create lock record if not exists
+         if (!$sql_arr) {
+             $this->db->query(
+@@ -671,12 +675,6 @@ class kolab_storage_cache
+                 date('Y-m-d H:i:s')
+             );
+         }
+-        // wait if locked (expire locks after 10 minutes)
+-        else if (intval($sql_arr['locked']) > 0 && (time() - $sql_arr['created']) < 600) {
+-            usleep(500000);
+-            return $this->_sync_lock();
+-        }
+-        // set lock
+         else {
+             $this->db->query(
+                 "UPDATE kolab_cache SET msguid=1, created=? ".
+-- 
+1.7.10.4
+
diff --git a/debian/patches/series b/debian/patches/series
index 546c2d1..0bb27e8 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -8,3 +8,4 @@
 0002-Small-fixes-after-static-code-analysis-1851.patch
 0003-Only-temporarily-split-alarms-string-into-array-1905.patch
 0004-Fix-recurring-events-when-last-instance-is-turned-in.patch
+0005-Replace-recursive-calls-with-while-loop-when-waiting.patch


commit 95d9c4a3359eae1367bf3b0030b567329de88607
Author: Christoph Wickert <wickert at kolabsys.com>
Date:   Wed Jul 3 17:25:37 2013 +0200

    Fix recurring events when last instance is turned into an exception (#1897)

diff --git a/debian/patches/0004-Fix-recurring-events-when-last-instance-is-turned-in.patch b/debian/patches/0004-Fix-recurring-events-when-last-instance-is-turned-in.patch
new file mode 100644
index 0000000..d027afa
--- /dev/null
+++ b/debian/patches/0004-Fix-recurring-events-when-last-instance-is-turned-in.patch
@@ -0,0 +1,50 @@
+From 6cc081b164968e725c6b14f0f7b20f44a2498802 Mon Sep 17 00:00:00 2001
+From: Thomas Bruederli <thomas at roundcube.net>
+Date: Tue, 4 Jun 2013 15:56:05 +0200
+Subject: [PATCH 4/9] Fix recurring events when last instance is turned into
+ an exception (#1897)
+
+---
+ plugins/calendar/drivers/kolab/kolab_driver.php |   23 +++++++++++++++++++----
+ 1 file changed, 19 insertions(+), 4 deletions(-)
+
+diff --git a/plugins/calendar/drivers/kolab/kolab_driver.php b/plugins/calendar/drivers/kolab/kolab_driver.php
+index 139a181..d81383c 100644
+--- a/plugins/calendar/drivers/kolab/kolab_driver.php
++++ b/plugins/calendar/drivers/kolab/kolab_driver.php
+@@ -591,13 +591,28 @@ class kolab_driver extends calendar_driver
+           $recurring = reset($storage->_get_recurring_events($event, $event['start'], $limit, $event['id'].'-1'));
+           $master['start'] = $recurring['start'];
+           $master['end'] = $recurring['end'];
+-          if ($master['recurrence']['COUNT'])
+-            $master['recurrence']['COUNT']--;
++          
++          // adjust recurrence count
++          if ($master['recurrence']['COUNT']) {
++            if (empty($master['recurrence']['EXDATE'])) {
++              $master['recurrence']['COUNT']--;
++            }
++            else {  // compute remaining repetitions considering exdates
++              $limit->add(new DateInterval('P10Y'));
++              $repeats = $storage->_get_recurring_events($event, $event['start'], $limit);
++              $master['recurrence']['COUNT'] = count($repeats);
++            }
++          }
++          
++          // changed last recurring instance: delete master
++          if (empty($master['start']) || (isset($master['recurrence']['COUNT']) && $master['recurrence']['COUNT'] <= 0)) {
++              $storage->delete_event($master, true);
++          }
+         }
+         else {  // add exception to master event
+           $master['recurrence']['EXDATE'][] = $old['start'];
+-		}
+-
++        }
++        
+         $storage->update_event($master);
+         
+         // insert new event for this occurence
+-- 
+1.7.10.4
+
diff --git a/debian/patches/series b/debian/patches/series
index d1547f4..546c2d1 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -7,3 +7,4 @@
 0001-Do-case-insensitive-checks-whether-the-current-user-.patch
 0002-Small-fixes-after-static-code-analysis-1851.patch
 0003-Only-temporarily-split-alarms-string-into-array-1905.patch
+0004-Fix-recurring-events-when-last-instance-is-turned-in.patch


commit 9ab618b54d42e7ea4a631377812e221e57d390d7
Author: Christoph Wickert <wickert at kolabsys.com>
Date:   Wed Jul 3 17:24:34 2013 +0200

    Only temporarily split alarms string into array (#1905)

diff --git a/debian/patches/0003-Only-temporarily-split-alarms-string-into-array-1905.patch b/debian/patches/0003-Only-temporarily-split-alarms-string-into-array-1905.patch
new file mode 100644
index 0000000..4c3084b
--- /dev/null
+++ b/debian/patches/0003-Only-temporarily-split-alarms-string-into-array-1905.patch
@@ -0,0 +1,28 @@
+From fb639f335cc072675b63d0e1e0e9de17ba306760 Mon Sep 17 00:00:00 2001
+From: Thomas Bruederli <bruederli at kolabsys.com>
+Date: Fri, 31 May 2013 18:07:16 +0200
+Subject: [PATCH 3/9] Only temporarily split alarms string into array (#1905)
+
+---
+ plugins/tasklist/tasklist.js |    5 +----
+ 1 file changed, 1 insertion(+), 4 deletions(-)
+
+diff --git a/plugins/tasklist/tasklist.js b/plugins/tasklist/tasklist.js
+index c3fe9db..b50471d 100644
+--- a/plugins/tasklist/tasklist.js
++++ b/plugins/tasklist/tasklist.js
+@@ -982,10 +982,7 @@ function rcube_tasklist_ui(settings)
+ 
+         // set alarm(s)
+         if (rec.alarms || action != 'new') {
+-            if (typeof rec.alarms == 'string')
+-                rec.alarms = rec.alarms.split(';');
+-
+-          var valarms = rec.alarms || [''];
++          var valarms = (typeof rec.alarms == 'string' ? rec.alarms.split(';') : rec.alarms) || [''];
+           for (var alarm, i=0; i < valarms.length; i++) {
+               alarm = String(valarms[i]).split(':');
+               if (!alarm[1] && alarm[0]) alarm[1] = 'DISPLAY';
+-- 
+1.7.10.4
+
diff --git a/debian/patches/series b/debian/patches/series
index 68f5da6..d1547f4 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -6,3 +6,4 @@
 0006-Read-and-validate-last-modification-date-properties-.patch
 0001-Do-case-insensitive-checks-whether-the-current-user-.patch
 0002-Small-fixes-after-static-code-analysis-1851.patch
+0003-Only-temporarily-split-alarms-string-into-array-1905.patch


commit c68590cb24729d0ab38652c1eca94740a67ec2ea
Author: Christoph Wickert <wickert at kolabsys.com>
Date:   Wed Jul 3 17:23:36 2013 +0200

    Small fixes after static code analysis (#1851)

diff --git a/debian/patches/0002-Small-fixes-after-static-code-analysis-1851.patch b/debian/patches/0002-Small-fixes-after-static-code-analysis-1851.patch
new file mode 100644
index 0000000..d71e812
--- /dev/null
+++ b/debian/patches/0002-Small-fixes-after-static-code-analysis-1851.patch
@@ -0,0 +1,57 @@
+From 574e17ad32b635484a1c570b2a0881598ec509f7 Mon Sep 17 00:00:00 2001
+From: Thomas Bruederli <bruederli at kolabsys.com>
+Date: Wed, 8 May 2013 08:55:58 +0200
+Subject: [PATCH 2/9] Small fixes after static code analysis (#1851)
+
+---
+ plugins/calendar/drivers/database/database_driver.php |    4 ++--
+ plugins/calendar/drivers/kolab/kolab_calendar.php     |    4 ++--
+ 2 files changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/plugins/calendar/drivers/database/database_driver.php b/plugins/calendar/drivers/database/database_driver.php
+index ca3a576..b0cb0a4 100644
+--- a/plugins/calendar/drivers/database/database_driver.php
++++ b/plugins/calendar/drivers/database/database_driver.php
+@@ -555,7 +555,7 @@ class database_driver extends calendar_driver
+           break;
+         
+         // stop adding events for inifinite recurrence after 20 years
+-        if (++$count > 999 || (!$recurrence->recurEnd && !$recurrence->recurCount && $next->year > date('Y') + 20))
++        if (++$count > 999 || (!$recurrence->recurEnd && !$recurrence->recurCount && $next_start->format('Y') > date('Y') + 20))
+           break;
+       }
+     }
+@@ -631,7 +631,7 @@ class database_driver extends calendar_driver
+             $update_master = true;
+             
+             // delete this and all future instances
+-            $fromdate = clone $old['start'];
++            $fromdate = clone $event['start'];
+             $fromdate->setTimezone($this->server_timezone);
+             $query = $this->rc->db->query(
+               "DELETE FROM " . $this->db_events . "
+diff --git a/plugins/calendar/drivers/kolab/kolab_calendar.php b/plugins/calendar/drivers/kolab/kolab_calendar.php
+index 499e2a9..dd17186 100644
+--- a/plugins/calendar/drivers/kolab/kolab_calendar.php
++++ b/plugins/calendar/drivers/kolab/kolab_calendar.php
+@@ -377,7 +377,7 @@ class kolab_calendar
+         rcube::raise_error(array(
+           'code' => 600, 'type' => 'php',
+           'file' => __FILE__, 'line' => __LINE__,
+-          'message' => "Error undeleting the event object $uid from the Kolab server"),
++          'message' => "Error undeleting the event object $event[id] from the Kolab server"),
+         true, false);
+     }
+ 
+@@ -554,7 +554,7 @@ class kolab_calendar
+       if (is_array($prop)) {
+           foreach ($prop as $key => $val) {
+               if (is_numeric($key)) {
+-                  $out .= self::_complex2string($val, $fields);
++                  $out .= self::_complex2string($val);
+               }
+               else if (!in_array($key, $ignorekeys)) {
+                 $out .= $val . ' ';
+-- 
+1.7.10.4
+
diff --git a/debian/patches/series b/debian/patches/series
index 5ca38fa..68f5da6 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -5,3 +5,4 @@
 0005-Remove-debugging-code.patch
 0006-Read-and-validate-last-modification-date-properties-.patch
 0001-Do-case-insensitive-checks-whether-the-current-user-.patch
+0002-Small-fixes-after-static-code-analysis-1851.patch


commit 36001f6ab6e3b0c2d3fddb5b5a2fb254711bf492
Author: Christoph Wickert <wickert at kolabsys.com>
Date:   Wed Jul 3 17:22:24 2013 +0200

    Do case-insensitive checks whether the current user is an event attendee or organizer (#1838)

diff --git a/debian/patches/0001-Do-case-insensitive-checks-whether-the-current-user-.patch b/debian/patches/0001-Do-case-insensitive-checks-whether-the-current-user-.patch
new file mode 100644
index 0000000..721a414
--- /dev/null
+++ b/debian/patches/0001-Do-case-insensitive-checks-whether-the-current-user-.patch
@@ -0,0 +1,143 @@
+From 59aff827c42e2247f350e71ff7c4d51141f0aec9 Mon Sep 17 00:00:00 2001
+From: Thomas Bruederli <bruederli at kolabsys.com>
+Date: Fri, 3 May 2013 10:41:26 +0200
+Subject: [PATCH 1/9] Do case-insensitive checks whether the current user is
+ an event attendee or organizer (#1838)
+
+---
+ plugins/calendar/calendar.php   |   20 ++++++++++----------
+ plugins/calendar/calendar_ui.js |   10 +++++-----
+ 2 files changed, 15 insertions(+), 15 deletions(-)
+
+diff --git a/plugins/calendar/calendar.php b/plugins/calendar/calendar.php
+index d1f2617..fcfe909 100644
+--- a/plugins/calendar/calendar.php
++++ b/plugins/calendar/calendar.php
+@@ -671,7 +671,7 @@ class calendar extends rcube_plugin
+           foreach ($old['attendees'] as $i => $attendee) {
+             if ($attendee['role'] == 'ORGANIZER')
+               $organizer = $attendee;
+-            else if ($attendee['email'] && in_array($attendee['email'], $emails)) {
++            else if ($attendee['email'] && in_array(strtolower($attendee['email']), $emails)) {
+               $old['attendees'][$i]['status'] = 'DECLINED';
+             }
+           }
+@@ -708,7 +708,7 @@ class calendar extends rcube_plugin
+         if ($existing = $this->driver->get_event($event, true, false, true)) {
+           $emails = $this->get_user_emails();
+           foreach ($existing['attendees'] as $i => $attendee) {
+-            if ($attendee['email'] && in_array($attendee['email'], $emails)) {
++            if ($attendee['email'] && in_array(strtolower($attendee['email']), $emails)) {
+               $status = $attendee['status'];
+               break;
+             }
+@@ -1059,7 +1059,7 @@ class calendar extends rcube_plugin
+         $identity['emails'][] = $rec['email'];
+       }
+       $identity['emails'][] = $this->rc->user->get_username();
+-      $settings['identity'] = array('name' => $identity['name'], 'email' => $identity['email'], 'emails' => ';' . join(';', $identity['emails']));
++      $settings['identity'] = array('name' => $identity['name'], 'email' => strtolower($identity['email']), 'emails' => ';' . strtolower(join(';', $identity['emails'])));
+     }
+ 
+     return $settings;
+@@ -1283,7 +1283,7 @@ class calendar extends rcube_plugin
+       foreach ($event['attendees'] as $i => $attendee) {
+         if ($attendee['role'] == 'ORGANIZER')
+           $organizer = true;
+-        if ($attendee['email'] == in_array($attendee['email'], $emails))
++        if ($attendee['email'] == in_array(strtolower($attendee['email']), $emails))
+           $owner = $i;
+         else if (!isset($attendee['rsvp']))
+           $event['attendees'][$i]['rsvp'] = true;
+@@ -1339,7 +1339,7 @@ class calendar extends rcube_plugin
+     $sent = 0;
+     foreach ((array)$event['attendees'] as $attendee) {
+       // skip myself for obvious reasons
+-      if (!$attendee['email'] || in_array($attendee['email'], $emails))
++      if (!$attendee['email'] || in_array(strtolower($attendee['email']), $emails))
+         continue;
+       
+       // which template to use for mail text
+@@ -1728,7 +1728,7 @@ class calendar extends rcube_plugin
+           // check my status
+           $status = 'unknown';
+           foreach ($event['attendees'] as $i => $attendee) {
+-            if ($attendee['email'] && in_array($attendee['email'], $emails)) {
++            if ($attendee['email'] && in_array(strtolower($attendee['email']), $emails)) {
+               $status = strtoupper($attendee['status']);
+               break;
+             }
+@@ -1837,7 +1837,7 @@ class calendar extends rcube_plugin
+           if ($attendee['role'] == 'ORGANIZER') {
+             $organizer = $attendee;
+           }
+-          else if ($attendee['email'] && in_array($attendee['email'], $emails)) {
++          else if ($attendee['email'] && in_array(strtolower($attendee['email']), $emails)) {
+             $event['attendees'][$i]['status'] = strtoupper($status);
+           }
+         }
+@@ -1923,7 +1923,7 @@ class calendar extends rcube_plugin
+ 
+ 
+     // send iTip reply
+-    if ($this->ical->method == 'REQUEST' && $organizer && !in_array($organizer['email'], $emails) && !$error_msg) {
++    if ($this->ical->method == 'REQUEST' && $organizer && !in_array(strtolower($organizer['email']), $emails) && !$error_msg) {
+       $itip = $this->load_itip();
+       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');
+@@ -2018,9 +2018,9 @@ class calendar extends rcube_plugin
+    */
+   private function get_user_emails()
+   {
+-    $emails = array($this->rc->user->get_username());
++    $emails = array(strtolower($this->rc->user->get_username()));
+     foreach ($this->rc->user->list_identities() as $identity)
+-      $emails[] = $identity['email'];
++      $emails[] = strtolower($identity['email']);
+     
+     return array_unique($emails);
+   }
+diff --git a/plugins/calendar/calendar_ui.js b/plugins/calendar/calendar_ui.js
+index caf6142..ec1bd4f 100644
+--- a/plugins/calendar/calendar_ui.js
++++ b/plugins/calendar/calendar_ui.js
+@@ -166,15 +166,15 @@ function rcube_calendar_ui(settings)
+     // check if the event has 'real' attendees, excluding the current user
+     var has_attendees = function(event)
+     {
+-      return (event.attendees && event.attendees.length && (event.attendees.length > 1 || event.attendees[0].email != settings.identity.email));
++      return (event.attendees && event.attendees.length && (event.attendees.length > 1 || String(event.attendees[0].email).toLowerCase() != settings.identity.email));
+     };
+     
+     // check if the current user is an attendee of this event
+     var is_attendee = function(event, role, email)
+     {
+-      var emails = email ? ';'+email : settings.identity.emails;
++      var emails = email ? ';'+email.toLowerCase() : settings.identity.emails;
+       for (var i=0; event.attendees && i < event.attendees.length; i++) {
+-        if ((!role || event.attendees[i].role == role) && event.attendees[i].email && emails.indexOf(';'+event.attendees[i].email) >= 0)
++        if ((!role || event.attendees[i].role == role) && event.attendees[i].email && emails.indexOf(';'+event.attendees[i].email.toLowerCase()) >= 0)
+           return true;
+       }
+       return false;
+@@ -617,7 +617,7 @@ function rcube_calendar_ui(settings)
+         });
+         
+         // don't submit attendees if only myself is added as organizer
+-        if (data.attendees.length == 1 && data.attendees[0].role == 'ORGANIZER' && data.attendees[0].email == settings.identity.email)
++        if (data.attendees.length == 1 && data.attendees[0].role == 'ORGANIZER' && String(data.attendees[0].email).toLowerCase() == settings.identity.email)
+           data.attendees = [];
+         
+         // tell server to send notifications
+@@ -1497,7 +1497,7 @@ function rcube_calendar_ui(settings)
+         // update attendee status
+         for (var data, i=0; i < me.selected_event.attendees.length; i++) {
+           data = me.selected_event.attendees[i];
+-          if (settings.identity.emails.indexOf(';'+data.email) >= 0)
++          if (settings.identity.emails.indexOf(';'+String(data.email).toLowerCase()) >= 0)
+             data.status = response.toUpperCase();
+         }
+         event_show_dialog(me.selected_event);
+-- 
+1.7.10.4
+
diff --git a/debian/patches/series b/debian/patches/series
index e0217a3..5ca38fa 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -4,3 +4,4 @@
 0004-Update-changed-date-when-saving-an-object.-last-modi.patch
 0005-Remove-debugging-code.patch
 0006-Read-and-validate-last-modification-date-properties-.patch
+0001-Do-case-insensitive-checks-whether-the-current-user-.patch




More information about the packaging-commits mailing list