EAS, Activesync, eSync, z-push in current master of egroupware: Calendar - syncing calendars from other users

classic Classic list List threaded Threaded
3 messages Options
umehner umehner
Reply | Threaded
Open this post in threaded view
|

EAS, Activesync, eSync, z-push in current master of egroupware: Calendar - syncing calendars from other users

This post was updated on .
Syncing calendars from other users can be set in esync settings (given the appropriate rights to read and edit).

This works well for initial sync, but later changes in other users calendars don't get synced until the OWN calender has got changes. This might be related to the new code beeing based on syncstate returned by AlterPingChanges … .
AlterPingChanges in egroupware/calendar/inc/class.calendar_zpush.inc.php generates a MAX(cal_modified) lookup only for entries owned by the current user (and the groups he belongs to). I think it should lookup calendar changes for all the users (groups) the user has choosen in esync settings as well.

So my suggestion for improvement is this additional code for function AlterPingChanges(...) in
egroupware/calendar/inc/class.calendar_zpush.inc.php :

                //$ctag = $this->calendar->get_ctag($owner,'owner',true);       // true only consider recurrence master
 
// Check for changes in calendar of additional users/groups from esync settings/preferences
if ( $owner == $GLOBALS['egw_info']['user']['account_id'] )
{
        if ( ! is_array( $owner ) )
        {
            $owner = (array)$owner;
        }
        foreach ( explode( ',' , $GLOBALS['egw_info']['user']['preferences']['activesync']['calendar-cals'] ) as $esynccals_uid )
        {
                if ( $esynccals_uid < 0 ) // Get users/members from groups ...
                {
                        foreach((array)$GLOBALS['egw']->accounts->members($esynccals_uid, true) as $member_uid)
                        {
                                if ( ! in_array($member_uid , $owner) )
                                {
                                        $owner[] = $member_uid;
                                }
                        }
                }
                else
                {
                        $owner[] = $esynccals_uid;
                }
        }
}
                $syncstate = $this->calendar->get_ctag($owner,false,true); // we only want to fetch the owners events, where he is a participant too

This works for me right now. Surely there are more elegant ways of solving this.

Cheers,
Ulle
eGroupware SVN Trunk
Ralf Becker Stylite AG Ralf Becker Stylite AG
Reply | Threaded
Open this post in threaded view
|

Re: EAS, Activesync, eSync, z-push in current master of egroupware: Calendar - syncing calendars from ohter users

Hi Ulle,

Am 30.07.16 um 22:39 schrieb umehner:

> Syncing calendars from other users can be set in esync settings (given the
> appropriate rights to read and edit).
>
> This works well for initial sync, but later changes in other users calendars
> don't get synced until the OWN calender has got changes. This might be
> related to the new code beeing based on syncstate returned by
> AlterPingChanges … .
> AlterPingChanges in egroupware/calendar/inc/class.calendar_zpush.inc.php
> generates a MAX(cal_modified) lookup only for entries owned by the current
> user (and the groups he belongs to). I think it should lookup calendar
> changes for all the users (groups) the user has choosen in esync settings as
> well.
>
> So my suggestion for improvement is this additional code for function
> AlterPingChanges(...) in
> egroupware/calendar/inc/class.calendar_zpush.inc.php :
Hmm, seems the mailing list bridge "eats" again your code, it's visible
in Nabble:

   
http://egroupware.219119.n3.nabble.com/EAS-Activesync-eSync-z-push-in-current-master-of-egroupware-Calendar-syncing-calendars-from-ohter-uss-tp4013774.html

But not in what Nabble sends to the mailing list:

    https://sourceforge.net/p/egroupware/mailman/message/35252037/

All that should not be necessary, as I understand the z-push code.
If your phone is subscribed to multiple folders, it should initialize
the changes sink for each synced folder:

   
https://github.com/EGroupware/activesync/blob/master/inc/class.activesync_backend.inc.php#L457

When ChangesSink is called, we request changes for every folder in line 495:

   
https://github.com/EGroupware/activesync/blob/master/inc/class.activesync_backend.inc.php#L495

Can you check your logs, if ChangesSinkInitialise is called for the
folders your are missing (other users calendar)?

@Sebastian: Is my reasoning true, that z-push calls a backends
ChangesSinkInitialise for every folder synced on a client?

Ralf

> This works for me right now. Surely there are more elegant ways of solving
> this.
>
> Cheers,
> Ulle

--
Ralf Becker
Director Software Development

Stylite AG

Isaac-Fulda-Allee 9 | Tel. +49 6131 32702-0
D-55124 Mainz       | Fax. +49 6131 32702-70

Email: [hidden email]

www.stylite.de | www.egroupware.org

Managing Directors: Andre Keller | Gudrun Mueller
Chairman of the supervisory board: Prof. Dr. Birger Leon Kropshofer

VAT DE214280951 | Registered HRB 46224 Mainz Germany



------------------------------------------------------------------------------

_______________________________________________
eGroupWare-developers mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/egroupware-developers

signature.asc (817 bytes) Download Attachment
umehner umehner
Reply | Threaded
Open this post in threaded view
|

Re: EAS, Activesync, eSync, z-push in current master of egroupware: Calendar - syncing calendars from ohter users

Ralf Becker Stylite AG wrote
Hmm, seems the mailing list bridge "eats" again your code, it's visible
in Nabble:

   
http://egroupware.219119.n3.nabble.com/EAS-Activesync-eSync-z-push-in-current-master-of-egroupware-Calendar-syncing-calendars-from-ohter-uss-tp4013774.html

But not in what Nabble sends to the mailing list:

    https://sourceforge.net/p/egroupware/mailman/message/35252037/
Yes, I am posting via Webpage (actually here: http://www.egroupware.org/discover/egroupware-forum#nabble-td4013774 )

Ralf Becker Stylite AG wrote
All that should not be necessary, as I understand the z-push code.
If your phone is subscribed to multiple folders, it should initialize
the changes sink for each synced folder:

   
https://github.com/EGroupware/activesync/blob/master/inc/class.activesync_backend.inc.php#L457

When ChangesSink is called, we request changes for every folder in line 495:

   
https://github.com/EGroupware/activesync/blob/master/inc/class.activesync_backend.inc.php#L495

Can you check your logs, if ChangesSinkInitialise is called for the
folders your are missing (other users calendar)?

@Sebastian: Is my reasoning true, that z-push calls a backends
ChangesSinkInitialise for every folder synced on a client?
You are right. ChangesSinkInitialise is called for every other user-calendar choosen in esync-settings. But I had chosen a group-calendar to be synced. And I changed those ticks from groups to users and tried with other (very old) devices, so I obviously mixed up the cause of the problem ...

So, when choosing a group to be synced in esync settings, the calendar items for all members of that group get initially synced to the phone. The phone sees one calendar for "group" (and the own).
Then, when one of the group members changes or releases a calendar item, it will never get synced to the phone.

My conclusion "don't get synced until the OWN calender has got changes" was wrong, as I was testing with old 12.1 EAS devices, which can't handle multiple calendars with activesync. For them I run a tweaked egroupware/calendar/inc/class.calendar_zpush.inc.php version as described here:
http://www.egroupware.org/discover/egroupware-forum#nabble-td4010845
And for these devices it is needed to look at the other calendars from esync settings, as only the own folder is called for ChangesSinkInitialise, of course.

I still hope for a setting in esync to "sync multiple calendars into one" (like for addressbooks) per device ... ;) , but actually I am happy with my if(old eas-device) { ... } code ...

Cheers,
Ulle


eGroupware SVN Trunk