diff --git a/ActiveSync/NGVCard+ActiveSync.h b/ActiveSync/NGVCard+ActiveSync.h
index 18bcb1fc8..8c3d5d08a 100644
--- a/ActiveSync/NGVCard+ActiveSync.h
+++ b/ActiveSync/NGVCard+ActiveSync.h
@@ -34,11 +34,13 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@class NSDictionary;
@class NSString;
+@class WOContext;
@interface NGVCard (ActiveSync)
-- (NSString *) activeSyncRepresentation;
-- (void) takeActiveSyncValues: (NSDictionary *) theValues;
+- (NSString *) activeSyncRepresentationInContext: (WOContext *) context;
+- (void) takeActiveSyncValues: (NSDictionary *) theValues
+ inContext: (WOContext *) context;
@end
diff --git a/ActiveSync/NGVCard+ActiveSync.m b/ActiveSync/NGVCard+ActiveSync.m
index 5da482d02..8c9a421a0 100644
--- a/ActiveSync/NGVCard+ActiveSync.m
+++ b/ActiveSync/NGVCard+ActiveSync.m
@@ -45,7 +45,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@implementation NGVCard (ActiveSync)
-- (NSString *) activeSyncRepresentation
+- (NSString *) activeSyncRepresentationInContext: (WOContext *) context
{
CardElement *n, *homeAdr, *workAdr;
NSArray *emails, *addresses;
@@ -58,16 +58,16 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
n = [self n];
if ((o = [n flattenedValueAtIndex: 0 forKey: @""]))
- [s appendFormat: @"%@", [o activeSyncRepresentation]];
+ [s appendFormat: @"%@", [o activeSyncRepresentationInContext: context]];
if ((o = [n flattenedValueAtIndex: 1 forKey: @""]))
- [s appendFormat: @"%@", [o activeSyncRepresentation]];
+ [s appendFormat: @"%@", [o activeSyncRepresentationInContext: context]];
if ((o = [self workCompany]))
- [s appendFormat: @"%@", [o activeSyncRepresentation]];
+ [s appendFormat: @"%@", [o activeSyncRepresentationInContext: context]];
if ((o = [self title]))
- [s appendFormat: @"%@", [o activeSyncRepresentation]];
+ [s appendFormat: @"%@", [o activeSyncRepresentationInContext: context]];
if ((o = [self preferredEMail]))
[s appendFormat: @"%@", o];
@@ -88,19 +88,19 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// Telephone numbers
if ((o = [self workPhone]) && [o length])
- [s appendFormat: @"%@", [o activeSyncRepresentation]];
+ [s appendFormat: @"%@", [o activeSyncRepresentationInContext: context]];
if ((o = [self homePhone]) && [o length])
- [s appendFormat: @"%@", [o activeSyncRepresentation]];
+ [s appendFormat: @"%@", [o activeSyncRepresentationInContext: context]];
if ((o = [self fax]) && [o length])
- [s appendFormat: @"%@", [o activeSyncRepresentation]];
+ [s appendFormat: @"%@", [o activeSyncRepresentationInContext: context]];
if ((o = [self mobile]) && [o length])
- [s appendFormat: @"%@", [o activeSyncRepresentation]];
+ [s appendFormat: @"%@", [o activeSyncRepresentationInContext: context]];
if ((o = [self pager]) && [o length])
- [s appendFormat: @"%@", [o activeSyncRepresentation]];
+ [s appendFormat: @"%@", [o activeSyncRepresentationInContext: context]];
// Home Address
addresses = [self childrenWithTag: @"adr"
@@ -112,19 +112,19 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
homeAdr = [addresses objectAtIndex: 0];
if ((o = [homeAdr flattenedValueAtIndex: 2 forKey: @""]))
- [s appendFormat: @"%@", [o activeSyncRepresentation]];
+ [s appendFormat: @"%@", [o activeSyncRepresentationInContext: context]];
if ((o = [homeAdr flattenedValueAtIndex: 3 forKey: @""]))
- [s appendFormat: @"%@", [o activeSyncRepresentation]];
+ [s appendFormat: @"%@", [o activeSyncRepresentationInContext: context]];
if ((o = [homeAdr flattenedValueAtIndex: 4 forKey: @""]))
- [s appendFormat: @"%@", [o activeSyncRepresentation]];
+ [s appendFormat: @"%@", [o activeSyncRepresentationInContext: context]];
if ((o = [homeAdr flattenedValueAtIndex: 5 forKey: @""]))
- [s appendFormat: @"%@", [o activeSyncRepresentation]];
+ [s appendFormat: @"%@", [o activeSyncRepresentationInContext: context]];
if ((o = [homeAdr flattenedValueAtIndex: 6 forKey: @""]))
- [s appendFormat: @"%@", [o activeSyncRepresentation]];
+ [s appendFormat: @"%@", [o activeSyncRepresentationInContext: context]];
}
// Work Address
@@ -137,28 +137,28 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
workAdr = [addresses objectAtIndex: 0];
if ((o = [workAdr flattenedValueAtIndex: 2 forKey: @""]))
- [s appendFormat: @"%@", [o activeSyncRepresentation]];
+ [s appendFormat: @"%@", [o activeSyncRepresentationInContext: context]];
if ((o = [workAdr flattenedValueAtIndex: 3 forKey: @""]))
- [s appendFormat: @"%@", [o activeSyncRepresentation]];
+ [s appendFormat: @"%@", [o activeSyncRepresentationInContext: context]];
if ((o = [workAdr flattenedValueAtIndex: 4 forKey: @""]))
- [s appendFormat: @"%@", [o activeSyncRepresentation]];
+ [s appendFormat: @"%@", [o activeSyncRepresentationInContext: context]];
if ((o = [workAdr flattenedValueAtIndex: 5 forKey: @""]))
- [s appendFormat: @"%@", [o activeSyncRepresentation]];
+ [s appendFormat: @"%@", [o activeSyncRepresentationInContext: context]];
if ((o = [workAdr flattenedValueAtIndex: 6 forKey: @""]))
- [s appendFormat: @"%@", [o activeSyncRepresentation]];
+ [s appendFormat: @"%@", [o activeSyncRepresentationInContext: context]];
}
// Other, less important fields
if ((o = [self birthday]))
- [s appendFormat: @"%@", [o activeSyncRepresentationWithoutSeparators]];
+ [s appendFormat: @"%@", [o activeSyncRepresentationWithoutSeparatorsInContext: context]];
if ((o = [self note]))
{
- o = [o activeSyncRepresentation];
+ o = [o activeSyncRepresentationInContext: context];
[s appendString: @"
"];
[s appendFormat: @"%d", 1];
[s appendFormat: @"%d", [o length]];
@@ -174,6 +174,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
//
- (void) takeActiveSyncValues: (NSDictionary *) theValues
+ inContext: (WOContext *) context
{
CardElement *element;
id o;
diff --git a/ActiveSync/NSData+ActiveSync.h b/ActiveSync/NSData+ActiveSync.h
index fe7cd2f32..b0a994886 100644
--- a/ActiveSync/NSData+ActiveSync.h
+++ b/ActiveSync/NSData+ActiveSync.h
@@ -33,10 +33,11 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#import
@class NSString;
+@class WOContext;
@interface NSData (ActiveSync)
-- (NSString *) activeSyncRepresentation;
+- (NSString *) activeSyncRepresentationInContext: (WOContext *) context;
- (NSData *) wbxml2xml;
- (NSData *) xml2wbxml;
diff --git a/ActiveSync/NSData+ActiveSync.m b/ActiveSync/NSData+ActiveSync.m
index cf0a2fe40..abd91995a 100644
--- a/ActiveSync/NSData+ActiveSync.m
+++ b/ActiveSync/NSData+ActiveSync.m
@@ -54,7 +54,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Encodes the data in base64 and strip newline characters
//
-- (NSString *) activeSyncRepresentation
+- (NSString *) activeSyncRepresentationInContext: (WOContext *) context
{
return [[self stringByEncodingBase64] stringByReplacingString: @"\n" withString: @""];
}
diff --git a/ActiveSync/NSDate+ActiveSync.h b/ActiveSync/NSDate+ActiveSync.h
index dced4de94..49b6a94fe 100644
--- a/ActiveSync/NSDate+ActiveSync.h
+++ b/ActiveSync/NSDate+ActiveSync.h
@@ -33,11 +33,12 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#import
@class NSString;
+@class WOContext;
@interface NSDate (ActiveSync)
-- (NSString *) activeSyncRepresentation;
-- (NSString *) activeSyncRepresentationWithoutSeparators;
+- (NSString *) activeSyncRepresentationInContext: (WOContext *) context;
+- (NSString *) activeSyncRepresentationWithoutSeparatorsInContext: (WOContext *) context;
@end
diff --git a/ActiveSync/NSDate+ActiveSync.m b/ActiveSync/NSDate+ActiveSync.m
index 05a0df1a3..ed3e98b3a 100644
--- a/ActiveSync/NSDate+ActiveSync.m
+++ b/ActiveSync/NSDate+ActiveSync.m
@@ -34,7 +34,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@implementation NSDate (ActiveSync)
-- (NSString *) activeSyncRepresentation
+- (NSString *) activeSyncRepresentationInContext: (WOContext *) context
{
return [self descriptionWithCalendarFormat: @"%Y-%m-%d-T%H:%M:%S.%FZ" timeZone: [NSTimeZone timeZoneWithName: @"GMT"] locale: nil];
}
@@ -43,7 +43,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// From [MS-ASDTYPE].pdf - section 2.3 "Dates and times in calendar items MUST NOT include punctuation separators."
//
-- (NSString *) activeSyncRepresentationWithoutSeparators
+- (NSString *) activeSyncRepresentationWithoutSeparatorsInContext: (WOContext *) context
{
return [self descriptionWithCalendarFormat: @"%Y%m%dT%H%M%SZ" timeZone: [NSTimeZone timeZoneWithName: @"GMT"] locale: nil];
}
diff --git a/ActiveSync/NSString+ActiveSync.h b/ActiveSync/NSString+ActiveSync.h
index 71e3969fc..6f0433de0 100644
--- a/ActiveSync/NSString+ActiveSync.h
+++ b/ActiveSync/NSString+ActiveSync.h
@@ -36,11 +36,12 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@class NSCalendarDate;
@class NSData;
+@class WOContext;
@interface NSString (ActiveSync)
- (NSString *) sanitizedServerIdWithType: (SOGoMicrosoftActiveSyncFolderType) folderType;
-- (NSString *) activeSyncRepresentation;
+- (NSString *) activeSyncRepresentationInContext: (WOContext *) context;
- (int) activeSyncFolderType;
- (NSString *) realCollectionIdWithFolderType: (SOGoMicrosoftActiveSyncFolderType *) folderType;
- (NSCalendarDate *) calendarDate;
diff --git a/ActiveSync/NSString+ActiveSync.m b/ActiveSync/NSString+ActiveSync.m
index ebacc2100..8b09c75ad 100644
--- a/ActiveSync/NSString+ActiveSync.m
+++ b/ActiveSync/NSString+ActiveSync.m
@@ -57,7 +57,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
return self;
}
-- (NSString *) activeSyncRepresentation
+- (NSString *) activeSyncRepresentationInContext: (WOContext *) context
{
NSString *s;
diff --git a/ActiveSync/SOGoActiveSyncDispatcher+Sync.m b/ActiveSync/SOGoActiveSyncDispatcher+Sync.m
index 060a6ee8c..2894c5cf6 100644
--- a/ActiveSync/SOGoActiveSyncDispatcher+Sync.m
+++ b/ActiveSync/SOGoActiveSyncDispatcher+Sync.m
@@ -192,9 +192,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
serverId = [allValues objectForKey: @"UID"];
else
serverId = [theCollection globallyUniqueObjectId];
-
- [allValues setObject: [[[context activeUser] userDefaults] timeZone] forKey: @"SOGoUserTimeZone"];
-
+
sogoObject = [theCollection lookupName: [serverId sanitizedServerIdWithType: theFolderType]
inContext: context
acquire: NO];
@@ -218,7 +216,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
serverId = [NSString stringWithFormat: @"%@.ics", [theCollection globallyUniqueObjectId]];
sogoObject = [[SOGoTaskObject alloc] initWithName: serverId
inContainer: theCollection];
- [allValues setObject: [[[context activeUser] userDefaults] timeZone] forKey: @"SOGoUserTimeZone"];
o = [sogoObject component: YES secure: NO];
}
break;
@@ -232,7 +229,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
}
}
- [o takeActiveSyncValues: allValues];
+ [o takeActiveSyncValues: allValues inContext: context];
[sogoObject setIsNew: is_new];
[sogoObject saveComponent: o];
@@ -322,7 +319,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
case ActiveSyncContactFolder:
{
o = [sogoObject vCard];
- [o takeActiveSyncValues: allChanges];
+ [o takeActiveSyncValues: allChanges inContext: context];
[sogoObject saveComponent: o];
}
break;
@@ -330,14 +327,14 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
case ActiveSyncTaskFolder:
{
o = [sogoObject component: NO secure: NO];
- [o takeActiveSyncValues: allChanges];
+ [o takeActiveSyncValues: allChanges inContext: context];
[sogoObject saveComponent: o];
}
break;
case ActiveSyncMailFolder:
default:
{
- [sogoObject takeActiveSyncValues: allChanges];
+ [sogoObject takeActiveSyncValues: allChanges inContext: context];
}
}
@@ -425,7 +422,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
[theBuffer appendFormat: @"%@", serverId];
[theBuffer appendFormat: @"%d", 1];
[theBuffer appendString: @""];
- [theBuffer appendString: [o activeSyncRepresentation]];
+ [theBuffer appendString: [o activeSyncRepresentationInContext: context]];
[theBuffer appendString: @""];
[theBuffer appendString: @""];
}
@@ -559,7 +556,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
[s appendFormat: @"%@", uid];
[s appendString: @""];
- [s appendString: [componentObject activeSyncRepresentation]];
+ [s appendString: [componentObject activeSyncRepresentationInContext: context]];
[s appendString: @""];
@@ -618,7 +615,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
[s appendFormat: @"%@", uid];
[s appendString: @""];
- [s appendString: [mailObject activeSyncRepresentation]];
+ [s appendString: [mailObject activeSyncRepresentationInContext: context]];
[s appendString: @""];
if ([command isEqualToString: @"added"])
diff --git a/ActiveSync/SOGoActiveSyncDispatcher.m b/ActiveSync/SOGoActiveSyncDispatcher.m
index 991ff1327..efb201367 100644
--- a/ActiveSync/SOGoActiveSyncDispatcher.m
+++ b/ActiveSync/SOGoActiveSyncDispatcher.m
@@ -510,26 +510,26 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
[serverId stringByEscapingURL],
[parentId stringByEscapingURL],
type,
- [name activeSyncRepresentation]];
+ [name activeSyncRepresentationInContext: context]];
}
// We add the personal calendar - events
// FIXME: add all calendars
currentFolder = [[context activeUser] personalCalendarFolderInContext: context];
name = [NSString stringWithFormat: @"vevent/%@", [currentFolder nameInContainer]];
- [s appendFormat: @"%@%@%d%@", name, @"0", 8, [[currentFolder displayName] activeSyncRepresentation]];
+ [s appendFormat: @"%@%@%d%@", name, @"0", 8, [[currentFolder displayName] activeSyncRepresentationInContext: context]];
// We add the personal calendar - tasks
// FIXME: add all calendars
currentFolder = [[context activeUser] personalCalendarFolderInContext: context];
name = [NSString stringWithFormat: @"vtodo/%@", [currentFolder nameInContainer]];
- [s appendFormat: @"%@%@%d%@", name, @"0", 7, [[currentFolder displayName] activeSyncRepresentation]];
+ [s appendFormat: @"%@%@%d%@", name, @"0", 7, [[currentFolder displayName] activeSyncRepresentationInContext: context]];
// We add the personal address book
// FIXME: add all address books
currentFolder = [[context activeUser] personalContactsFolderInContext: context];
name = [NSString stringWithFormat: @"vcard/%@", [currentFolder nameInContainer]];
- [s appendFormat: @"%@%@%d%@", name, @"0", 9, [[currentFolder displayName] activeSyncRepresentation]];
+ [s appendFormat: @"%@%@%d%@", name, @"0", 9, [[currentFolder displayName] activeSyncRepresentationInContext: context]];
}
[s appendString: @""];
@@ -702,7 +702,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
[s appendString: @""];
[s appendFormat: @"%@/%@", [[currentBodyPart partInfo] objectForKey: @"type"], [[currentBodyPart partInfo] objectForKey: @"subtype"]];
- [s appendFormat: @"%@", [[currentBodyPart fetchBLOB] activeSyncRepresentation]];
+ [s appendFormat: @"%@", [[currentBodyPart fetchBLOB] activeSyncRepresentationInContext: context]];
[s appendString: @""];
[s appendString: @""];
diff --git a/ActiveSync/SOGoMailObject+ActiveSync.h b/ActiveSync/SOGoMailObject+ActiveSync.h
index 4f7d751dc..44ceec168 100644
--- a/ActiveSync/SOGoMailObject+ActiveSync.h
+++ b/ActiveSync/SOGoMailObject+ActiveSync.h
@@ -34,12 +34,14 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@class iCalCalendar;
@class NSDictionary;
+@class WOContext;
@interface SOGoMailObject (ActiveSync)
- (iCalCalendar *) calendarFromIMIPMessage;
-- (NSString *) activeSyncRepresentation;
-- (void) takeActiveSyncValues: (NSDictionary *) theValues;
+- (NSString *) activeSyncRepresentationInContext: (WOContext *) context;
+- (void) takeActiveSyncValues: (NSDictionary *) theValues
+ inContext: (WOContext *) context;
@end
diff --git a/ActiveSync/SOGoMailObject+ActiveSync.m b/ActiveSync/SOGoMailObject+ActiveSync.m
index aaed77ea5..8043b28a0 100644
--- a/ActiveSync/SOGoMailObject+ActiveSync.m
+++ b/ActiveSync/SOGoMailObject+ActiveSync.m
@@ -342,7 +342,7 @@ struct GlobalObjectId {
//
//
//
-- (NSString *) activeSyncRepresentation
+- (NSString *) activeSyncRepresentationInContext: (WOContext *) _context
{
NSData *d, *globalObjId;
NSMutableString *s;
@@ -358,25 +358,25 @@ struct GlobalObjectId {
// If there are multiple e-mail addresses, they are separated by commas."
value = [self _emailAddressesFrom: [[self envelope] to]];
if (value)
- [s appendFormat: @"%@", [value activeSyncRepresentation]];
+ [s appendFormat: @"%@", [value activeSyncRepresentationInContext: context]];
// From
value = [self _emailAddressesFrom: [[self envelope] from]];
if (value)
- [s appendFormat: @"%@", [value activeSyncRepresentation]];
+ [s appendFormat: @"%@", [value activeSyncRepresentationInContext: context]];
// Subject
value = [self decodedSubject];
if (value)
{
- [s appendFormat: @"%@", [value activeSyncRepresentation]];
- [s appendFormat: @"%@", [value activeSyncRepresentation]];
+ [s appendFormat: @"%@", [value activeSyncRepresentationInContext: context]];
+ [s appendFormat: @"%@", [value activeSyncRepresentationInContext: context]];
}
// DateReceived
value = [self date];
if (value)
- [s appendFormat: @"%@", [value activeSyncRepresentationWithoutSeparators]];
+ [s appendFormat: @"%@", [value activeSyncRepresentationWithoutSeparatorsInContext: context]];
// DisplayTo
[s appendFormat: @"%@", [[context activeUser] login]];
@@ -384,7 +384,7 @@ struct GlobalObjectId {
// Cc - same syntax as the To field
value = [self _emailAddressesFrom: [[self envelope] cc]];
if (value)
- [s appendFormat: @"%@", [value activeSyncRepresentation]];
+ [s appendFormat: @"%@", [value activeSyncRepresentationInContext: context]];
// Importance - FIXME
[s appendFormat: @"%@", @"1"];
@@ -447,24 +447,24 @@ struct GlobalObjectId {
// StartTime -- http://msdn.microsoft.com/en-us/library/ee157132(v=exchg.80).aspx
if ([event startDate])
- [s appendFormat: @"%@", [[event startDate] activeSyncRepresentationWithoutSeparators]];
+ [s appendFormat: @"%@", [[event startDate] activeSyncRepresentationWithoutSeparatorsInContext: context]];
if ([event timeStampAsDate])
- [s appendFormat: @"%@", [[event timeStampAsDate] activeSyncRepresentationWithoutSeparators]];
+ [s appendFormat: @"%@", [[event timeStampAsDate] activeSyncRepresentationWithoutSeparatorsInContext: context]];
else if ([event created])
- [s appendFormat: @"%@", [[event created] activeSyncRepresentationWithoutSeparators]];
+ [s appendFormat: @"%@", [[event created] activeSyncRepresentationWithoutSeparatorsInContext: context]];
// EndTime -- http://msdn.microsoft.com/en-us/library/ee157945(v=exchg.80).aspx
if ([event endDate])
- [s appendFormat: @"%@", [[event endDate] activeSyncRepresentationWithoutSeparators]];
+ [s appendFormat: @"%@", [[event endDate] activeSyncRepresentationWithoutSeparatorsInContext: context]];
[s appendFormat: @"%d", 0];
// Location
if ([[event location] length])
- [s appendFormat: @"%@", [[event location] activeSyncRepresentation]];
+ [s appendFormat: @"%@", [[event location] activeSyncRepresentationInContext: context]];
- [s appendFormat: @"%@", [[[event organizer] mailAddress] activeSyncRepresentation]];
+ [s appendFormat: @"%@", [[[event organizer] mailAddress] activeSyncRepresentationInContext: context]];
// This will trigger the SendMail command. We set it to no for email invitations as
// SOGo will send emails when MeetingResponse is called.
@@ -488,7 +488,7 @@ struct GlobalObjectId {
if (!tz)
tz = [iCalTimeZone timeZoneForName: @"Europe/London"];
- [s appendFormat: @"%@", [tz activeSyncRepresentation]];
+ [s appendFormat: @"%@", [tz activeSyncRepresentationInContext: context]];
// We disallow new time proposals
@@ -500,7 +500,7 @@ struct GlobalObjectId {
// object in the Calendar folder have to convert the GlobalObjId element value to a UID element value to make the comparison."
//
globalObjId = [self _computeGlobalObjectIdFromEvent: event];
- [s appendFormat: @"%@", [globalObjId activeSyncRepresentation]];
+ [s appendFormat: @"%@", [globalObjId activeSyncRepresentationInContext: context]];
// We set the right message type - we must set AS version to 14.1 for this
[s appendFormat: @"%d", 1];
@@ -545,7 +545,7 @@ struct GlobalObjectId {
AUTORELEASE(content);
- content = [content activeSyncRepresentation];
+ content = [content activeSyncRepresentationInContext: context];
truncated = 0;
len = [content length];
@@ -572,7 +572,7 @@ struct GlobalObjectId {
value = [attachmentKeys objectAtIndex: i];
[s appendString: @""];
- [s appendFormat: @"%@", [[value objectForKey: @"filename"] activeSyncRepresentation]];
+ [s appendFormat: @"%@", [[value objectForKey: @"filename"] activeSyncRepresentationInContext: context]];
// FileReference must be a unique identifier across the whole store. We use the following structure:
// mail//
@@ -612,6 +612,7 @@ struct GlobalObjectId {
//
//
- (void) takeActiveSyncValues: (NSDictionary *) theValues
+ inContext: (WOContext *) _context
{
id o;
diff --git a/ActiveSync/iCalEvent+ActiveSync.h b/ActiveSync/iCalEvent+ActiveSync.h
index 3a22eee21..90fa92cd5 100644
--- a/ActiveSync/iCalEvent+ActiveSync.h
+++ b/ActiveSync/iCalEvent+ActiveSync.h
@@ -34,11 +34,13 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#import
@class NSString;
+@class WOContext;
@interface iCalEvent (ActiveSync)
-- (NSString *) activeSyncRepresentation;
-- (void) takeActiveSyncValues: (NSDictionary *) theValues;
+- (NSString *) activeSyncRepresentationInContext: (WOContext *) context;
+- (void) takeActiveSyncValues: (NSDictionary *) theValues
+ inContext: (WOContext *) context;
@end
diff --git a/ActiveSync/iCalEvent+ActiveSync.m b/ActiveSync/iCalEvent+ActiveSync.m
index fbe6c564a..68ce307e6 100644
--- a/ActiveSync/iCalEvent+ActiveSync.m
+++ b/ActiveSync/iCalEvent+ActiveSync.m
@@ -38,11 +38,16 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#import
#import
+#import
+#import
#import
#import
#import
+#import
+#import
+
#include "iCalRecurrenceRule+ActiveSync.h"
#include "iCalTimeZone+ActiveSync.h"
#include "NSDate+ActiveSync.h"
@@ -50,7 +55,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@implementation iCalEvent (ActiveSync)
-- (NSString *) activeSyncRepresentation
+- (NSString *) activeSyncRepresentationInContext: (WOContext *) context
{
NSMutableString *s;
NSArray *attendees;
@@ -67,17 +72,17 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// DTStamp -- http://msdn.microsoft.com/en-us/library/ee219470(v=exchg.80).aspx
if ([self timeStampAsDate])
- [s appendFormat: @"%@", [[self timeStampAsDate] activeSyncRepresentationWithoutSeparators]];
+ [s appendFormat: @"%@", [[self timeStampAsDate] activeSyncRepresentationWithoutSeparatorsInContext: context]];
else if ([self created])
- [s appendFormat: @"%@", [[self created] activeSyncRepresentationWithoutSeparators]];
+ [s appendFormat: @"%@", [[self created] activeSyncRepresentationWithoutSeparatorsInContext: context]];
// StartTime -- http://msdn.microsoft.com/en-us/library/ee157132(v=exchg.80).aspx
if ([self startDate])
- [s appendFormat: @"%@", [[self startDate] activeSyncRepresentationWithoutSeparators]];
+ [s appendFormat: @"%@", [[self startDate] activeSyncRepresentationWithoutSeparatorsInContext: context]];
// EndTime -- http://msdn.microsoft.com/en-us/library/ee157945(v=exchg.80).aspx
if ([self endDate])
- [s appendFormat: @"%@", [[self endDate] activeSyncRepresentationWithoutSeparators]];
+ [s appendFormat: @"%@", [[self endDate] activeSyncRepresentationWithoutSeparatorsInContext: context]];
// Timezone
tz = [(iCalDateTime *)[self firstChildWithTag: @"dtstart"] timeZone];
@@ -85,7 +90,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
if (!tz)
tz = [iCalTimeZone timeZoneForName: @"Europe/London"];
- [s appendFormat: @"%@", [tz activeSyncRepresentation]];
+ [s appendFormat: @"%@", [tz activeSyncRepresentationInContext: context]];
// Organizer and other invitations related properties
if ((organizer = [self organizer]))
@@ -153,11 +158,11 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// Subject -- http://msdn.microsoft.com/en-us/library/ee157192(v=exchg.80).aspx
if ([[self summary] length])
- [s appendFormat: @"%@", [[self summary] activeSyncRepresentation]];
+ [s appendFormat: @"%@", [[self summary] activeSyncRepresentationInContext: context]];
// Location
if ([[self location] length])
- [s appendFormat: @"%@", [[self location] activeSyncRepresentation]];
+ [s appendFormat: @"%@", [[self location] activeSyncRepresentationInContext: context]];
// Importance - NOT SUPPORTED - DO NOT ENABLE
//o = [self priority];
@@ -189,14 +194,14 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// Recurrence rules
if ([self isRecurrent])
{
- [s appendString: [[[self recurrenceRules] lastObject] activeSyncRepresentation]];
+ [s appendString: [[[self recurrenceRules] lastObject] activeSyncRepresentationInContext: context]];
}
// Comment
o = [self comment];
if ([o length])
{
- o = [o activeSyncRepresentation];
+ o = [o activeSyncRepresentationInContext: context];
[s appendString: @""];
[s appendFormat: @"%d", 1];
[s appendFormat: @"%d", [o length]];
@@ -249,6 +254,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
//
- (void) takeActiveSyncValues: (NSDictionary *) theValues
+ inContext: (WOContext *) context
{
iCalDateTime *start, *end;
NSTimeZone *userTimeZone;
@@ -310,7 +316,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
if ((o = [theValues objectForKey: @"TimeZone"]))
{
// Ugh, we ignore it for now.
- userTimeZone = [theValues objectForKey: @"SOGoUserTimeZone"];
+ userTimeZone = [[[context activeUser] userDefaults] timeZone];
tz = [iCalTimeZone timeZoneForName: [userTimeZone name]];
[(iCalCalendar *) parent addTimeZone: tz];
}
@@ -373,7 +379,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
[self setRecurrenceRules: [NSArray arrayWithObject: rule]];
RELEASE(rule);
- [rule takeActiveSyncValues: o];
+ [rule takeActiveSyncValues: o inContext: context];
}
// Organizer
diff --git a/ActiveSync/iCalRecurrenceRule+ActiveSync.h b/ActiveSync/iCalRecurrenceRule+ActiveSync.h
index ab19964ac..1de1a5316 100644
--- a/ActiveSync/iCalRecurrenceRule+ActiveSync.h
+++ b/ActiveSync/iCalRecurrenceRule+ActiveSync.h
@@ -35,11 +35,13 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@class NSDictionary;
@class NSString;
+@class WOContext;
@interface iCalRecurrenceRule (ActiveSync)
-- (NSString *) activeSyncRepresentation;
-- (void) takeActiveSyncValues: (NSDictionary *) theValues;
+- (NSString *) activeSyncRepresentationInContext:(WOContext *) context;
+- (void) takeActiveSyncValues: (NSDictionary *) theValues
+ inContext: (WOContext *) context;
@end
diff --git a/ActiveSync/iCalRecurrenceRule+ActiveSync.m b/ActiveSync/iCalRecurrenceRule+ActiveSync.m
index 002a9d0cb..18bdf595c 100644
--- a/ActiveSync/iCalRecurrenceRule+ActiveSync.m
+++ b/ActiveSync/iCalRecurrenceRule+ActiveSync.m
@@ -41,7 +41,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@implementation iCalRecurrenceRule (ActiveSync)
-- (NSString *) activeSyncRepresentation
+- (NSString *) activeSyncRepresentationInContext: (WOContext *) context
{
NSMutableString *s;
int type;
@@ -180,7 +180,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//[date setTimeZone: [ud timeZone]];
[s appendFormat: @"%@",
- [date activeSyncRepresentationWithoutSeparators]];
+ [date activeSyncRepresentationWithoutSeparatorsInContext: context]];
}
@@ -242,6 +242,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
//
- (void) takeActiveSyncValues: (NSDictionary *) theValues
+ inContext: (WOContext *) context
{
id o;
diff --git a/ActiveSync/iCalTimeZone+ActiveSync.h b/ActiveSync/iCalTimeZone+ActiveSync.h
index 3652a1dbe..6e3de3856 100644
--- a/ActiveSync/iCalTimeZone+ActiveSync.h
+++ b/ActiveSync/iCalTimeZone+ActiveSync.h
@@ -33,10 +33,11 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#import
@class NSString;
+@class WOContext;
@interface iCalTimeZone (ActiveSync)
-- (NSString *) activeSyncRepresentation;
+- (NSString *) activeSyncRepresentationInContext: (WOContext *) context;
@end
diff --git a/ActiveSync/iCalTimeZone+ActiveSync.m b/ActiveSync/iCalTimeZone+ActiveSync.m
index c14b32342..0670acc11 100644
--- a/ActiveSync/iCalTimeZone+ActiveSync.m
+++ b/ActiveSync/iCalTimeZone+ActiveSync.m
@@ -115,7 +115,7 @@ struct SYSTEMTIME {
}
-- (NSString *) activeSyncRepresentation
+- (NSString *) activeSyncRepresentationInContext: (WOContext *) context
{
iCalTimeZonePeriod *period;
NSMutableData *bytes;
@@ -159,7 +159,7 @@ struct SYSTEMTIME {
[bytes appendBytes: &stDaylightDate length: 16];
[bytes appendBytes: &lDaylightBias length: 4];
- return [bytes activeSyncRepresentation];
+ return [bytes activeSyncRepresentationInContext: context];
}
@end
diff --git a/ActiveSync/iCalToDo+ActiveSync.h b/ActiveSync/iCalToDo+ActiveSync.h
index f77d75372..933f26eb7 100644
--- a/ActiveSync/iCalToDo+ActiveSync.h
+++ b/ActiveSync/iCalToDo+ActiveSync.h
@@ -33,11 +33,13 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#import
@class NSString;
+@class WOContext;
@interface iCalToDo (ActiveSync)
-- (NSString *) activeSyncRepresentation;
-- (void) takeActiveSyncValues: (NSDictionary *) theValues;
+- (NSString *) activeSyncRepresentationInContext: (WOContext *) context;
+- (void) takeActiveSyncValues: (NSDictionary *) theValues
+ inContext: (WOContext *) context;
@end
diff --git a/ActiveSync/iCalToDo+ActiveSync.m b/ActiveSync/iCalToDo+ActiveSync.m
index b458d3006..d09fda688 100644
--- a/ActiveSync/iCalToDo+ActiveSync.m
+++ b/ActiveSync/iCalToDo+ActiveSync.m
@@ -36,6 +36,11 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#import
#import
+#import
+#import
+
+#import
+#import
#import
#import
@@ -46,7 +51,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@implementation iCalToDo (ActiveSync)
-- (NSString *) activeSyncRepresentation
+- (NSString *) activeSyncRepresentationInContext: (WOContext *) context
{
NSMutableString *s;
id o;
@@ -61,21 +66,21 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// DateCompleted
if (o)
- [s appendFormat: @"%@", [o activeSyncRepresentation]];
+ [s appendFormat: @"%@", [o activeSyncRepresentationInContext: context]];
// Start date
if ((o = [self startDate]))
{
- [s appendFormat: @"%@", [o activeSyncRepresentation]];
- [s appendFormat: @"%@", [o activeSyncRepresentation]];
+ [s appendFormat: @"%@", [o activeSyncRepresentationInContext: context]];
+ [s appendFormat: @"%@", [o activeSyncRepresentationInContext: context]];
}
// Due date
if ((o = [self due]))
{
- [s appendFormat: @"%@", [o activeSyncRepresentation]];
- [s appendFormat: @"%@", [o activeSyncRepresentation]];
+ [s appendFormat: @"%@", [o activeSyncRepresentationInContext: context]];
+ [s appendFormat: @"%@", [o activeSyncRepresentationInContext: context]];
}
// Importance
@@ -97,11 +102,11 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// Subject
o = [self summary];
if ([o length])
- [s appendFormat: @"%@", [[self summary] activeSyncRepresentation]];
+ [s appendFormat: @"%@", [[self summary] activeSyncRepresentationInContext: context]];
if ((o = [self comment]))
{
- o = [o activeSyncRepresentation];
+ o = [o activeSyncRepresentationInContext: context];
[s appendString: @""];
[s appendFormat: @"%d", 1];
[s appendFormat: @"%d", [o length]];
@@ -114,6 +119,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
}
- (void) takeActiveSyncValues: (NSDictionary *) theValues
+ inContext: (WOContext *) context
{
NSTimeZone *userTimeZone;
iCalTimeZone *tz;
@@ -121,7 +127,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
NSInteger tzOffset;
- userTimeZone = [theValues objectForKey: @"SOGoUserTimeZone"];
+ userTimeZone = [[[context activeUser] userDefaults] timeZone];
tz = [iCalTimeZone timeZoneForName: [userTimeZone name]];
[(iCalCalendar *) parent addTimeZone: tz];