Skip to content

Commit

Permalink
Properly honor "include in freebusy"
Browse files Browse the repository at this point in the history
Fixes #3354
  • Loading branch information
cgx committed Apr 27, 2017
1 parent 663a0b6 commit ef5728d
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 29 deletions.
1 change: 1 addition & 0 deletions NEWS
Expand Up @@ -20,6 +20,7 @@ Bug fixes
- [core] handle properly mails using windows-1255 charset (#4124)
- [core] fixed email reminders sent multiple times (#4100)
- [core] fixed LDIF to vCard conversion for non-handled multi-value attributes (#4086)
- [core] properly honor the "include in freebusy" setting (#3354)
- [eas] set reply/forwarded flags when ReplaceMime is set (#4133)
- [eas] remove alarms over EAS if we don't want them (#4059)
- [eas] correctly set RSVP on event invitations
Expand Down
41 changes: 16 additions & 25 deletions SoObjects/Appointments/SOGoAppointmentFolder.m
Expand Up @@ -431,36 +431,27 @@ - (void) setShowCalendarTasks: (BOOL) new
- (BOOL) includeInFreeBusy
{
NSNumber *excludeFromFreeBusy;
NSString *userLogin;
NSString *userLogin, *ownerInContext;
BOOL is_owner;

userLogin = [[context activeUser] login];
is_owner = [userLogin isEqualToString: self->owner];

// Check if the owner (not the active user) has excluded the calendar from her/his free busy data.
excludeFromFreeBusy
= [self folderPropertyValueInCategory: @"FreeBusyExclusions"
forUser: [context activeUser]];
ownerInContext = [[self container] ownerInContext: context];
is_owner = [userLogin isEqualToString: ownerInContext];

if ([self isSubscription])
{
// If the user has not yet set an include/not include fb information let's EXCLUDE it.
if (!excludeFromFreeBusy)
return NO;
else
return ![excludeFromFreeBusy boolValue];
}
else if (is_owner)
{
// We are the owner but we haven't included/excluded freebusy info, let's INCLUDE it.
if (!excludeFromFreeBusy)
return YES;
else
return ![excludeFromFreeBusy boolValue];
}
if (is_owner)
excludeFromFreeBusy
= [self folderPropertyValueInCategory: @"FreeBusyExclusions"
forUser: [context activeUser]];
else
excludeFromFreeBusy
= [self folderPropertyValueInCategory: @"FreeBusyExclusions"
forUser: [SOGoUser userWithLogin: ownerInContext]];

// We haven't included/excluded freebusy info, let's INCLUDE it.
if (!excludeFromFreeBusy)
return YES;

// It's not a subscribtion and we aren't the owner. Let's INCLUDE the freebusy info.
return YES;
return ![excludeFromFreeBusy boolValue];
}

- (void) setIncludeInFreeBusy: (BOOL) newInclude
Expand Down
10 changes: 7 additions & 3 deletions SoObjects/Appointments/SOGoFreeBusyObject.m
Expand Up @@ -309,6 +309,7 @@ - (NSArray *) fetchFreeBusyInfosFrom: (NSCalendarDate *) startDate
to: (NSCalendarDate *) endDate
{
SOGoAppointmentFolder *calFolder;
SOGoAppointmentFolders *calFolders;
SOGoUser *user;
SOGoUserDefaults *ud;
NSArray *folders;
Expand All @@ -318,9 +319,12 @@ - (NSArray *) fetchFreeBusyInfosFrom: (NSCalendarDate *) startDate

infos = [NSMutableArray array];

folders = [[container lookupName: @"Calendar"
inContext: context
acquire: NO] subFolders];
calFolders = [container lookupName: @"Calendar"
inContext: context
acquire: NO];
[calFolders appendSubscribedSources];
folders = [calFolders subFolders];

max = [folders count];
for (count = 0; count < max; count++)
{
Expand Down
8 changes: 7 additions & 1 deletion SoObjects/SOGo/SOGoParentFolder.m
@@ -1,6 +1,6 @@
/* SOGoParentFolder.m - this file is part of SOGo
*
* Copyright (C) 2006-2015 Inverse inc.
* Copyright (C) 2006-2017 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
Expand Down Expand Up @@ -317,6 +317,12 @@ - (NSException *) appendSubscribedSources
int i;
BOOL dirty;

if (!subscribedSubFolders)
subscribedSubFolders = [NSMutableDictionary new];

if (!subFolderClass)
subFolderClass = [[self class] subFolderClass];

error = nil; /* we ignore non-DB errors at this time... */
dirty = NO;

Expand Down

0 comments on commit ef5728d

Please sign in to comment.