roundcube / roundcubemail

The Roundcube Webmail suite
https://roundcube.net
GNU General Public License v3.0
5.88k stars 1.64k forks source link

Patch Submission: RFC 2739 Support to LDAP Addressbook #5495

Open kidmock opened 8 years ago

kidmock commented 8 years ago

I submit for your review a patch that enables Free/busy and calendar URI support in accordances with RFC 2739.

--- roundcubemail/config/defaults.inc.php   2016-10-29 14:21:36.755320790 +0000
+++ roundcubemail-rfc2739/config/defaults.inc.php   2016-10-29 15:26:26.614081074 +0000
@@ -907,6 +907,8 @@
     'jobtitle'     => 'title',
     'notes'        => 'description',
     'photo'        => 'jpegPhoto',
+    'freebusyurl'  => 'calFBURL:*',
+    'calendarurl'  => 'calCalURI:*',
     // these currently don't work:
     // 'manager'       => 'manager',
     // 'assistant'     => 'secretary',
diff -ur roundcubemail/program/lib/Roundcube/rcube_vcard.php roundcubemail-rfc2739/program/lib/Roundcube/rcube_vcard.php
--- roundcubemail/program/lib/Roundcube/rcube_vcard.php 2016-10-29 14:21:36.908319049 +0000
+++ roundcubemail-rfc2739/program/lib/Roundcube/rcube_vcard.php 2016-10-29 15:00:19.348920214 +0000
@@ -48,6 +48,8 @@
         'spouse'      => 'X-SPOUSE',
         'edit'        => 'X-AB-EDIT',
         'groups'      => 'CATEGORIES',
+        'freebusyurl' => 'FBURL',
+        'calendarurl' => 'CALURI',
     );
     private $typemap = array(
         'IPHONE'   => 'mobile',
@@ -214,7 +216,7 @@
                     }

                     // force subtype if none set
-                    if (!$subtype && preg_match('/^(email|phone|address|website)/', $key)) {
+                    if (!$subtype && preg_match('/^(email|phone|address|website|freebusyurl|calendarurl)/', $key)) {
                         $subtype = 'other';
                     }

@@ -532,7 +534,7 @@
         // Cleanup
         $vcard = preg_replace(array(
                 // convert special types (like Skype) to normal type='skype' classes with this simple regex ;)
-                '/item(\d+)\.(TEL|EMAIL|URL)([^:]*?):(.*?)item\1.X-ABLabel:(?:_\$!<)?([\w-() ]*)(?:>!\$_)?./si',
+                '/item(\d+)\.(TEL|EMAIL|URL|FBURL|CALURI)([^:]*?):(.*?)item\1.X-ABLabel:(?:_\$!<)?([\w-() ]*)(?:>!\$_)?./si',
                 '/^item\d*\.X-AB.*$/mi',  // remove cruft like item1.X-AB*
                 '/^item\d*\./mi',         // remove item1.ADR instead of ADR
                 '/\n+/',                 // remove empty lines
diff -ur roundcubemail/program/localization/en_CA/labels.inc roundcubemail-rfc2739/program/localization/en_CA/labels.inc
--- roundcubemail/program/localization/en_CA/labels.inc 2016-10-29 14:21:36.915318968 +0000
+++ roundcubemail-rfc2739/program/localization/en_CA/labels.inc 2016-10-29 15:19:12.391619474 +0000
@@ -263,6 +263,8 @@
 $labels['birthday']     = 'Birthday';
 $labels['anniversary']  = 'Anniversary';
 $labels['website']      = 'Website';
+$labels['freebusyurl']  = 'Free/Busy';
+$labels['calendarurl']  = 'Calendar';
 $labels['instantmessenger'] = 'IM';
 $labels['notes'] = 'Notes';
 $labels['male']   = 'male';
diff -ur roundcubemail/program/localization/en_GB/labels.inc roundcubemail-rfc2739/program/localization/en_GB/labels.inc
--- roundcubemail/program/localization/en_GB/labels.inc 2016-10-29 14:21:36.915318968 +0000
+++ roundcubemail-rfc2739/program/localization/en_GB/labels.inc 2016-10-29 15:19:28.407452498 +0000
@@ -300,6 +300,8 @@
 $labels['birthday']     = 'Birthday';
 $labels['anniversary']  = 'Anniversary';
 $labels['website']      = 'Website';
+$labels['freebusyurl']  = 'Free/Busy';
+$labels['calendarurl']  = 'Calendar';
 $labels['instantmessenger'] = 'IM';
 $labels['notes'] = 'Notes';
 $labels['male']   = 'male';
diff -ur roundcubemail/program/localization/en_US/labels.inc roundcubemail-rfc2739/program/localization/en_US/labels.inc
--- roundcubemail/program/localization/en_US/labels.inc 2016-10-29 14:21:36.915318968 +0000
+++ roundcubemail-rfc2739/program/localization/en_US/labels.inc 2016-10-29 15:19:49.137236340 +0000
@@ -350,6 +350,8 @@
 $labels['birthday']     = 'Birthday';
 $labels['anniversary']  = 'Anniversary';
 $labels['website']      = 'Website';
+$labels['freebusyurl']  = 'Free/Busy';
+$labels['calendarurl']  = 'Calendar';
 $labels['instantmessenger'] = 'IM';
 $labels['notes'] = 'Notes';
 $labels['male']   = 'male';
diff -ur roundcubemail/program/steps/addressbook/edit.inc roundcubemail-rfc2739/program/steps/addressbook/edit.inc
--- roundcubemail/program/steps/addressbook/edit.inc    2016-10-29 14:21:36.944318641 +0000
+++ roundcubemail-rfc2739/program/steps/addressbook/edit.inc    2016-10-29 14:52:12.600261558 +0000
@@ -168,6 +168,8 @@
                 'manager' => array('size' => $i_size),
                 'assistant' => array('size' => $i_size),
                 'spouse' => array('size' => $i_size),
+                'freebusyurl' => array('size' => $i_size),
+                'calendarurl' => array('size' => $i_size),
             ),
         ),
     );
diff -ur roundcubemail/program/steps/addressbook/func.inc roundcubemail-rfc2739/program/steps/addressbook/func.inc
--- roundcubemail/program/steps/addressbook/func.inc    2016-10-29 14:21:36.944318641 +0000
+++ roundcubemail-rfc2739/program/steps/addressbook/func.inc    2016-10-29 14:51:10.872937613 +0000
@@ -53,6 +53,8 @@
     'assistant'    => array('type' => 'text', 'size' => 40, 'maxlength' => 50, 'limit' => 1, 'label' => $RCMAIL->gettext('assistant'), 'category' => 'personal'),
     'manager'      => array('type' => 'text', 'size' => 40, 'maxlength' => 50, 'limit' => 1, 'label' => $RCMAIL->gettext('manager'), 'category' => 'personal'),
     'spouse'       => array('type' => 'text', 'size' => 40, 'maxlength' => 50, 'limit' => 1, 'label' => $RCMAIL->gettext('spouse'), 'category' => 'personal'),
+    'freebusyurl'  => array('type' => 'text', 'size' => 40, 'maxlength' => 50, 'limit' => 1, 'label' => $RCMAIL->gettext('freebusyurl'), 'category' => 'personal'),
+    'calendarurl'  => array('type' => 'text', 'size' => 40, 'maxlength' => 50, 'limit' => 1, 'label' => $RCMAIL->gettext('calendarurl'), 'category' => 'personal'),
     // TODO: define fields for vcards like GEO, KEY
 );

diff -ur roundcubemail/program/steps/addressbook/show.inc roundcubemail-rfc2739/program/steps/addressbook/show.inc
--- roundcubemail/program/steps/addressbook/show.inc    2016-10-29 14:21:36.945318630 +0000
+++ roundcubemail-rfc2739/program/steps/addressbook/show.inc    2016-10-29 14:46:39.371907508 +0000
@@ -117,6 +117,8 @@
                 'manager' => array('size' => $i_size),
                 'assistant' => array('size' => $i_size),
                 'spouse' => array('size' => $i_size),
+                'freebusyurl' => array('size' => $i_size),
+                'calendarurl' => array('size' => $i_size),
             ),
         ),
     );
alecpl commented 8 years ago

Could you create a pull request?

kidmock commented 8 years ago

Done. Hopefully, I did it right. My first time creating a pull request