merge of '67d8b9dd5560b0fe74b28e933a26f5555a9cad04'

and '8a7076e816120408558e4add54151b80aeeb69d8'

Monotone-Parent: 67d8b9dd5560b0fe74b28e933a26f5555a9cad04
Monotone-Parent: 8a7076e816120408558e4add54151b80aeeb69d8
Monotone-Revision: ca77b33237a4a7e175057093f4f695d8170e5f1c

Monotone-Author: flachapelle@inverse.ca
Monotone-Author: ludovic@Sophos.ca
Monotone-Date: 2008-12-02T20:13:44
Monotone-Date: 2008-12-02T21:04:23
Monotone-Branch: ca.inverse.sogo
Monotone-Branch: ca.inverse.sogo
This commit is contained in:
Francis Lachapelle
2008-12-02 20:13:44 +00:00
4 changed files with 47 additions and 22 deletions

View File

@@ -1,3 +1,8 @@
2008-12-01 Ludovic Marcotte <lmarcotte@inverse.ca>
* Improved the cache sync process and added
safetiness using a db transaction.
2008-12-01 Francis Lachapelle <flachapelle@inverse.ca>
* SoObjects/Appointments/SOGoAppointmentObject.m

View File

@@ -248,6 +248,11 @@ static SOGoCache *sharedCache = nil;
if ((user = [users objectForKey: uid]))
{
[[user userDefaults] setValues: [[theNotification userInfo] objectForKey: @"values"]];
[self setCachedUserDefaults: [user userDefaults] forKey: uid];
}
else
{
[s_userDefaults removeObjectForKey: uid];
}
}
@@ -261,6 +266,11 @@ static SOGoCache *sharedCache = nil;
if ((user = [users objectForKey: uid]))
{
[[user userSettings] setValues: [[theNotification userInfo] objectForKey: @"values"]];
[self setCachedUserSettings: [user userSettings] forKey: uid];
}
else
{
[s_userSettings removeObjectForKey: uid];
}
}

View File

@@ -1,5 +1,6 @@
/*
Copyright (C) 2005 SKYRIX Software AG
Copyright (C) 2008 Inverse inc.
This file is part of OpenGroupware.org.
@@ -264,33 +265,19 @@ static NSString *uidColumnName = @"c_uid";
channel = [cm acquireOpenChannelForURL: [self tableURL]];
if (channel)
{
[[channel adaptorContext] beginTransaction];
ex = [channel evaluateExpressionX:sql];
if (ex)
[self errorWithFormat: @"could not run SQL '%@': %@", sql, ex];
{
[self errorWithFormat: @"could not run SQL '%@': %@", sql, ex];
[[channel adaptorContext] rollbackTransaction];
}
else
{
NSMutableDictionary *d;
d = [[NSMutableDictionary alloc] init];
[d setObject: values forKey: @"values"];
[d setObject: uid forKey: @"uid"];
[[NSDistributedNotificationCenter defaultCenter]
postNotificationName: ([fieldName isEqualToString: @"c_defaults"] ? @"SOGoUserDefaultsHaveChanged" : @"SOGoUserSettingsHaveChanged")
object: nil
userInfo: d];
[d release];
if ([[channel adaptorContext] hasOpenTransaction])
if ([[channel adaptorContext] commitTransaction])
{
ex = [channel evaluateExpressionX: @"COMMIT TRANSACTION"];
if (ex)
[self errorWithFormat:@"could not commit transaction for update: %@", ex];
else
rc = YES;
rc = YES;
}
else
rc = YES;
defFlags.modified = NO;
defFlags.isNew = NO;
@@ -305,6 +292,22 @@ static NSString *uidColumnName = @"c_uid";
else
[self errorWithFormat: @"failed to generate SQL for storing defaults"];
if (rc)
{
NSMutableDictionary *d;
d = [[NSMutableDictionary alloc] init];
[d setObject: values forKey: @"values"];
[d setObject: uid forKey: @"uid"];
[[NSDistributedNotificationCenter defaultCenter]
postNotificationName: ([fieldName isEqualToString: @"c_defaults"] ? @"SOGoUserDefaultsHaveChanged" : @"SOGoUserSettingsHaveChanged")
object: nil
userInfo: d
deliverImmediately: YES];
[d release];
}
return rc;
}

View File

@@ -203,7 +203,14 @@
[otherAttendee addAttribute: @"SENT-BY"
value: [NSString stringWithFormat: @"\"MAILTO:%@\"", currentEmail]];
}
else
{
// We must REMOVE any SENT-BY here. This is important since if A accepted
// the event for B and then, B changes by himself his participation status,
// we don't want to keep the previous SENT-BY attribute there.
[(NSMutableDictionary *)[otherAttendee attributes] removeObjectForKey: @"SENT-BY"];
}
iCalString = [[event parent] versitString];
[eventObject saveContentString: iCalString];
}