From fe09a7969d5fe57468bd7540318da75111b767ab Mon Sep 17 00:00:00 2001 From: Ludovic Marcotte Date: Tue, 6 Nov 2012 08:05:23 -0500 Subject: [PATCH] Automatically disable alarms for newly subsribed calendars. This fixes bug #2074. --- SoObjects/SOGo/SOGoGCSFolder.m | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/SoObjects/SOGo/SOGoGCSFolder.m b/SoObjects/SOGo/SOGoGCSFolder.m index 13a02abc0..86fcf1639 100644 --- a/SoObjects/SOGo/SOGoGCSFolder.m +++ b/SoObjects/SOGo/SOGoGCSFolder.m @@ -1,7 +1,7 @@ /* SOGoGCSFolder.m - this file is part of SOGo * * Copyright (C) 2004-2005 SKYRIX Software AG - * Copyright (C) 2006-2010 Inverse inc. + * Copyright (C) 2006-2012 Inverse inc. * * Author: Wolfgang Sourdeau * @@ -835,7 +835,7 @@ static NSArray *childRecordFields = nil; - (BOOL) subscribeUserOrGroup: (NSString *) theIdentifier reallyDo: (BOOL) reallyDo { - NSMutableDictionary *moduleSettings; + NSMutableDictionary *moduleSettings, *folderShowAlarms; NSMutableArray *folderSubscription; NSString *subscriptionPointer; NSMutableArray *allUsers; @@ -886,6 +886,8 @@ static NSArray *childRecordFields = nil; folderSubscription = [moduleSettings objectForKey: @"SubscribedFolders"]; subscriptionPointer = [self folderReference]; + + folderShowAlarms = [moduleSettings objectForKey: @"FolderShowAlarms"]; if (reallyDo) { @@ -897,14 +899,26 @@ static NSArray *childRecordFields = nil; forKey: @"SubscribedFolders"]; } + if (!(folderShowAlarms + && [folderShowAlarms isKindOfClass: [NSMutableDictionary class]])) + { + folderShowAlarms = [NSMutableDictionary dictionary]; + [moduleSettings setObject: folderShowAlarms + forKey: @"FolderShowAlarms"]; + } + [folderSubscription addObjectUniquely: subscriptionPointer]; + + // By default, we disable alarms on subscribed calendars + [folderShowAlarms setObject: [NSNumber numberWithBool: NO] + forKey: subscriptionPointer]; } else { [self removeFolderSettings: moduleSettings withReference: subscriptionPointer]; [folderSubscription removeObject: subscriptionPointer]; - + [folderShowAlarms removeObjectForKey: subscriptionPointer]; } [us synchronize];