[horde] Multiple calendar support

Erling Preben Hansen erling at eph.dk
Sun Mar 22 19:53:48 UTC 2015


  Citat af Andreas Mauser <andreas at mauser.info>:

> ----- Nachricht von Michael J Rubinsky <mrubinsk at horde.org> ---------
>     Datum: Sun, 22 Mar 2015 10:40:22 -0400
>       Von: Michael J Rubinsky <mrubinsk at horde.org>
> Antwort an: mrubinsk at horde.org
>   Betreff: Re: [horde] Multiple calendar support
>        An: Andreas Mauser <andreas at mauser.info>
>        Cc: horde at lists.horde.org
>
>> Quoting Andreas Mauser <andreas at mauser.info>:
>>
>>> ----- Nachricht von Michael J Rubinsky <mrubinsk at horde.org> ---------
>>>    Datum: Sun, 22 Mar 2015 10:03:29 -0400
>>>      Von: Michael J Rubinsky <mrubinsk at horde.org>
>>> Antwort an: mrubinsk at horde.org
>>> Betreff: Re: [horde] Multiple calendar support
>>>       An: Andreas Mauser <andreas at mauser.info>,
horde at lists.horde.org
>>>
>>>> Quoting Andreas Mauser <andreas at mauser.info>:
>>>>
>>>>> ----- Nachricht von Michael J Rubinsky <mrubinsk at horde.org> ---------
>>>>> Datum: Sun, 22 Mar 2015 09:34:20 -0400
>>>>>    Von: Michael J Rubinsky <mrubinsk at horde.org>
>>>>> Antwort an: mrubinsk at horde.org
>>>>> Betreff: Re: [horde] Multiple calendar support
>>>>>     An: horde at lists.horde.org
>>>>>
>>>>>> Quoting Andreas Mauser <andreas at mauser.info>:
>>>>>>
>>>>>>> Hi Mike,
>>>>>>>
>>>>>>> ----- Nachricht von Andreas Mauser <andreas at mauser.info> ---------
>>>>>>>   Datum: Sun, 22 Mar 2015 11:13:10 +0100
>>>>>>>     Von: Andreas Mauser <andreas at mauser.info>
>>>>>>> Betreff: Re: [horde] Multiple calendar support
>>>>>>>      An: horde at lists.horde.org
>>>>>>>
>>>>>>>> ----- Nachricht von Andreas Mauser <andreas at mauser.info> ---------
>>>>>>>> Datum: Sun, 22 Mar 2015 09:46:04 +0100
>>>>>>>>    Von: Andreas Mauser <andreas at mauser.info>
>>>>>>>> Betreff: Re: [horde] Multiple calendar support
>>>>>>>>     An: mrubinsk at horde.org, "Mailingliste, Horde"
>>>>>>>
>>>>>>> <horde at lists.horde.org>
>>>>>>>>> Hi Mike,
>>>>>>>>>
>>>>>>>>> ----- Nachricht von Michael J Rubinsky <mrubinsk at horde.org>
>>>>>>>>> ---------
>>>>>>>>>      Datum: Sat, 21 Mar 2015 23:45:10 -0400
>>>>>>>>>        Von: Michael J Rubinsky <mrubinsk at horde.org>
>>>>>>>>> Antwort an: mrubinsk at horde.org
>>>>>>>>>    Betreff: Re: [horde] Multiple calendar support
>>>>>>>>>         An: Andreas Mauser <andreas at mauser.info>
>>>>>>>>>
>>>>>>>>>> Quoting Andreas Mauser <andreas at mauser.info>:
>>>>>>>>>>
>>>>>>>>>>> ----- Nachricht von Michael J Rubinsky <mrubinsk at horde.org>
>>>>>>>>>>> ---------
>>>>>>>>>>>     Datum: Sat, 21 Mar 2015 15:26:23 -0400
>>>>>>>>>>>       Von: Michael J Rubinsky <mrubinsk at horde.org>
>>>>>>>>>>> Antwort an: mrubinsk at horde.org
>>>>>>>>>>>   Betreff: Re: [horde] Multiple calendar support
>>>>>>>>>>>        An: horde at lists.horde.org
>>>>>>>>>>>
>>>>>>>>>>>> Quoting Andreas Mauser <andreas at mauser.info>:
>>>>>>>>>>>>
>>>>>>>>>>>>> ----- Nachricht von Michael J Rubinsky <mrubinsk at horde.org>
>>>>>>>
>>>>>>> ---------
>>>>>>>>>>>>>   Datum: Sat, 21 Mar 2015 14:45:32 -0400
>>>>>>>>>>>>>     Von: Michael J Rubinsky <mrubinsk at horde.org>
>>>>>>>>>>>>> Antwort an: mrubinsk at horde.org
>>>>>>>>>>>>> Betreff: Re: [horde] Multiple calendar support
>>>>>>>>>>>>>      An: horde at lists.horde.org
>>>>>>>>>>>>>
>>>>>>>>>>>>>> Quoting Andreas Mauser <andreas at mauser.info>:
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> Hi,
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> ----- Nachricht von Michael J Rubinsky <mrubinsk at horde.org>
>>>>>>>>>
>>>>>>>>> ---------
>>>>>>>>>>>>>>>      Datum: Sat, 21 Mar 2015 14:18:49 -0400
>>>>>>>>>>>>>>>        Von: Michael J Rubinsky <mrubinsk at horde.org>
>>>>>>>>>>>>>>> Antwort an: mrubinsk at horde.org
>>>>>>>>>>>>>>>    Betreff: Re: [horde] Multiple calendar support
>>>>>>>>>>>>>>>         An: horde at lists.horde.org
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> Quoting Andreas Mauser <andreas at mauser.info>:
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> Hi Team and community,
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> when I create another calendar in Kronolith.
>>>>>>>>>>>>>>>>> And in the settings check the box for more calendar.
>>>>>>>>>>>>>>>>> And choose both calendars for sync...
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> ..should the client not sync both calendars
>>>>>>>>>>>>>>>>> automatically, or do
>>>>>>>>>>>>>>>>> I need
>>>>>>>>>>>>>>>>> to
>>>>>>>>>>>>>>>>> recreate account, or anything?
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> If the client supports multiple collections, it should.
>>>>>>>>>>>>>>>> However,
>>>>>>>>>>>>>>>> there
>>>>>>>>>>>>>>>> are many clients that do NOT support this. The ones we
>>>>>>>>>>>>>>>> know about
>>>>>>>>>>>>>>>> (and
>>>>>>>>>>>>>>>> are able to detect) are forced to "multiplex" the
>>>>>>>>>>>>>>>> collections
>>>>>>>>>>>>>>>> together
>>>>>>>>>>>>>>>> so all events from all of your calendars will appear on a
>>>>>>>>>>>>>>>> single
>>>>>>>>>>>>>>>> calendar on the client.
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> If you get a log from me can you make it force multiplex
>>>>>>>>>>>>>>> then?
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> If you look at your ActiveSync device settings in the
>>>>>>>>>>>>>>>> prefs (or
>>>>>>>
>>>>>>> on
>>>>>>>>>>>>>>>> the
>>>>>>>>>>>>>>>> admin page) you will see a value named "Forced Multiplex
>>>>>>>>>>>>>>>> Value"
>>>>>>>>>>>>>>>> (or
>>>>>>>>>>>>>>>> similar). This is a bit mask that identifies what
>>>>>>>>>>>>>>>> collections are
>>>>>>>>>>>>>>>> being
>>>>>>>>>>>>>>>> forced to a single collection on the client.
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> I can confirm that my client doesnt seem to use this forced
>>>>>>>>>>>>>>> multiplex. I can see that with other of my devices, not
>>>>>>>>>>>>>>> with this
>>>>>>>>>>>>>>> partuclar one.
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> What client are you using?
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> This is Renovate Milestone 5, Android 4.4.4, HTC Sense 6,
>>>>>>>>>>>>>>> and I
>>>>>>>>>>>>>>> believe its booting with Android 5 but am not sure (they
say
>>>>>>>>>>>>>>> something on xda-dev)
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> The client itself is Calengoo, which is using the internal
>>>>>>>>>>>>>>> android
>>>>>>>>>>>>>>> calendar, and the exchange account I created.
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> Thank you,
>>>>>>>>>>>>>>> Andreas
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> Yes, if I can find some way to sniff out this particular
>>>>>>>>>>>>>> client I
>>>>>>>>>>>>>> can try to force it. FWIW, this is what the 
>>>>>>>>>>>>>> activesync_device_modify hook is for - for those clients
>>>>>>>>>>>>>> that don't
>>>>>>>>>>>>>> play nicely with others and are not already dealt with in
>>>>>>>>>>>>>> the stock
>>>>>>>>>>>>>> code.
>>>>>>>>>>>>>
>>>>>>>>>>>>> Okay, so
>>>>>>>>>>>>> 1, I could fix it myself with the hook if I would know how
>>>>>>>>>>>>> to find
>>>>>>>>>>>>> out after which string to look?
>>>>>>>>>>>>> 2, You would need a sync log from me? A full (huge file) or
>>>>>>>>>>>>> just a
>>>>>>>>>>>>> snap?
>>>>>>>>>>>>
>>>>>>>>>>>> I basically need the data from the DEVICEINFORMATION and the
>>>>>>>>>>>> User
>>>>>>>>>>>> Agent etc... Most of this is also listed on the device
>>>>>>>>>>>> information
>>>>>>>>>>>> prefs page.
>>>>>>>>>>>
>>>>>>>>>>> When I go to the Activesync Page I can read:
>>>>>>>>>>>
>>>>>>>>>>> Programm: HTC-EAS-HTCOneM8
>>>>>>>>>>> EAS Version: 14.0
>>>>>>>>>>>
>>>>>>>>>>> What do you mean with the device information prefs page. I did
>>>>>>>>>>> not
>>>>>>>
>>>>>>> find
>>>>>>>>>>> more information ad hoc?
>>>>>>>>>>
>>>>>>>>>> That's the page I meant. It's available under both
>>>>>>>>>> Administration and
>>>>>>>>>> Prefs.
>>>>>>>>>>
>>>>>>>>>> Is this a stock setup or a custom/modified rom?
>>>>>>>>>>
>>>>>>>>>> If it's a stock client, I can add something in code. In the
>>>>>>>>>> meantime,
>>>>>>>>>> you can test this by checking for the userAgent property in the
>>>>>>>>>> hook.
>>>>>>>>>> E.g.,
>>>>>>>>>>
>>>>>>>>>> <code>
>>>>>>>>>>
>>>>>>>>>> if ($device->userAgent == 'HTC-EAS-HTCOneM8') {
>>>>>>>>>>         $device->multiplex =
>>>>>>>
>>>>>>> Horde_ActiveSync_Device::MULTIPLEX_NOTES
>>>>>>>>> |
>>>>>>>>>>             Horde_ActiveSync_Device::MULTIPLEX_CONTACTS |
>>>>>>>>>>             Horde_ActiveSync_Device::MULTIPLEX_CALENDAR |
>>>>>>>>>>             Horde_ActiveSync_Device::MULTIPLEX_TASKS;
>>>>>>>>>> }
>>>>>>>>>>
>>>>>>>>>> // Be sure to return the device object regardless.
>>>>>>>>>> return $device;
>>>>>>>>>> </code>
>>>>>>>>>
>>>>>>>>> I placed the hook in imp/config/hooks.php at the very bottom,
>>>>>>>>> but above
>>>>>>>>> the last two '}' and in the ActiveSync Page I now see multiplex
>>>>>>>>> for my
>>>>>>>>> Device.
>>>>>>>>> Its a custom ROM by the way.
>>>>>>>>>
>>>>>>>>> Nevertheless I still cannot see any other calendar in the android
>>>>>>>
>>>>>>> client.
>>>>>>>> I unchecked the box for seperate calendars and now it seems to
>>>>>>>> work, I
>>>>>>>> can see all calendar data now in the client.
>>>>>>>>
>>>>>>>> Thank you for the hook!
>>>>>>>> Do I need to place it in a .local.php file?
>>>>>>>> Andreas
>>>>>>>
>>>>>>> One last thing.. I have 2 devices with identical user agent. One
>>>>>>> does the multiplexing, the other does not. Same ROM, same Versions.
>>>>>>>
>>>>>>> Any idea?
>>>>>>
>>>>>> My guess is either the hook was implemented incorrectly, or the
>>>>>> perhaps the client needs to be refreshed/account recreated. If you
>>>>>> see the Forced Multiplex bitmap under the device info, and it is
>>>>>> still not being multiplexed, I would check that all calendars are
>>>>>> selected to be synced in Kronolith's prefs and then recreate the
>>>>>> account on the client.
>>>>>
>>>>> Hm. Copy/paste your code into the horde/config/hooks.php makes my
>>>>> server unavailable.
>>>>>
>>>>> your code looks somehow different (for me) from the hooks.php file:
>>>>>
>>>>> // public function activesync_device_modify(Horde_ActiveSync_Device
>>>>> $device)
>>>>> // {
>>>>> //     // Example for forcing certain device to force multiplexed
>>>>> //     // collections for collection types they don't support
multiple
>>>>> //     // collections for. Note that this doesn't apply to email
>>>>> folders,
>>>>> //     // which are NEVER sent multiplexed.
>>>>> //     // NOTE: The Horde_ActiveSync library already determines
this
>>>>> based
>>>>> //     //          on some userAgent and version sniffing.
You
>>>>> should only
>>>>> //     //       perform this here if it doesn't work for you,
or you
>>>>> have
>>>>> //     //       discovered a device that doesn't fit the
logic.
>>>>>
>>>>> //     // For android devices that don't advertise the android
>>>>> version we have
>>>>> //     // to manually set the multiplex flag if we want to force
>>>>> any. E.g.,
>>>>> //     // the Galaxy Note 3 doesn't support multiple collections
>>>>> prior to
>>>>> //     // KitKat so we have to force them all.
>>>>> //     if (empty($device->multiplex)) {
>>>>> //         switch (strtolower($device->userAgent)) {
>>>>> //         case 'SAMSUNG-SM-N900V/101.403':
>>>>> //             // Note 3, Android 4.3
>>>>> //             $device->multiplex =
>>>>> Horde_ActiveSync_Device::MULTIPLEX_NOTES |
>>>>> //               
 Horde_ActiveSync_Device::MULTIPLEX_CONTACTS |
>>>>> //               
 Horde_ActiveSync_Device::MULTIPLEX_CALENDAR |
>>>>> //                 Horde_ActiveSync_Device::MULTIPLEX_TASKS;
>>>>> //         }
>>>>> //     }
>>>>>
>>>>> //     return $device;
>>>>> // }
>>>>>
>>>>> The difference for me is if (empty)...? empty I can not associate
>>>>> with your code.
>>>>> And I cant see case in your code either... is this the right file
>>>>> here : horde/config/hooks.php  which I created from hooks.php.dist
>>>>>
>>>>> It looks now like that:
>>>>>
>>>>> public function activesync_device_modify(Horde_ActiveSync_Device
>>>>> $device)
>>>>> {
>>>>> //     // Example for forcing certain device to force multiplexed
>>>>> //     // collections for collection types they don't support
multiple
>>>>> //     // collections for. Note that this doesn't apply to email
>>>>> folders,
>>>>> //     // which are NEVER sent multiplexed.
>>>>> //     // NOTE: The Horde_ActiveSync library already determines
this
>>>>> based
>>>>> //     //          on some userAgent and version sniffing.
You
>>>>> should only
>>>>> //     //       perform this here if it doesn't work for you,
or you
>>>>> have
>>>>> //     //       discovered a device that doesn't fit the
logic.
>>>>>
>>>>> //     // For android devices that don't advertise the android
>>>>> version we have
>>>>> //     // to manually set the multiplex flag if we want to force
>>>>> any. E.g.,
>>>>> //     // the Galaxy Note 3 doesn't support multiple collections
>>>>> prior to
>>>>> //     // KitKat so we have to force them all.
>>>>>    if (device->multiplex) {
>>>>>        switch (strtolower($device->userAgent)) {
>>>>>        case 'HTC-EAS-HTCOneM8':
>>>>> //             // Note 3, Android 4.3
>>>>>            $device->multiplex =
>>>>> Horde_ActiveSync_Device::MULTIPLEX_NOTES |
>>>>>                Horde_ActiveSync_Device::MULTIPLEX_CONTACTS |
>>>>>                Horde_ActiveSync_Device::MULTIPLEX_CALENDAR |
>>>>>                Horde_ActiveSync_Device::MULTIPLEX_TASKS;
>>>>>        }
>>>>>    }
>>>>>
>>>>>    return $device;
>>>>> }
>>>>>
>>>>> }
>>>>>
>>>>> And it does not work for me.
>>>>
>>>> Yeah, the hook is incorrect. If you are going to adapt it to the
>>>> example code instead of just replacing it, you need to do some more
>>>> stuff. You reversed the logic on the if conditional so now it only
>>>> checks the userAgent if multiplex is already set - so if the device
>>>> wasn't detected by existing code as needed multiplex, the hook will
>>>> never set it either. You also are comparing uppercase UserAgent
>>>> string with a strtolower'd string so that will never match either.
>>>> Try replacing the entire hook with:
>>>>
>>>> // conditional prevents overwriting any existing multiplex values.
>>>> // It's possible that in some edge cases existing code could set an
>>>> // incorrect multiplex value (instead of just not setting one at all)
>>>> // so this check can be removed and replaced with a straight-forward
>>>> userAgent
>>>> // comparison or username/device/userAgent or whatever works in your
>>>> case...
>>>> if (empty($device->multiplex)) {
>>>> switch (strtolower($device->userAgent)) {
>>>> case 'htc-eas-htconem8':
>>>>      $device->multiplex =
>>>>          Horde_ActiveSync_Device::MULTIPLEX_NOTES |
>>>>          Horde_ActiveSync_Device::MULTIPLEX_CONTACTS |
>>>>          Horde_ActiveSync_Device::MULTIPLEX_CALENDAR |
>>>>          Horde_ActiveSync_Device::MULTIPLEX_TASKS;
>>>> }
>>>> }
>>>>
>>>> return $device;
>>>
>>> As soon as I put the code in the server responding with communication
>>> failed to server.
>>>
>>> It now looks like that in the file:
>>>
>>> * @return Horde_ActiveSync_Device  The possibly modified device
object.
>>>   */
>>> // public function activesync_device_modify(Horde_ActiveSync_Device
>>> $device)
>>> // {
>>> //     // Example for forcing certain device to force multiplexed
>>> //     // collections for collection types they don't support
multiple
>>> //     // collections for. Note that this doesn't apply to email
>>> folders,
>>> //     // which are NEVER sent multiplexed.
>>> //     // NOTE: The Horde_ActiveSync library already determines this
>>> based
>>> //     //          on some userAgent and version sniffing. You
should
>>> only
>>> //     //       perform this here if it doesn't work for you, or
you
>>> have
>>> //     //       discovered a device that doesn't fit the logic.
>>>
>>> //     // For android devices that don't advertise the android
version
>>> we have
>>> //     // to manually set the multiplex flag if we want to force
any.
>>> E.g.,
>>> //     // the Galaxy Note 3 doesn't support multiple collections
prior
>>> to
>>> //     // KitKat so we have to force them all.
>>> //     if (device->multiplex) {
>>> //         switch (strtolower($device->userAgent)) {
>>> //         case 'HTC-EAS-HTCOneM8':
>>> //             // Note 3, Android 4.3
>>> //             $device->multiplex =
>>> Horde_ActiveSync_Device::MULTIPLEX_NOTES |
>>> //                 Horde_ActiveSync_Device::MULTIPLEX_CONTACTS
|
>>> //                 Horde_ActiveSync_Device::MULTIPLEX_CALENDAR
|
>>> //                 Horde_ActiveSync_Device::MULTIPLEX_TASKS;
>>> //         }
>>> //     }
>>>
>>> //     return $device;
>>> // }
>>>
>>> if (empty($device->multiplex)) {
>>>   switch (strtolower($device->userAgent)) {
>>>   case 'htc-eas-htconem8':
>>>       $device->multiplex =
>>>           Horde_ActiveSync_Device::MULTIPLEX_NOTES |
>>>           Horde_ActiveSync_Device::MULTIPLEX_CONTACTS |
>>>           Horde_ActiveSync_Device::MULTIPLEX_CALENDAR |
>>>           Horde_ActiveSync_Device::MULTIPLEX_TASKS;
>>>   }
>>> }
>>>
>>> return $device;
>>>
>>> }
>>>
>>> And brings up the comunication problem with the server.
>>
>> Sorry, you need to put the code within the actual hook method. I.e.,
>> between the public function activesync_device_modify and closing
>> bracket (and uncomment both)>
>
> Tnank you Mike,
>
> that was it!
>
> Best regards,Andreas

Hey

Well I learned something by following this line of posts.
So please don't get a room.....
:-)

/erling


More information about the horde mailing list