mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-11-21 23:12:40 +00:00
merge of '5dde5ea96fd96485574abc6ba0f295b147b1ff16'
and '72cfb3dcfa19c247349b29d61b4878d418d4c13e' Monotone-Parent: 5dde5ea96fd96485574abc6ba0f295b147b1ff16 Monotone-Parent: 72cfb3dcfa19c247349b29d61b4878d418d4c13e Monotone-Revision: ab03ed37df567704b10ca118f26a816bdccc83e0 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2012-03-22T17:08:10 Monotone-Branch: ca.inverse.sogo
This commit is contained in:
commit
41297fd531
18 files changed
+227
-19
No files matched your search
@@ -4,8 +4,50 @@
|
||||
(_contentForEditingFromKeys:): prefer the HTML part over the text
|
||||
part when composing HTML messages.
|
||||
|
||||
2012-03-22 Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||
|
||||
* OpenChange/MAPIStoreTasksMessage.m (-save):
|
||||
PidLidPercentComplete is a double, that we need to convert in
|
||||
order to obtain the proper value.
|
||||
|
||||
2012-03-21 Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||
|
||||
* SoObjects/SOGo/SOGoUserManager.m (_compactAndCompleteContacts:):
|
||||
if "mail" is an array, all values are added to "c_emails".
|
||||
|
||||
* SoObjects/Contacts/SOGoContactSourceFolder.m
|
||||
(_flattenedRecord:): if "mail" is an array, we only take the first
|
||||
value of it.
|
||||
|
||||
* SoObjects/Contacts/SOGoContactLDIFEntry.m (-simplifiedRecord):
|
||||
new record guaranteeing that all array values have been stripped
|
||||
and converted to strings.
|
||||
|
||||
2012-03-20 Francis Lachapelle <flachapelle@inverse.ca>
|
||||
|
||||
* SoObjects/Mailer/SOGoMailObject+Draft.m
|
||||
(_contentForEditingFromKeys:): prefer the HTML part over the text
|
||||
part when composing HTML messages.
|
||||
|
||||
2012-03-20 Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||
|
||||
* SoObjects/SOGo/SOGoUserFolder.m (-davLastName, -davFirstName):
|
||||
quick and dirty implementation of those getters.
|
||||
|
||||
* OpenChange/MAPIStoreAppointmentWrapper.m (-_setupITIPContext):
|
||||
ensure method is uppercase.
|
||||
|
||||
* OpenChange/MAPIStoreCalendarMessage.m
|
||||
(-getPidLidAppointmentSequence:inMemCtx:): new getter.
|
||||
(-save): properly initialize CREATED, LAST-MODIFIED, DTSTAMP and
|
||||
SEQUENCE from MAPI properties.
|
||||
|
||||
* OpenChange/MAPIStoreAppointmentWrapper.m
|
||||
(-getPidLidAppointmentSequence:inMemCtx:): new getter.
|
||||
|
||||
* OpenChange/NSDate+MAPIStore.m (-isNever): new accessor for dates
|
||||
occurring in 4500.
|
||||
|
||||
* OpenChange/MAPIStoreTypes.m (MAPIChangeKeyGUIDCompare): NSData
|
||||
arguments passed as "id" due to the pickiness of some versions of
|
||||
gcc.
|
||||
|
||||
@@ -97,6 +97,8 @@ extern NSTimeZone *utcTZ;
|
||||
inMemCtx: (TALLOC_CTX *) memCtx;
|
||||
- (int) getPidTagStartDate: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) memCtx;
|
||||
- (int) getPidLidAppointmentSequence: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) memCtx;
|
||||
- (int) getPidLidAppointmentStateFlags: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) memCtx;
|
||||
- (int) getPidLidResponseStatus: (void **) data
|
||||
|
||||
@@ -162,6 +162,7 @@ static NSCharacterSet *hexCharacterSet = nil;
|
||||
method = [[event parent] method];
|
||||
if ([method length] > 0)
|
||||
{
|
||||
method = [method uppercaseString];
|
||||
[method retain];
|
||||
if ([method isEqualToString: @"REPLY"])
|
||||
{
|
||||
@@ -657,6 +658,14 @@ static NSCharacterSet *hexCharacterSet = nil;
|
||||
return MAPISTORE_SUCCESS;
|
||||
}
|
||||
|
||||
- (int) getPidLidAppointmentSequence: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) memCtx
|
||||
{
|
||||
*data = MAPILongValue (memCtx, [[event sequence] unsignedIntValue]);
|
||||
|
||||
return MAPISTORE_SUCCESS;
|
||||
}
|
||||
|
||||
- (int) getPidLidAppointmentStateFlags: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) memCtx
|
||||
{
|
||||
|
||||
@@ -166,6 +166,13 @@
|
||||
return [[self appointmentWrapper] getPidTagStartDate: data inMemCtx: memCtx];
|
||||
}
|
||||
|
||||
- (int) getPidLidAppointmentSequence: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) memCtx
|
||||
{
|
||||
return [[self appointmentWrapper] getPidLidAppointmentSequence: data
|
||||
inMemCtx: memCtx];
|
||||
}
|
||||
|
||||
- (int) getPidLidAppointmentStateFlags: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) memCtx
|
||||
{
|
||||
@@ -718,14 +725,28 @@
|
||||
vCalendar = [newEvent parent];
|
||||
[vCalendar setProdID: @"-//Inverse inc.//OpenChange+SOGo//EN"];
|
||||
[newEvent setCreated: now];
|
||||
// CREATED = PidTagCreationTime
|
||||
value = [properties objectForKey: MAPIPropertyKey (PidTagCreationTime)];
|
||||
if (value)
|
||||
[newEvent setCreated: value];
|
||||
[newEvent setUid: uid];
|
||||
content = [vCalendar versitString];
|
||||
}
|
||||
|
||||
vCalendar = [iCalCalendar parseSingleFromSource: content];
|
||||
newEvent = [[vCalendar events] objectAtIndex: 0];
|
||||
[newEvent setTimeStampAsDate: now];
|
||||
[newEvent setLastModified: now];
|
||||
|
||||
// DTSTAMP = PidLidOwnerCriticalChange or PidLidAttendeeCriticalChange
|
||||
value = [properties objectForKey: MAPIPropertyKey (PidLidOwnerCriticalChange)];
|
||||
if (!value || [value isNever])
|
||||
value = now;
|
||||
[newEvent setTimeStampAsDate: value];
|
||||
|
||||
// LAST-MODIFIED = PidTagLastModificationTime
|
||||
value = [properties objectForKey: MAPIPropertyKey (PidTagLastModificationTime)];
|
||||
if (!value)
|
||||
value = now;
|
||||
[newEvent setLastModified: value];
|
||||
|
||||
// summary
|
||||
value = [properties
|
||||
@@ -973,6 +994,11 @@
|
||||
[newEvent setOrganizer: nil];
|
||||
else
|
||||
{
|
||||
// SEQUENCE = PidLidAppointmentSequence
|
||||
value = [properties objectForKey: MAPIPropertyKey (PidLidAppointmentSequence)];
|
||||
if (value)
|
||||
[newEvent setSequence: value];
|
||||
|
||||
ownerUser = [[self userContext] sogoUser];
|
||||
if (organizerIsSet)
|
||||
{
|
||||
@@ -1009,7 +1035,10 @@
|
||||
}
|
||||
[person setParticipationStatus: newPartStat];
|
||||
newParticipationStatus = [person partStatWithDefault];
|
||||
|
||||
|
||||
value = [properties objectForKey: MAPIPropertyKey (PidLidAttendeeCriticalChange)];
|
||||
if (value && ![value isNever])
|
||||
[newEvent setTimeStampAsDate: value];
|
||||
// if (newPartStat // != iCalPersonPartStatUndefined
|
||||
// )
|
||||
// {
|
||||
|
||||
@@ -331,6 +331,7 @@
|
||||
NSString *status, *priority;
|
||||
NSCalendarDate *now;
|
||||
NSInteger tzOffset;
|
||||
double doubleValue;
|
||||
|
||||
vToDo = [sogoObject component: YES secure: NO];
|
||||
vCalendar = [vToDo parent];
|
||||
@@ -452,7 +453,11 @@
|
||||
// is always set to 0, no matter what value is set in Outlook
|
||||
value = [properties objectForKey: MAPIPropertyKey (PidLidPercentComplete)];
|
||||
if (value)
|
||||
[vToDo setPercentComplete: [value stringValue]];
|
||||
{
|
||||
doubleValue = [value doubleValue];
|
||||
[vToDo setPercentComplete:
|
||||
[NSString stringWithFormat: @"%d", (int) (doubleValue * 100)]];
|
||||
}
|
||||
|
||||
now = [NSCalendarDate date];
|
||||
if ([sogoObject isNew])
|
||||
|
||||
@@ -33,6 +33,8 @@
|
||||
+ (id) dateFromFileTime: (const struct FILETIME *) timeValue;
|
||||
- (struct FILETIME *) asFileTimeInMemCtx: (void *) memCtx;
|
||||
|
||||
- (BOOL) isNever; /* occurs on 4500-12-31 */
|
||||
|
||||
@end
|
||||
|
||||
#endif /* NSCALENDARDATE+MAPISTORE_H */
|
||||
@@ -114,4 +114,17 @@ _setupRefDate ()
|
||||
return timeValue;
|
||||
}
|
||||
|
||||
- (BOOL) isNever /* occurs on 4500-12-31 */
|
||||
{
|
||||
NSCalendarDate *calDate;
|
||||
|
||||
if ([self isKindOfClass: [NSCalendarDate class]])
|
||||
calDate = (NSCalendarDate *) self;
|
||||
else
|
||||
calDate = [NSCalendarDate dateWithTimeIntervalSince1970:
|
||||
[self timeIntervalSince1970]];
|
||||
|
||||
return [calDate yearOfCommonEra] == 4500;
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -38,14 +38,15 @@
|
||||
|
||||
@implementation NSObject (MAPIStoreTallocHelpers)
|
||||
|
||||
static int MAPIStoreTallocWrapperDestroy (void *data)
|
||||
static int
|
||||
MAPIStoreTallocWrapperDestroy (void *data)
|
||||
{
|
||||
struct MAPIStoreTallocWrapper *wrapper;
|
||||
NSAutoreleasePool *pool;
|
||||
|
||||
pool = [NSAutoreleasePool new];
|
||||
wrapper = data;
|
||||
NSLog (@"destroying wrapped object (wrapper: %p; object: %p)...\n", wrapper, wrapper->MAPIStoreSOGoObject);
|
||||
// NSLog (@"destroying wrapped object (wrapper: %p; object: %p)...\n", wrapper, wrapper->MAPIStoreSOGoObject);
|
||||
[wrapper->MAPIStoreSOGoObject release];
|
||||
[pool release];
|
||||
|
||||
@@ -57,10 +58,10 @@ static int MAPIStoreTallocWrapperDestroy (void *data)
|
||||
struct MAPIStoreTallocWrapper *wrapper;
|
||||
|
||||
wrapper = talloc_zero (tallocCtx, struct MAPIStoreTallocWrapper);
|
||||
wrapper->MAPIStoreSOGoObject = self;
|
||||
[wrapper->MAPIStoreSOGoObject retain];
|
||||
talloc_set_destructor ((void *) wrapper, MAPIStoreTallocWrapperDestroy);
|
||||
NSLog (@"returning wrapper: %p; object: %p", wrapper, self);
|
||||
wrapper->MAPIStoreSOGoObject = self;
|
||||
[self retain];
|
||||
// NSLog (@"returning wrapper: %p; object: %p", wrapper, self);
|
||||
|
||||
return wrapper;
|
||||
}
|
||||
|
||||
@@ -101,7 +101,9 @@
|
||||
|
||||
- (void) setMethod: (NSString *) _value
|
||||
{
|
||||
[[self uniqueChildWithTag: @"method"] setSingleValue: _value forKey: @""];
|
||||
[[self uniqueChildWithTag: @"method"]
|
||||
setSingleValue: [_value uppercaseString]
|
||||
forKey: @""];
|
||||
}
|
||||
|
||||
- (NSString *) method
|
||||
|
||||
@@ -76,6 +76,11 @@
|
||||
return [[self vCard] asLDIFRecord];
|
||||
}
|
||||
|
||||
- (NSDictionary *) simplifiedLDIFRecord
|
||||
{
|
||||
return [self ldifRecord];
|
||||
}
|
||||
|
||||
- (BOOL) hasPhoto
|
||||
{
|
||||
return ([[self vCard] firstChildWithTag: @"photo"] != nil);
|
||||
|
||||
@@ -95,7 +95,7 @@
|
||||
[vcard setProdID: [NSString
|
||||
stringWithFormat: @"-//Inverse inc./SOGo %@//EN",
|
||||
SOGoVersion]];
|
||||
[vcard updateFromLDIFRecord: [self ldifRecord]];
|
||||
[vcard updateFromLDIFRecord: [self simplifiedLDIFRecord]];
|
||||
|
||||
return vcard;
|
||||
}
|
||||
@@ -115,6 +115,37 @@
|
||||
return ldifEntry;
|
||||
}
|
||||
|
||||
- (NSDictionary *) simplifiedLDIFRecord
|
||||
{
|
||||
NSMutableDictionary *newRecord;
|
||||
NSArray *keys;
|
||||
NSUInteger count, max;
|
||||
NSString *key;
|
||||
id value;
|
||||
|
||||
newRecord = [[self ldifRecord] mutableCopy];
|
||||
[newRecord autorelease];
|
||||
|
||||
keys = [newRecord allKeys];
|
||||
max = [keys count];
|
||||
for (count = 0; count < max; count++)
|
||||
{
|
||||
key = [keys objectAtIndex: count];
|
||||
value = [newRecord objectForKey: key];
|
||||
if ([value isKindOfClass: [NSArray class]]
|
||||
&& ![key isEqualToString: @"objectclass"])
|
||||
{
|
||||
if ([value count] > 0)
|
||||
[newRecord setObject: [value objectAtIndex: 0]
|
||||
forKey: key];
|
||||
else
|
||||
[newRecord removeObjectForKey: key];
|
||||
}
|
||||
}
|
||||
|
||||
return newRecord;
|
||||
}
|
||||
|
||||
- (BOOL) hasPhoto
|
||||
{
|
||||
return NO;
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
/* web editing */
|
||||
- (void) setLDIFRecord: (NSDictionary *) newLDIFRecord;
|
||||
- (NSDictionary *) ldifRecord;
|
||||
- (NSDictionary *) simplifiedLDIFRecord;
|
||||
|
||||
- (NSException *) save;
|
||||
- (NSException *) delete;
|
||||
|
||||
@@ -213,7 +213,7 @@
|
||||
- (NSDictionary *) _flattenedRecord: (NSDictionary *) oldRecord
|
||||
{
|
||||
NSMutableDictionary *newRecord;
|
||||
NSString *data;
|
||||
id data;
|
||||
NSObject <SOGoSource> *recordSource;
|
||||
|
||||
newRecord = [NSMutableDictionary dictionaryWithCapacity: 8];
|
||||
@@ -232,6 +232,13 @@
|
||||
data = [oldRecord objectForKey: @"mail"];
|
||||
if (!data)
|
||||
data = @"";
|
||||
else if ([data isKindOfClass: [NSArray class]])
|
||||
{
|
||||
if ([data count] > 0)
|
||||
data = [data objectAtIndex: 0];
|
||||
else
|
||||
data = @"";
|
||||
}
|
||||
[newRecord setObject: data forKey: @"c_mail"];
|
||||
|
||||
data = [oldRecord objectForKey: @"nsaimid"];
|
||||
|
||||
@@ -635,6 +635,54 @@
|
||||
getCNForUID: nameInContainer];
|
||||
}
|
||||
|
||||
/* For firstname and lastname, we handle "Firstname Blabla Lastname" and
|
||||
"Lastname, Firstname Blabla" */
|
||||
- (NSString *) davLastName
|
||||
{
|
||||
NSArray *parts;
|
||||
NSString *cn, *lastName;
|
||||
NSRange comma;
|
||||
|
||||
cn = [self davDisplayName];
|
||||
comma = [cn rangeOfString: @","];
|
||||
if (comma.location != NSNotFound)
|
||||
lastName = [[cn substringToIndex: comma.location]
|
||||
stringByTrimmingSpaces];
|
||||
else
|
||||
{
|
||||
parts = [cn componentsSeparatedByString: @" "];
|
||||
if ([parts count] > 0)
|
||||
lastName = [parts lastObject];
|
||||
else
|
||||
lastName = nil;
|
||||
}
|
||||
|
||||
return lastName;
|
||||
}
|
||||
|
||||
- (NSString *) davFirstName
|
||||
{
|
||||
NSArray *parts;
|
||||
NSString *subtext, *cn, *firstName;
|
||||
NSRange comma;
|
||||
|
||||
cn = [self davDisplayName];
|
||||
comma = [cn rangeOfString: @","];
|
||||
if (comma.location != NSNotFound)
|
||||
subtext = [[cn substringFromIndex: comma.location]
|
||||
stringByTrimmingSpaces];
|
||||
else
|
||||
subtext = cn;
|
||||
|
||||
parts = [subtext componentsSeparatedByString: @" "];
|
||||
if ([parts count] > 0)
|
||||
firstName = [parts objectAtIndex: 0];
|
||||
else
|
||||
firstName = nil;
|
||||
|
||||
return firstName;
|
||||
}
|
||||
|
||||
- (NSString *) davResourceId
|
||||
{
|
||||
return [NSString stringWithFormat: @"urn:uuid:%@", nameInContainer];
|
||||
|
||||
@@ -816,11 +816,12 @@
|
||||
{
|
||||
NSMutableDictionary *compactContacts, *returnContact;
|
||||
NSDictionary *userEntry;
|
||||
NSArray *newContacts;
|
||||
NSArray *newContacts, *allEmails;
|
||||
NSMutableArray *emails;
|
||||
NSString *uid, *email, *info;
|
||||
NSNumber *isGroup;
|
||||
id <SOGoSource> source;
|
||||
NSUInteger count, max;
|
||||
|
||||
compactContacts = [NSMutableDictionary dictionary];
|
||||
while ((userEntry = [contacts nextObject]))
|
||||
@@ -851,7 +852,17 @@
|
||||
[returnContact setObject: emails forKey: @"emails"];
|
||||
}
|
||||
email = [userEntry objectForKey: @"mail"];
|
||||
if (email && ![emails containsObject: email])
|
||||
if ([email isKindOfClass: [NSArray class]])
|
||||
{
|
||||
allEmails = (NSArray *) email;
|
||||
max = [allEmails count];
|
||||
for (count = 0; count < max; count++)
|
||||
{
|
||||
email = [allEmails objectAtIndex: count];
|
||||
[emails addObjectUniquely: email];
|
||||
}
|
||||
}
|
||||
else if (email && ![emails containsObject: email])
|
||||
[emails addObject: email];
|
||||
email = [userEntry objectForKey: @"mozillasecondemail"];
|
||||
if (email && ![emails containsObject: email])
|
||||
|
||||
@@ -88,7 +88,7 @@ static Class SOGoContactGCSEntryK = Nil;
|
||||
|
||||
if (!ldifRecord)
|
||||
{
|
||||
clientLDIFRecord = [[self clientObject] ldifRecord];
|
||||
clientLDIFRecord = [[self clientObject] simplifiedLDIFRecord];
|
||||
ldifRecord = [clientLDIFRecord mutableCopy];
|
||||
queryValue = [self queryParameterForKey: @"contactEmail"];
|
||||
if ([queryValue length] > 0)
|
||||
|
||||
@@ -167,7 +167,7 @@
|
||||
onCriteria: @"name_or_address"
|
||||
sortBy: @"c_cn"
|
||||
ordering: NSOrderedAscending
|
||||
inDomain: domain];
|
||||
inDomain: domain];
|
||||
for (i = 0; i < [contacts count]; i++)
|
||||
{
|
||||
contact = [contacts objectAtIndex: i];
|
||||
|
||||
Reference in new issue
Block a user