[Kolab-devel] kolab-freebusy / CN in fb-vcal files

Mike Gabriel m.gabriel at das-netzwerkteam.de
Wed Feb 27 15:00:50 CET 2008


hi gunnar,

thanks for working on this!!!

Quoting Gunnar Wrobel <wrobel at pardus.de>:

> I added patches to both Horde CVS and Kolab CVS to support the CN:
>
> http://cvs.horde.org/diff.php?r1=1.5&r2=1.6&f=framework%2FKolab%2FKolab%2FLDAP.php

in userInfo you have to add the cn attribute to the ldap_search result  
array, otherwise in won't be in the user infos:

<quote>
     function userInfo($uid)
     {
         $result = ldap_search($this->connection,
                               $GLOBALS['conf']['kolab']['ldap']['basedn'],
                               '(&(objectClass=kolabInetOrgPerson)(|(uid='.
                               Horde_LDAP::quote($uid) . ')(mail=' .
                               Horde_LDAP::quote($uid) . ')))',
                               array('dn','mail','cn','uid','kolabHomeServer',
                                                 ^^^^
                                     'kolabFreeBusyFuture'));
</quote>

> http://kolab.org/cgi-bin/viewcvs-kolab.cgi/server/php-kolab/Kolab_Freebusy/Freebusy/Cache.php.diff?r1=1.7&r2=1.8

in FreeBusyCache::store() the method Horde_Kolab_Freebusy::generate()  
is called. this method needs the CN fix as well. the generate method  
has to be called with cn as last option (my solution...):

<quote>
$vCal = $fb->generate(null, null, $access->fbpast, $access->fbfuture,
                               $access->owner, $access->cn);
</quote>

and in Horde_Kolab_Freebusy::generate()

you have to add the CN field to the list of method params:

<quote>
  function &generate($startstamp = null, $endstamp = null,
                        $fbpast = 0, $fbfuture = 60,
                        $user = null, $cn=null)
     {
         [...]

         /* Create the new iCalendar. */
         $vCal = new Horde_iCalendar();
         $vCal->setAttribute('PRODID', '-//proko2//freebusy 1.0//EN');
         $vCal->setAttribute('METHOD', 'PUBLISH');

         /* Create new vFreebusy. */
         $vFb = &Horde_iCalendar::newComponent('vfreebusy', $vCal);
         if ($cn) {
             $cn_param = ';CN='. $cn ;
         }
         $vFb->setAttribute('ORGANIZER'. $cn_param, 'MAILTO:' . $user);

         $vFb->setAttribute('DTSTAMP', $_SERVER['REQUEST_TIME']);
         $vFb->setAttribute('DTSTART', $startstamp);
         $vFb->setAttribute('DTEND', $endstamp);

         [...]

</quote>


>   organizer  = "ORGANIZER" orgparam ":"
>                cal-address CRLF
>
>   orgparam   = *(
>
>              ; the following are optional,
>              ; but MUST NOT occur more than once
>
>              (";" cnparam) / (";" dirparam) / (";" sentbyparam) /
>              (";" languageparam) /
>
>              ; the following is optional,
>              ; and MAY occur more than once
>
>              (";" xparam)
>
>              )

i also checked some iCal examples on wikipedia:
http://en.wikipedia.org/wiki/ICalendar

to my point of view an ORGANIZER with CN entry has to look like this:

ORGANIZER;CN=Willi Winzig:MAILTO:w.winzig at get-bigger.heaven

so i have modified the CN patch in the generate method a little that  
is called on fb store...

BTW: i do not think that the CN patch has to be added to the load  
(from cache) function. once the ORGANIZER is properly stored in the  
cache, the fb-iCal file is also properly reproduced from freebusy file  
cache.

>>>> Horde_iCalendar_vfreebusy::getName() does not return a valid friendly
>>>> name for the ORGANIZER. this probably is mainly due to a missing CN
>>>> param for the ORGANIZER in my freebusy cache files generated by the
>>>> kolab-2.2 freebusy engine (i backported fb scripts from kolab-2.2 to
>>>> kolab-2.1).
>
> What is the exact error that led to your assumption? Do the patches I
> mentioned above fix the problem?

no, unfortunately the problem is not yet fixed. whenever i want to  
view freebusy information in horde, i receive this php error:

Notice: Undefined index: path in  
/usr/local/share/_horde-versions_/horde-webmail-1.1-rc1-netzwerkteam/lib/Horde/iCalendar/vfreebusy.php on line  
106

> I looked briefly at the vfreebusy.php code but I'm not certain that a
> missing CN would indeed make the code. I think getName() should only
> return an empty string then which seems to be fine.

maybe, we have a different getName method?

<quote>
     function getName()
     {
         $name = '';
         $method = !empty($this->_container) ?
             $this->_container->getAttribute('METHOD') : 'PUBLISH';

         if (is_a($method, 'PEAR_Error') || $method == 'PUBLISH') {
             $attr = 'ORGANIZER';
         } elseif ($method == 'REPLY') {
             $attr = 'ATTENDEE';
         }

         $name = $this->getAttribute($attr, true);
         if (isset($name[0]['CN'])) {
             return $name[0]['CN'];
         }

         $name = $this->getAttribute($attr);
         if (is_a($name, 'PEAR_Error')) {
             return '';
         } else {
             $name = parse_url($name);
             return $name['path'];
         }
     }

</quote>

best,
mike

-- 

das netzwerkteam
mike gabriel, hamburger chaussee 240, 24113 kiel

fon: +49 431 64 74 196
voip/voicemail: +49 431 643 643 6
fax: +49 431 64 74 276
mail: m.gabriel at das-netzwerkteam.de, http://das-netzwerkteam.de
FreeBusy:
https://mail.das-netzwerkteam.de/mailxchange/kronolith/fb.php?u=m.gabriel%40das-netzwerkteam.de

----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.




More information about the devel mailing list