From 31cffdffd34429d1f4873d07d67e822bff82b7cf Mon Sep 17 00:00:00 2001 From: Ludovic Marcotte Date: Tue, 23 Dec 2014 10:24:16 -0500 Subject: [PATCH] Fix freebusy info not always returned --- NEWS | 1 + .../Appointments/SOGoAppointmentFolder.m | 24 +++++++++++++++---- SoObjects/SOGo/SOGoFolder.h | 2 +- SoObjects/SOGo/SOGoFolder.m | 4 +--- 4 files changed, 23 insertions(+), 8 deletions(-) diff --git a/NEWS b/NEWS index 5502f1d45..fc7a69502 100644 --- a/NEWS +++ b/NEWS @@ -3,6 +3,7 @@ Bug fixes - fix contact description truncation on WP8 phones (#3028) + - fix freebusy information not always returned Enhancements - initial support for empty sync request/response for EAS diff --git a/SoObjects/Appointments/SOGoAppointmentFolder.m b/SoObjects/Appointments/SOGoAppointmentFolder.m index a01c10c62..ccc98a9dc 100644 --- a/SoObjects/Appointments/SOGoAppointmentFolder.m +++ b/SoObjects/Appointments/SOGoAppointmentFolder.m @@ -492,6 +492,9 @@ static Class iCalEventK = nil; // // If the user is NOT the owner of the calendar, by default we exclude the freebusy information. // +// We must include the freebusy information of other users if we are actually looking at their freebusy information +// but we aren't necessarily subscribed to their calendars. +// - (BOOL) includeInFreeBusy { NSNumber *excludeFromFreeBusy; @@ -500,16 +503,29 @@ static Class iCalEventK = nil; userLogin = [[context activeUser] login]; is_owner = [userLogin isEqualToString: [self ownerInContext: context]]; - + // Check if the owner (not the active user) has excluded the calendar from her/his free busy data. excludeFromFreeBusy = [self folderPropertyValueInCategory: @"FreeBusyExclusions" forUser: [SOGoUser userWithLogin: userLogin]]; - if (!excludeFromFreeBusy && !is_owner) - return NO; + if ([self isSubscription]) + { + // If the user has not yet set an include/not include fb information... + if (!excludeFromFreeBusy) + return NO; + else + return ![excludeFromFreeBusy boolValue]; + } + else if (is_owner) + { + if (!excludeFromFreeBusy) + return YES; + else + return ![excludeFromFreeBusy boolValue]; + } - return ![excludeFromFreeBusy boolValue]; + return YES; } - (void) setIncludeInFreeBusy: (BOOL) newInclude diff --git a/SoObjects/SOGo/SOGoFolder.h b/SoObjects/SOGo/SOGoFolder.h index 186036db3..018cfe7e0 100644 --- a/SoObjects/SOGo/SOGoFolder.h +++ b/SoObjects/SOGo/SOGoFolder.h @@ -1,6 +1,6 @@ /* SOGoFolder.h - this file is part of SOGo * - * Copyright (C) 2007-2013 Inverse inc. + * Copyright (C) 2007-2014 Inverse inc. * * This file is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/SoObjects/SOGo/SOGoFolder.m b/SoObjects/SOGo/SOGoFolder.m index a27466cdd..a390b9267 100644 --- a/SoObjects/SOGo/SOGoFolder.m +++ b/SoObjects/SOGo/SOGoFolder.m @@ -1,8 +1,6 @@ /* SOGoFolder.m - this file is part of SOGo * - * Copyright (C) 2007-2011 Inverse inc. - * - * Author: Wolfgang Sourdeau + * Copyright (C) 2007-2014 Inverse inc. * * This file is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by