mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-08-21 06:33:18 +00:00
Merge branch 'master' into feature/addMissingStrings2
Conflicts: UI/AdministrationUI/English.lproj/Localizable.strings UI/PreferencesUI/English.lproj/Localizable.strings UI/Templates/PreferencesUI/UIxFilterEditor.wox
This commit is contained in:
@@ -344,7 +344,7 @@ size_t curl_body_function_freebusy(void *ptr, size_t size, size_t nmemb, void *i
|
||||
NSMutableString *s;
|
||||
|
||||
s = [NSMutableString stringWithCapacity: 64];
|
||||
[s appendFormat:@"<0x%08X[%@]:", self, NSStringFromClass([self class])];
|
||||
[s appendFormat:@"<0x%08X[%@]:", (unsigned int)self, NSStringFromClass([self class])];
|
||||
if (freeBusyViewType)
|
||||
[s appendFormat:@" freeBusyViewType='%@'", freeBusyViewType];
|
||||
if (mergedFreeBusy)
|
||||
|
||||
@@ -84,7 +84,7 @@
|
||||
#import "SOGoAppointmentFolders.h"
|
||||
#import "SOGoFreeBusyObject.h"
|
||||
#import "SOGoTaskObject.h"
|
||||
#import "SOGoWebAppointmentFolder.h";
|
||||
#import "SOGoWebAppointmentFolder.h"
|
||||
|
||||
#import "SOGoAppointmentFolder.h"
|
||||
|
||||
@@ -1013,7 +1013,7 @@ firstInstanceCalendarDateRange: (NGCalendarDateRange *) fir
|
||||
{
|
||||
if ([dateRange containsDate: [component startDate]])
|
||||
{
|
||||
// We must pass nill to :container here in order to avoid re-entrancy issues.
|
||||
// We must pass nil to :container here in order to avoid re-entrancy issues.
|
||||
newRecord = [self _fixupRecord: [component quickRecordFromContent: nil container: nil]];
|
||||
[ma replaceObjectAtIndex: recordIndex withObject: newRecord];
|
||||
}
|
||||
@@ -1030,15 +1030,20 @@ firstInstanceCalendarDateRange: (NGCalendarDateRange *) fir
|
||||
{
|
||||
// The recurrence id of the exception is outside the date range;
|
||||
// simply add the exception to the records array.
|
||||
// We must pass nill to :container here in order to avoid re-entrancy issues.
|
||||
// We must pass nil to :container here in order to avoid re-entrancy issues.
|
||||
newRecord = [self _fixupRecord: [component quickRecordFromContent: nil container: nil]];
|
||||
newRecordRange = [NGCalendarDateRange
|
||||
calendarDateRangeWithStartDate: [newRecord objectForKey: @"startDate"]
|
||||
endDate: [newRecord objectForKey: @"endDate"]];
|
||||
if ([dateRange doesIntersectWithDateRange: newRecordRange])
|
||||
if ([newRecord objectForKey: @"startDate"] && [newRecord objectForKey: @"endDate"]) {
|
||||
newRecordRange = [NGCalendarDateRange
|
||||
calendarDateRangeWithStartDate: [newRecord objectForKey: @"startDate"]
|
||||
endDate: [newRecord objectForKey: @"endDate"]];
|
||||
if ([dateRange doesIntersectWithDateRange: newRecordRange])
|
||||
[ma addObject: newRecord];
|
||||
else
|
||||
else
|
||||
newRecord = nil;
|
||||
} else {
|
||||
[self warnWithFormat: @"Recurrence %@ without dtstart or dtend. Ignoring", recurrenceId];
|
||||
newRecord = nil;
|
||||
}
|
||||
}
|
||||
|
||||
if (newRecord)
|
||||
@@ -2337,7 +2342,7 @@ firstInstanceCalendarDateRange: (NGCalendarDateRange *) fir
|
||||
request = [context request];
|
||||
if (!([request isIPhone] || [request isICal4]))
|
||||
{
|
||||
gdRT = [self groupDavResourceType];
|
||||
gdRT = (NSArray *) [self groupDavResourceType];
|
||||
gdVEventCol = [NSArray arrayWithObjects: [gdRT objectAtIndex: 0],
|
||||
XMLNS_GROUPDAV, nil];
|
||||
[colType addObject: gdVEventCol];
|
||||
@@ -2988,7 +2993,10 @@ firstInstanceCalendarDateRange: (NGCalendarDateRange *) fir
|
||||
|
||||
theUser = [SOGoUser userWithLogin: theUID];
|
||||
aParent = [theUser calendarsFolderInContext: context];
|
||||
|
||||
|
||||
if ([aParent isKindOfClass: [NSException class]])
|
||||
return nil;
|
||||
|
||||
aFolders = [aParent subFolders];
|
||||
e = [aFolders objectEnumerator];
|
||||
while ((aFolder = [e nextObject]))
|
||||
@@ -3152,19 +3160,29 @@ firstInstanceCalendarDateRange: (NGCalendarDateRange *) fir
|
||||
NSMutableString *content;
|
||||
NSString *uid;
|
||||
|
||||
// We first look if there's an event with the same UID in our calendar. If not,
|
||||
// let's reuse what is in the event, otherwise generate a new GUID and use it.
|
||||
// We first look if the event has any / or + in its UID. If that's the case
|
||||
// we generate a new UID based on a GUID
|
||||
uid = [event uid];
|
||||
|
||||
object = [self lookupName: uid
|
||||
inContext: context
|
||||
acquire: NO];
|
||||
|
||||
if (object && ![object isKindOfClass: [NSException class]])
|
||||
if ([uid rangeOfCharacterFromSet: [NSCharacterSet characterSetWithCharactersInString: @"+/"]].location != NSNotFound)
|
||||
{
|
||||
uid = [self globallyUniqueObjectId];
|
||||
[event setUid: uid];
|
||||
}
|
||||
else
|
||||
{
|
||||
// We also look if there's an event with the same UID in our calendar. If not,
|
||||
// let's reuse what is in the event, otherwise generate a new GUID and use it.
|
||||
object = [self lookupName: uid
|
||||
inContext: context
|
||||
acquire: NO];
|
||||
|
||||
if (object && ![object isKindOfClass: [NSException class]])
|
||||
{
|
||||
uid = [self globallyUniqueObjectId];
|
||||
[event setUid: uid];
|
||||
}
|
||||
}
|
||||
|
||||
object = [SOGoAppointmentObject objectWithName: uid
|
||||
inContainer: self];
|
||||
|
||||
@@ -46,6 +46,7 @@
|
||||
#import <NGCards/iCalDateTime.h>
|
||||
#import <NGCards/iCalTimeZone.h>
|
||||
#import <NGCards/iCalTimeZonePeriod.h>
|
||||
#import <NGCards/iCalToDo.h>
|
||||
#import <NGCards/NSString+NGCards.h>
|
||||
|
||||
#import <SOGo/SOGoConstants.h>
|
||||
@@ -748,11 +749,14 @@ inRecurrenceExceptionsForEvent: (iCalEvent *) theEvent
|
||||
{
|
||||
e = [events objectAtIndex: i];
|
||||
if ([e recurrenceId])
|
||||
for (j = 0; j < [theAttendees count]; j++)
|
||||
if (shouldAdd)
|
||||
for (j = 0; j < [theAttendees count]; j++) {
|
||||
if (shouldAdd) {
|
||||
[e addToAttendees: [theAttendees objectAtIndex: j]];
|
||||
else
|
||||
}
|
||||
else {
|
||||
[e removeFromAttendees: [theAttendees objectAtIndex: j]];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1038,7 +1042,7 @@ inRecurrenceExceptionsForEvent: (iCalEvent *) theEvent
|
||||
if ([delegateEmail length])
|
||||
otherDelegate = [event findAttendeeWithEmail: delegateEmail];
|
||||
else
|
||||
otherDelegate = NO;
|
||||
otherDelegate = nil;
|
||||
|
||||
/* we handle the addition/deletion of delegate users */
|
||||
addDelegate = NO;
|
||||
@@ -1076,7 +1080,7 @@ inRecurrenceExceptionsForEvent: (iCalEvent *) theEvent
|
||||
if ([delegateEmail length])
|
||||
otherDelegate = [event findAttendeeWithEmail: delegateEmail];
|
||||
else
|
||||
otherDelegate = NO;
|
||||
otherDelegate = nil;
|
||||
}
|
||||
}
|
||||
if (addDelegate)
|
||||
@@ -1233,7 +1237,7 @@ inRecurrenceExceptionsForEvent: (iCalEvent *) theEvent
|
||||
if ([delegateEmail length])
|
||||
otherDelegate = [event findAttendeeWithEmail: delegateEmail];
|
||||
else
|
||||
otherDelegate = NO;
|
||||
otherDelegate = nil;
|
||||
}
|
||||
|
||||
[self sendEMailUsingTemplateNamed: @"Deletion"
|
||||
@@ -1992,7 +1996,7 @@ inRecurrenceExceptionsForEvent: (iCalEvent *) theEvent
|
||||
if ([container resourceNameForEventUID: eventUID])
|
||||
{
|
||||
return [NSException exceptionWithHTTPStatus: 403
|
||||
reason: [NSString stringWithFormat: @"Event UID already in use. (%s)", eventUID]];
|
||||
reason: [NSString stringWithFormat: @"Event UID already in use. (%@)", eventUID]];
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
@@ -140,6 +140,14 @@
|
||||
return aclManager;
|
||||
}
|
||||
|
||||
- (NSException *) changeParticipationStatus: (NSString *) newPartStat
|
||||
withDelegate: (iCalPerson *) delegate
|
||||
alarm: (iCalAlarm *) alarm
|
||||
{
|
||||
// Required for protocol <SOGoComponentOccurence>
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (id) init
|
||||
{
|
||||
if ((self = [super init]))
|
||||
@@ -171,7 +179,7 @@
|
||||
|
||||
- (Class *) parsingClass
|
||||
{
|
||||
return [iCalCalendar class];
|
||||
return (Class *)[iCalCalendar class];
|
||||
}
|
||||
|
||||
- (NSString *) davContentType
|
||||
|
||||
@@ -102,9 +102,9 @@
|
||||
}
|
||||
|
||||
if ([reminderReference caseInsensitiveCompare: @"BEFORE"] == NSOrderedSame)
|
||||
aValue = [NSString stringWithString: @"-P"];
|
||||
aValue = (NSString *) @"-P";
|
||||
else
|
||||
aValue = [NSString stringWithString: @"P"];
|
||||
aValue = (NSString *) @"P";
|
||||
|
||||
if ([reminderUnit caseInsensitiveCompare: @"MINUTES"] == NSOrderedSame ||
|
||||
[reminderUnit caseInsensitiveCompare: @"HOURS"] == NSOrderedSame)
|
||||
|
||||
@@ -267,7 +267,7 @@
|
||||
|
||||
- (NSTimeInterval) occurenceInterval
|
||||
{
|
||||
return [[self endDate] timeIntervalSinceDate: [self startDate]];
|
||||
return (NSTimeInterval) [[self endDate] timeIntervalSinceDate: [self startDate]];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -328,30 +328,10 @@
|
||||
*/
|
||||
- (NSDictionary *) attributesInContext: (WOContext *) context
|
||||
{
|
||||
BOOL isAllDay;
|
||||
NSCalendarDate *eventStartDate, *eventEndDate;
|
||||
NSMutableDictionary *data;
|
||||
NSTimeZone *timeZone;
|
||||
SOGoUserDefaults *ud;
|
||||
|
||||
isAllDay = [self isAllDay];
|
||||
ud = [[context activeUser] userDefaults];
|
||||
timeZone = [ud timeZone];
|
||||
eventStartDate = [self startDate];
|
||||
eventEndDate = [self endDate];
|
||||
|
||||
if (!isAllDay)
|
||||
{
|
||||
[eventStartDate setTimeZone: timeZone];
|
||||
[eventEndDate setTimeZone: timeZone];
|
||||
}
|
||||
|
||||
data = [NSMutableDictionary dictionaryWithDictionary: [super attributesInContext: context]];
|
||||
|
||||
[data setObject: [eventStartDate iso8601DateString] forKey: @"startDate"];
|
||||
[data setObject: [eventEndDate iso8601DateString] forKey: @"endDate"];
|
||||
|
||||
[data setObject: [NSNumber numberWithBool: isAllDay] forKey: @"isAllDay"];
|
||||
[data setObject: [NSNumber numberWithBool: ![self isOpaque]] forKey: @"isTransparent"];
|
||||
|
||||
return data;
|
||||
@@ -383,18 +363,10 @@
|
||||
if ([o isKindOfClass: [NSString class]] && [o length])
|
||||
aptStartDate = [self dateFromString: o inContext: context];
|
||||
|
||||
o = [data objectForKey: @"startTime"];
|
||||
if ([o isKindOfClass: [NSString class]] && [o length])
|
||||
[self adjustDate: &aptStartDate withTimeString: o inContext: context];
|
||||
|
||||
o = [data objectForKey: @"endDate"];
|
||||
if ([o isKindOfClass: [NSString class]] && [o length])
|
||||
aptEndDate = [self dateFromString: o inContext: context];
|
||||
|
||||
o = [data objectForKey: @"endTime"];
|
||||
if ([o isKindOfClass: [NSString class]] && [o length])
|
||||
[self adjustDate: &aptEndDate withTimeString: o inContext: context];
|
||||
|
||||
o = [data objectForKey: @"isTransparent"];
|
||||
if ([o isKindOfClass: [NSNumber class]])
|
||||
[self setTransparency: ([o boolValue]? @"TRANSPARENT" : @"OPAQUE")];
|
||||
@@ -418,6 +390,14 @@
|
||||
}
|
||||
else
|
||||
{
|
||||
o = [data objectForKey: @"startTime"];
|
||||
if ([o isKindOfClass: [NSString class]] && [o length])
|
||||
[self adjustDate: &aptStartDate withTimeString: o inContext: context];
|
||||
|
||||
o = [data objectForKey: @"endTime"];
|
||||
if ([o isKindOfClass: [NSString class]] && [o length])
|
||||
[self adjustDate: &aptEndDate withTimeString: o inContext: context];
|
||||
|
||||
[self setStartDate: aptStartDate];
|
||||
[self setEndDate: aptEndDate];
|
||||
}
|
||||
|
||||
@@ -44,6 +44,7 @@
|
||||
#import <SOGo/NSCalendarDate+SOGo.h>
|
||||
|
||||
#import "iCalRepeatableEntityObject+SOGo.h"
|
||||
#import "iCalCalendar+SOGo.h"
|
||||
|
||||
@implementation iCalRepeatableEntityObject (SOGoExtensions)
|
||||
|
||||
@@ -162,7 +163,7 @@
|
||||
rule = [iCalRecurrenceRule new];
|
||||
[rule setInterval: @"1"];
|
||||
|
||||
frequency = NSNotFound;
|
||||
frequency = (int)NSNotFound;
|
||||
o = [repeat objectForKey: @"frequency"];
|
||||
if ([o isKindOfClass: [NSString class]])
|
||||
{
|
||||
|
||||
@@ -214,7 +214,7 @@
|
||||
{
|
||||
percent = [o intValue];
|
||||
if (percent >= 0 && percent <= 100)
|
||||
[self setPercentComplete: [NSString stringWithFormat: @"%i", percent]];
|
||||
[self setPercentComplete: [NSString stringWithFormat: @"%i", (int)percent]];
|
||||
}
|
||||
else
|
||||
[self setPercentComplete: @""];
|
||||
|
||||
@@ -327,7 +327,7 @@ convention:
|
||||
|
||||
if (year && month && day)
|
||||
[self setBday: [NSString stringWithFormat: @"%.4d-%.2d-%.2d",
|
||||
year, month, day]];
|
||||
(int)year, (int)month, (int)day]];
|
||||
else
|
||||
[self setBday: @""];
|
||||
|
||||
@@ -644,11 +644,11 @@ convention:
|
||||
birthDay = [[self bday] asCalendarDate];
|
||||
if (birthDay)
|
||||
{
|
||||
stringValue = [NSString stringWithFormat: @"%.4d", [birthDay yearOfCommonEra]];
|
||||
stringValue = [NSString stringWithFormat: @"%.4d", (int)[birthDay yearOfCommonEra]];
|
||||
[self _setValue: @"birthyear" to: stringValue inLDIFRecord: ldifRecord];
|
||||
stringValue = [NSString stringWithFormat: @"%.2d", [birthDay monthOfYear]];
|
||||
stringValue = [NSString stringWithFormat: @"%.2d", (int)[birthDay monthOfYear]];
|
||||
[self _setValue: @"birthmonth" to: stringValue inLDIFRecord: ldifRecord];
|
||||
stringValue = [NSString stringWithFormat: @"%.2d", [birthDay dayOfMonth]];
|
||||
stringValue = [NSString stringWithFormat: @"%.2d", (int)[birthDay dayOfMonth]];
|
||||
[self _setValue: @"birthday" to: stringValue inLDIFRecord: ldifRecord];
|
||||
}
|
||||
[self _setValue: @"description" to: [self note] inLDIFRecord: ldifRecord];
|
||||
|
||||
@@ -59,7 +59,7 @@
|
||||
|
||||
[response setHeader: [self davContentType] forKey: @"content-type"];
|
||||
[response setHeader: [NSString stringWithFormat:@" %d",
|
||||
[data length]]
|
||||
(int)[data length]]
|
||||
forKey: @"content-length"];
|
||||
[response setContent: data];
|
||||
}
|
||||
|
||||
@@ -268,9 +268,9 @@ Class SOGoContactSourceFolderK;
|
||||
SOGoUser *currentUser;
|
||||
id <SOGoSource> source;
|
||||
|
||||
if ([sourceID isEqualToString: @"personal"])
|
||||
result = [NSException exceptionWithHTTPStatus: 403
|
||||
reason: (@"folder '%@' cannot be deleted", sourceID)];
|
||||
if ([sourceID isEqualToString: @"personal"]){
|
||||
result = [NSException exceptionWithHTTPStatus: 403 reason: [NSString stringWithFormat: (@"folder '%@' cannot be deleted"), sourceID]];
|
||||
}
|
||||
else
|
||||
{
|
||||
result = nil;
|
||||
|
||||
@@ -50,7 +50,7 @@
|
||||
|
||||
- (Class *) parsingClass
|
||||
{
|
||||
return [NGVCard class];
|
||||
return (Class *)[NGVCard class];
|
||||
}
|
||||
|
||||
/* content */
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
|
||||
- (Class *) parsingClass
|
||||
{
|
||||
return [NGVList class];
|
||||
return (Class *)[NGVList class];
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -47,7 +47,9 @@
|
||||
#import <SOGo/NSObject+DAV.h>
|
||||
#import <SOGo/SOGoPermissions.h>
|
||||
#import <SOGo/SOGoSource.h>
|
||||
#import <SOGo/SOGoUserManager.h>
|
||||
#import <SOGo/SOGoUserSettings.h>
|
||||
#import <SOGo/SOGoSystemDefaults.h>
|
||||
#import <SOGo/WORequest+SOGo.h>
|
||||
#import <SOGo/WOResponse+SOGo.h>
|
||||
|
||||
@@ -94,7 +96,7 @@
|
||||
{
|
||||
if (![newDisplayName length])
|
||||
newDisplayName = newName;
|
||||
ASSIGN (displayName, newDisplayName);
|
||||
ASSIGN (displayName, (NSMutableString *)newDisplayName);
|
||||
}
|
||||
|
||||
return self;
|
||||
@@ -248,6 +250,13 @@
|
||||
data = @"";
|
||||
[newRecord setObject: data forKey: @"c_cn"];
|
||||
|
||||
if ([[SOGoSystemDefaults sharedSystemDefaults] enableDomainBasedUID])
|
||||
{
|
||||
data = [oldRecord objectForKey: @"c_domain"];
|
||||
if (data)
|
||||
[newRecord setObject: data forKey: @"c_domain"];
|
||||
}
|
||||
|
||||
// mail => emails[]
|
||||
data = [oldRecord objectForKey: @"c_emails"];
|
||||
if (data)
|
||||
@@ -697,7 +706,7 @@
|
||||
BOOL otherIsPersonal;
|
||||
|
||||
otherIsPersonal = ([otherFolder isKindOfClass: [SOGoContactGCSFolder class]]
|
||||
|| ([otherFolder isKindOfClass: isa] && [otherFolder isPersonalSource]));
|
||||
|| ([otherFolder isKindOfClass: object_getClass(self)] && [otherFolder isPersonalSource]));
|
||||
|
||||
if (isPersonalSource)
|
||||
{
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
/* NSObject+CardDAV.h - this file is part of SOGo
|
||||
*
|
||||
* Copyright (C) 2007 Inverse inc.
|
||||
*
|
||||
* Author: Ludovic Marcotte <ludovic@inverse.ca>
|
||||
* Copyright (C) 2007-2015 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
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
/* NSObject+CardDAV.m - this file is part of SOGo
|
||||
*
|
||||
* Copyright (C) 2007-2011 Inverse inc.
|
||||
*
|
||||
* Author: Ludovic Marcotte <ludovic@inverse.ca>
|
||||
* Copyright (C) 2007-2015 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
|
||||
@@ -187,6 +185,10 @@
|
||||
[filters addObject: filter];
|
||||
}
|
||||
|
||||
// If no filters are provided, we return everything.
|
||||
if (![filters count])
|
||||
[filters addObject: [NSDictionary dictionaryWithObject: @"." forKey: @"mail"]];
|
||||
|
||||
return filters;
|
||||
}
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
|
||||
#import <Foundation/NSDictionary.h>
|
||||
#import <Foundation/NSString.h>
|
||||
#import <NGExtensions/NSString+misc.h>
|
||||
|
||||
#import "NSDictionary+Mail.h"
|
||||
|
||||
|
||||
@@ -533,7 +533,7 @@
|
||||
messageID = [NSMutableString string];
|
||||
[messageID appendFormat: @"<%@", [SOGoObject globallyUniqueObjectId]];
|
||||
pGUID = [[NSProcessInfo processInfo] globallyUniqueString];
|
||||
[messageID appendFormat: @"@%u>", [pGUID hash]];
|
||||
[messageID appendFormat: @"@%u>", (unsigned int)[pGUID hash]];
|
||||
|
||||
return [messageID lowercaseString];
|
||||
}
|
||||
|
||||
@@ -181,6 +181,7 @@ static NSString *headerKeys[] = {@"subject", @"to", @"cc", @"bcc",
|
||||
|
||||
static NGMimeType *MultiMixedType = nil;
|
||||
static NGMimeType *MultiAlternativeType = nil;
|
||||
static NGMimeType *MultiRelatedType = nil;
|
||||
static NSString *userAgent = nil;
|
||||
|
||||
+ (void) initialize
|
||||
@@ -191,6 +192,9 @@ static NSString *userAgent = nil;
|
||||
MultiAlternativeType = [NGMimeType mimeType: @"multipart" subType: @"alternative"];
|
||||
[MultiAlternativeType retain];
|
||||
|
||||
MultiRelatedType = [NGMimeType mimeType: @"multipart" subType: @"related"];
|
||||
[MultiRelatedType retain];
|
||||
|
||||
userAgent = [NSString stringWithFormat: @"SOGoMail %@",
|
||||
SOGoVersion];
|
||||
[userAgent retain];
|
||||
@@ -700,7 +704,8 @@ static NSString *userAgent = nil;
|
||||
for (count = max - 1; count >= 0; count--)
|
||||
{
|
||||
currentAddress = [addresses objectAtIndex: count];
|
||||
if ([currentRecipient
|
||||
if (![currentAddress baseEMail] ||
|
||||
[currentRecipient
|
||||
caseInsensitiveCompare: [currentAddress baseEMail]]
|
||||
== NSOrderedSame)
|
||||
{
|
||||
@@ -1676,16 +1681,20 @@ static NSString *userAgent = nil;
|
||||
NGMimeMessage *message;
|
||||
NGMutableHashMap *map;
|
||||
NSString *newText;
|
||||
BOOL has_inline_images;
|
||||
|
||||
message = nil;
|
||||
|
||||
has_inline_images = NO;
|
||||
bodyParts = [NSMutableArray array];
|
||||
|
||||
if (_extractImages)
|
||||
{
|
||||
newText = [text htmlByExtractingImages: bodyParts];
|
||||
if ([bodyParts count])
|
||||
[self setText: newText];
|
||||
{
|
||||
[self setText: newText];
|
||||
has_inline_images = YES;
|
||||
}
|
||||
}
|
||||
|
||||
map = [self mimeHeaderMapWithHeaders: _headers
|
||||
@@ -1702,10 +1711,20 @@ static NSString *userAgent = nil;
|
||||
/* no attachments */
|
||||
message = [self mimeMessageForContentWithHeaderMap: map];
|
||||
else
|
||||
/* attachments, create multipart/mixed */
|
||||
message = [self mimeMultiPartMessageWithHeaderMap: map
|
||||
andBodyParts: bodyParts];
|
||||
//[self debugWithFormat: @"message: %@", message];
|
||||
{
|
||||
// attachments, create multipart/mixed or multipart/related if
|
||||
// we have inline image to avoid Thunderbird bug #61815 (https://bugzilla.mozilla.org/show_bug.cgi?id=61815)
|
||||
if (has_inline_images)
|
||||
{
|
||||
[map removeAllObjectsForKey: @"content-type"];
|
||||
[map addObject: MultiRelatedType forKey: @"content-type"];
|
||||
}
|
||||
|
||||
message = [self mimeMultiPartMessageWithHeaderMap: map
|
||||
andBodyParts: bodyParts];
|
||||
|
||||
//[self debugWithFormat: @"message: %@", message];
|
||||
}
|
||||
}
|
||||
|
||||
return message;
|
||||
|
||||
@@ -206,8 +206,8 @@ static NSString *inboxFolderName = @"INBOX";
|
||||
[folders removeObjectsInArray: nss];
|
||||
}
|
||||
|
||||
return [[folders stringsWithFormat: @"folder%@"]
|
||||
resultsOfSelector: @selector (asCSSIdentifier)];
|
||||
return [[folders resultsOfSelector: @selector (asCSSIdentifier)]
|
||||
stringsWithFormat: @"folder%@"];
|
||||
}
|
||||
|
||||
- (NSArray *) toManyRelationshipKeys
|
||||
|
||||
@@ -32,9 +32,11 @@
|
||||
#import <NGExtensions/NSString+misc.h>
|
||||
#import <NGExtensions/NSURL+misc.h>
|
||||
#import <NGImap4/NGImap4Connection.h>
|
||||
#import <NGImap4/NGImap4Client.h>
|
||||
|
||||
#import <SOGo/SOGoCache.h>
|
||||
#import <SOGo/SOGoUser.h>
|
||||
#import <SOGo/WORequest+SOGo.h>
|
||||
|
||||
#import "SOGoMailAccount.h"
|
||||
#import "SOGoMailManager.h"
|
||||
|
||||
@@ -396,7 +396,7 @@ static BOOL debugOn = NO;
|
||||
mimeType = @"application/octet-stream";
|
||||
|
||||
[response setHeader: mimeType forKey: @"content-type"];
|
||||
[response setHeader: [NSString stringWithFormat:@"%d", [data length]]
|
||||
[response setHeader: [NSString stringWithFormat:@"%d", (int)[data length]]
|
||||
forKey: @"content-length"];
|
||||
|
||||
if (asAttachment)
|
||||
|
||||
@@ -97,10 +97,10 @@
|
||||
|
||||
- (NSString *) davCollectionTag;
|
||||
|
||||
- (NSArray *) syncTokenFieldsWithProperties: (NSArray *) theProperties
|
||||
matchingSyncToken: (NSString *) theSyncToken
|
||||
fromDate: (NSCalendarDate *) theStartDate;
|
||||
|
||||
- (NSArray *) syncTokenFieldsWithProperties: (NSDictionary *) properties
|
||||
matchingSyncToken: (NSString *) syncToken
|
||||
fromDate: (NSCalendarDate *) theStartDate
|
||||
initialLoad: (BOOL) initialLoadInProgress;
|
||||
/* flags */
|
||||
|
||||
- (NSException *) addFlagsToAllMessages: (id) _f;
|
||||
|
||||
@@ -199,9 +199,9 @@ _compareFetchResultsByMODSEQ (id entry1, id entry2, void *data)
|
||||
{
|
||||
NSArray *subfolders;
|
||||
|
||||
subfolders = [[self subfolders] stringsWithFormat: @"folder%@"];
|
||||
subfolders = [[self subfolders] resultsOfSelector: @selector (asCSSIdentifier)];
|
||||
|
||||
return [subfolders resultsOfSelector: @selector (asCSSIdentifier)];
|
||||
return [subfolders stringsWithFormat: @"folder%@"];
|
||||
}
|
||||
|
||||
- (NSArray *) subfolders
|
||||
@@ -634,7 +634,7 @@ _compareFetchResultsByMODSEQ (id entry1, id entry2, void *data)
|
||||
inContext: (id) localContext
|
||||
{
|
||||
NSArray *folders;
|
||||
NSString *currentFolderName, *currentAccountName;
|
||||
NSString *currentFolderName, *currentAccountName, *destinationAccountName;
|
||||
NSMutableString *imapDestinationFolder;
|
||||
NGImap4Client *client;
|
||||
id result;
|
||||
@@ -642,24 +642,24 @@ _compareFetchResultsByMODSEQ (id entry1, id entry2, void *data)
|
||||
|
||||
#warning this code will fail on implementation using something else than '/' as delimiter
|
||||
imapDestinationFolder = [NSMutableString string];
|
||||
folders = [[destinationFolder componentsSeparatedByString: @"/"]
|
||||
resultsOfSelector: @selector (fromCSSIdentifier)];
|
||||
folders = [destinationFolder componentsSeparatedByString: @"/"];
|
||||
max = [folders count];
|
||||
if (max > 1)
|
||||
{
|
||||
currentAccountName = [[self mailAccountFolder] nameInContainer];
|
||||
client = [[self imap4Connection] client];
|
||||
[imap4 selectFolder: [self imap4URL]];
|
||||
destinationAccountName = [[folders objectAtIndex: 1] fromCSSIdentifier];
|
||||
|
||||
for (count = 2; count < max; count++)
|
||||
{
|
||||
currentFolderName = [[folders objectAtIndex: count] substringFromIndex: 6];
|
||||
currentFolderName = [[[folders objectAtIndex: count] substringFromIndex: 6] fromCSSIdentifier];
|
||||
[imapDestinationFolder appendFormat: @"/%@", currentFolderName];
|
||||
}
|
||||
|
||||
if (client)
|
||||
{
|
||||
if ([[folders objectAtIndex: 1] isEqualToString: currentAccountName])
|
||||
if ([destinationAccountName isEqualToString: currentAccountName])
|
||||
{
|
||||
// We make sure the destination IMAP folder exist, if not, we create it.
|
||||
result = [[client status: imapDestinationFolder
|
||||
@@ -688,7 +688,7 @@ _compareFetchResultsByMODSEQ (id entry1, id entry2, void *data)
|
||||
|
||||
userFolder = [[context activeUser] homeFolderInContext: context];
|
||||
accounts = [userFolder lookupName: @"Mail" inContext: context acquire: NO];
|
||||
account = [accounts lookupName: [folders objectAtIndex: 1] inContext: localContext acquire: NO];
|
||||
account = [accounts lookupName: destinationAccountName inContext: localContext acquire: NO];
|
||||
|
||||
if ([account isKindOfClass: [NSException class]])
|
||||
{
|
||||
@@ -1674,7 +1674,7 @@ _compareFetchResultsByMODSEQ (id entry1, id entry2, void *data)
|
||||
|
||||
sortOrderings = [NSMutableArray array];
|
||||
|
||||
if ([self _sortElementIsAscending: sortElement])
|
||||
if ([self _sortElementIsAscending: (NGDOMNodeWithChildren <DOMElement> *)sortElement])
|
||||
sortOrderingOrder = EOCompareAscending;
|
||||
else
|
||||
sortOrderingOrder = EOCompareDescending;
|
||||
@@ -2106,7 +2106,7 @@ _compareFetchResultsByMODSEQ (id entry1, id entry2, void *data)
|
||||
// * 5 FETCH (UID 559 MODSEQ (17))
|
||||
// * 6 FETCH (UID 560 MODSEQ (18))
|
||||
// * 7 FETCH (UID 561 MODSEQ (19))
|
||||
|
||||
//
|
||||
//
|
||||
// fetchUIDsOfVanishedItems ..
|
||||
//
|
||||
@@ -2119,6 +2119,7 @@ _compareFetchResultsByMODSEQ (id entry1, id entry2, void *data)
|
||||
- (NSArray *) syncTokenFieldsWithProperties: (NSArray *) theProperties
|
||||
matchingSyncToken: (NSString *) theSyncToken
|
||||
fromDate: (NSCalendarDate *) theStartDate
|
||||
initialLoad: (BOOL) initialLoadInProgress
|
||||
{
|
||||
EOQualifier *searchQualifier;
|
||||
NSMutableArray *allTokens;
|
||||
@@ -2195,6 +2196,9 @@ _compareFetchResultsByMODSEQ (id entry1, id entry2, void *data)
|
||||
|
||||
for (i = 0; i < [fetchResults count]; i++)
|
||||
{
|
||||
if ([[[fetchResults objectAtIndex: i] objectForKey: @"flags"] containsObject: @"deleted"] && initialLoadInProgress)
|
||||
continue;
|
||||
|
||||
d = [NSDictionary dictionaryWithObject: ([[[fetchResults objectAtIndex: i] objectForKey: @"flags"] containsObject: @"deleted"]) ? [NSNull null] : [[fetchResults objectAtIndex: i] objectForKey: @"modseq"]
|
||||
forKey: [[[fetchResults objectAtIndex: i] objectForKey: @"uid"] stringValue]];
|
||||
[allTokens addObject: d];
|
||||
@@ -2205,7 +2209,7 @@ _compareFetchResultsByMODSEQ (id entry1, id entry2, void *data)
|
||||
if (highestmodseq == 0)
|
||||
highestmodseq = 1;
|
||||
|
||||
if (highestmodseq > 0)
|
||||
if (highestmodseq > 0 && !initialLoadInProgress)
|
||||
{
|
||||
id uid;
|
||||
|
||||
|
||||
@@ -73,10 +73,10 @@
|
||||
|
||||
- (NSString *) newLine
|
||||
{
|
||||
NSString *rc = [NSString stringWithString: @" "];
|
||||
NSString *rc = @" ";
|
||||
|
||||
if (htmlComposition)
|
||||
rc = [NSString stringWithString: @"<br/>"];
|
||||
rc = @"<br/>";
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -74,7 +74,7 @@
|
||||
int i;
|
||||
|
||||
allLabels = [NSMutableArray array];
|
||||
allKeys = [[theDefaults allKeys] sortedArrayUsingSelector: @selector (caseInsensitiveCompare:)];
|
||||
allKeys = (NSMutableArray *)[[theDefaults allKeys] sortedArrayUsingSelector: @selector (caseInsensitiveCompare:)];
|
||||
|
||||
for (i = 0; i < [allKeys count]; i++)
|
||||
{
|
||||
|
||||
@@ -389,6 +389,13 @@ static BOOL debugSoParts = NO;
|
||||
[[[info valueForKey: @"subtype"] lowercaseString] isEqualToString: @"calendar"])
|
||||
return info;
|
||||
|
||||
// deal with mails that contain only an attachment, for example:
|
||||
// application/pkcs7-mime
|
||||
// application/pdf
|
||||
// etc.
|
||||
if ([[[info valueForKey: @"type"] lowercaseString] isEqualToString: @"application"])
|
||||
return info;
|
||||
|
||||
/*
|
||||
For each path component, eg 1,1,3
|
||||
|
||||
@@ -775,9 +782,14 @@ static BOOL debugSoParts = NO;
|
||||
[mimeType hasPrefix: @"audio/"] ||
|
||||
[mimeType hasPrefix: @"image/"] ||
|
||||
[mimeType hasPrefix: @"video/"])
|
||||
{
|
||||
filename = [NSString stringWithFormat: @"unknown_%@", path];
|
||||
else if ([mimeType isEqualToString: @"message/rfc822"])
|
||||
filename = [NSString stringWithFormat: @"email_%@.eml", path];
|
||||
}
|
||||
else
|
||||
{
|
||||
if ([mimeType isEqualToString: @"message/rfc822"])
|
||||
filename = [NSString stringWithFormat: @"email_%@.eml", path];
|
||||
}
|
||||
}
|
||||
|
||||
if (filename)
|
||||
@@ -810,7 +822,7 @@ static BOOL debugSoParts = NO;
|
||||
NSMutableDictionary *currentPart;
|
||||
NSString *newPath;
|
||||
NSArray *subparts;
|
||||
NSString *type;
|
||||
NSString *type, *subtype;
|
||||
NSUInteger i;
|
||||
|
||||
type = [[part objectForKey: @"type"] lowercaseString];
|
||||
@@ -821,19 +833,27 @@ static BOOL debugSoParts = NO;
|
||||
{
|
||||
currentPart = [subparts objectAtIndex: i-1];
|
||||
if (path)
|
||||
newPath = [NSString stringWithFormat: @"%@.%d", path, i];
|
||||
newPath = [NSString stringWithFormat: @"%@.%d", path, (int)i];
|
||||
else
|
||||
newPath = [NSString stringWithFormat: @"%d", i];
|
||||
newPath = [NSString stringWithFormat: @"%d", (int)i];
|
||||
[self _fetchFileAttachmentKeysInPart: currentPart
|
||||
intoArray: keys
|
||||
withPath: newPath
|
||||
andPrefix: [NSString stringWithFormat: @"%@/%i", prefix, i]];
|
||||
andPrefix: [NSString stringWithFormat: @"%@/%i", prefix, (int)i]];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!path)
|
||||
path = @"1";
|
||||
{
|
||||
path = @"1";
|
||||
|
||||
// We set the path to 0 in case of a smime mail if not provided.
|
||||
subtype = [[part objectForKey: @"subtype"] lowercaseString];
|
||||
if ([subtype isEqualToString: @"pkcs7-mime"])
|
||||
path = @"0";
|
||||
}
|
||||
|
||||
[self _fetchFileAttachmentKey: part
|
||||
intoArray: keys
|
||||
withPath: path
|
||||
@@ -1027,6 +1047,14 @@ static BOOL debugSoParts = NO;
|
||||
return obj;
|
||||
}
|
||||
}
|
||||
// Handles cases where the email is itself an attachment, so its Content-Type
|
||||
// is application/*, image/* etc.
|
||||
else if ([_key isEqualToString: @"asAttachment"] &&
|
||||
(obj = [self lookupImap4BodyPartKey: @"0" inContext:_ctx]) != nil)
|
||||
{
|
||||
[obj setAsAttachment];
|
||||
return obj;
|
||||
}
|
||||
|
||||
/* return 404 to stop acquisition */
|
||||
return [NSException exceptionWithHTTPStatus:404 /* Not Found */
|
||||
|
||||
@@ -310,7 +310,7 @@ static NSDictionary *BSONTypes()
|
||||
|
||||
case 'q': return 0x12;
|
||||
default:
|
||||
[NSException raise: NSInvalidArgumentException format: @"%@::%s - invalid encoding type '%c'", [self class], _cmd, encoding];
|
||||
[NSException raise: NSInvalidArgumentException format: @"%@::%@ - invalid encoding type '%c'", [self class], NSStringFromSelector(_cmd), encoding];
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -385,7 +385,7 @@ static NSDictionary *BSONTypes()
|
||||
}
|
||||
|
||||
|
||||
[NSException raise: NSInvalidArgumentException format: @"%@::%s - invalid encoding type '%c'", [self class], _cmd, encoding];
|
||||
[NSException raise: NSInvalidArgumentException format: @"%@::%@ - invalid encoding type '%c'", [self class], NSStringFromSelector(_cmd), encoding];
|
||||
return nil;
|
||||
}
|
||||
|
||||
|
||||
@@ -1703,7 +1703,7 @@ _makeLDAPChanges (NGLdapConnection *ldapConnection,
|
||||
hostname: hostname
|
||||
port: [NSString stringWithFormat: @"%d", port]
|
||||
encryption: encryption
|
||||
bindAsCurrentUser: NO];
|
||||
bindAsCurrentUser: [NSString stringWithFormat: @"%d", NO]];
|
||||
[ab setBaseDN: [entry dn]
|
||||
IDField: @"cn"
|
||||
CNField: @"displayName"
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
/* NSArray+Utilities.h - this file is part of SOGo
|
||||
*
|
||||
* Copyright (C) 2006 Inverse inc.
|
||||
*
|
||||
* Author: Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||
* Copyright (C) 2006-2015 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
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
/* NSArray+Utilities.m - this file is part of SOGo
|
||||
*
|
||||
* Copyright (C) 2006-2011 Inverse inc.
|
||||
*
|
||||
* Author: Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||
* Copyright (C) 2006-2015 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
|
||||
|
||||
@@ -90,9 +90,9 @@ static NSString *rfc822Months[] = {@"", @"Jan", @"Feb", @"Mar", @"Apr",
|
||||
NSString *str;
|
||||
|
||||
str = [NSString stringWithFormat: @"%.4d%.2d%.2d",
|
||||
[self yearOfCommonEra],
|
||||
[self monthOfYear],
|
||||
[self dayOfMonth]];
|
||||
(int)[self yearOfCommonEra],
|
||||
(int)[self monthOfYear],
|
||||
(int)[self dayOfMonth]];
|
||||
|
||||
return str;
|
||||
}
|
||||
@@ -109,9 +109,9 @@ static NSString *rfc822Months[] = {@"", @"Jan", @"Feb", @"Mar", @"Apr",
|
||||
|
||||
return
|
||||
[NSString stringWithFormat: @"%@, %.2d %@ %d %.2d:%.2d:%.2d %+.4d",
|
||||
rfc822Days[[self dayOfWeek]], [self dayOfMonth],
|
||||
rfc822Months[[self monthOfYear]], [self yearOfCommonEra],
|
||||
[self hourOfDay], [self minuteOfHour], [self secondOfMinute],
|
||||
rfc822Days[[self dayOfWeek]], (int)[self dayOfMonth],
|
||||
rfc822Months[[self monthOfYear]], (int)[self yearOfCommonEra],
|
||||
(int)[self hourOfDay], (int)[self minuteOfHour], (int)[self secondOfMinute],
|
||||
timeZoneShift];
|
||||
}
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifndef __OpenBSD__
|
||||
#if !defined(__OpenBSD__) && !defined(__FreeBSD__)
|
||||
#include <crypt.h>
|
||||
#endif
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
{
|
||||
NSString *newTag;
|
||||
|
||||
newTag = [NSString stringWithFormat: @"n%d", [namespaces count]];
|
||||
newTag = [NSString stringWithFormat: @"n%d", (int)[namespaces count]];
|
||||
[namespaces setObject: newTag forKey: newNS];
|
||||
|
||||
return newTag;
|
||||
|
||||
@@ -309,7 +309,7 @@ static int cssEscapingCount;
|
||||
c == 0xD ||
|
||||
(c >= 0x20 && c <= 0xD7FF) ||
|
||||
(c >= 0xE000 && c <= 0xFFFD) ||
|
||||
(c >= 0x10000 && c <= 0x10FFFF))
|
||||
(c >= (unichar)0x10000 && c <= (unichar)0x10FFFF))
|
||||
{
|
||||
*(start+j) = c;
|
||||
j++;
|
||||
@@ -373,6 +373,7 @@ static int cssEscapingCount;
|
||||
|
||||
- (NSString *) asCSSIdentifier
|
||||
{
|
||||
NSCharacterSet *numericSet;
|
||||
NSMutableString *cssIdentifier;
|
||||
unichar currentChar;
|
||||
int count, max, idx;
|
||||
@@ -381,10 +382,12 @@ static int cssEscapingCount;
|
||||
[self _setupCSSEscaping];
|
||||
|
||||
cssIdentifier = [NSMutableString string];
|
||||
numericSet = [NSCharacterSet decimalDigitCharacterSet];
|
||||
max = [self length];
|
||||
|
||||
if (max > 0)
|
||||
{
|
||||
if (isdigit([self characterAtIndex: 0]))
|
||||
if ([numericSet characterIsMember: [self characterAtIndex: 0]])
|
||||
// A CSS identifier can't start with a digit; we add an underscore
|
||||
[cssIdentifier appendString: @"_"];
|
||||
for (count = 0; count < max; count++)
|
||||
@@ -415,6 +418,7 @@ static int cssEscapingCount;
|
||||
|
||||
- (NSString *) fromCSSIdentifier
|
||||
{
|
||||
NSCharacterSet *numericSet;
|
||||
NSMutableString *newString;
|
||||
NSString *currentString;
|
||||
int count, length, max, idx;
|
||||
@@ -423,12 +427,14 @@ static int cssEscapingCount;
|
||||
if (!cssEscapingStrings)
|
||||
[self _setupCSSEscaping];
|
||||
|
||||
numericSet = [NSCharacterSet decimalDigitCharacterSet];
|
||||
newString = [NSMutableString string];
|
||||
max = [self length];
|
||||
count = 0;
|
||||
|
||||
if (max > 0
|
||||
&& [self characterAtIndex: 0] == '_'
|
||||
&& isdigit([self characterAtIndex: 1]))
|
||||
&& [numericSet characterIsMember: [self characterAtIndex: 1]])
|
||||
{
|
||||
/* If the identifier starts with an underscore followed by a digit,
|
||||
we remove the underscore */
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#ifndef SOGOCACHE_H
|
||||
#define SOGOCACHE_H
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <Foundation/NSObject.h>
|
||||
|
||||
#include <libmemcached/memcached.h>
|
||||
|
||||
@@ -40,6 +40,8 @@
|
||||
|
||||
- (NSMutableString *) pathForChild: (NSString *) childName;
|
||||
|
||||
- (void) addUserInAcls: (NSString *) user;
|
||||
|
||||
- (NSArray *) toOneRelationshipKeys;
|
||||
- (NSArray *) toManyRelationshipKeys;
|
||||
|
||||
|
||||
@@ -364,7 +364,7 @@ Class SOGoCacheGCSObjectK = Nil;
|
||||
if (record)
|
||||
{
|
||||
if ([[record objectForKey: @"c_type"] intValue] == MAPIFolderCacheObject)
|
||||
objectClass = isa;
|
||||
objectClass = object_getClass(self);
|
||||
else
|
||||
objectClass = SOGoCacheGCSObjectK;
|
||||
|
||||
|
||||
@@ -55,6 +55,9 @@ typedef enum {
|
||||
|
||||
- (void) reloadIfNeeded;
|
||||
- (void) save;
|
||||
- (NSException *) destroy;
|
||||
|
||||
+ (id) objectWithName: (NSString *) key inContainer: (id) theContainer useCache: (BOOL) useCache;
|
||||
|
||||
/* accessors */
|
||||
- (NSMutableString *) path; /* full filename */
|
||||
|
||||
@@ -87,7 +87,7 @@ static EOAttribute *textColumn = nil;
|
||||
{
|
||||
tableUrl = nil;
|
||||
initialized = NO;
|
||||
objectType = -1;
|
||||
objectType = (SOGoCacheObjectType) -1;
|
||||
deleted = NO;
|
||||
version = 0;
|
||||
}
|
||||
@@ -103,11 +103,22 @@ static EOAttribute *textColumn = nil;
|
||||
}
|
||||
|
||||
+ (id) objectWithName: (NSString *) key inContainer: (id) theContainer
|
||||
{
|
||||
return [self objectWithName: key
|
||||
inContainer: theContainer
|
||||
useCache: YES];
|
||||
}
|
||||
|
||||
+ (id) objectWithName: (NSString *) key inContainer: (id) theContainer useCache: (BOOL) useCache
|
||||
{
|
||||
SOGoCache *cache;
|
||||
id o;
|
||||
|
||||
cache = [SOGoCache sharedCache];
|
||||
|
||||
if (!useCache)
|
||||
[cache unregisterObjectWithName: key inContainer: theContainer];
|
||||
|
||||
o = [cache objectNamed: key inContainer: theContainer];
|
||||
|
||||
if (!o)
|
||||
@@ -383,7 +394,7 @@ static EOAttribute *textColumn = nil;
|
||||
@"SELECT * FROM %@ WHERE c_path = %@",
|
||||
tableName, pathValue];
|
||||
if (startVersion > -1)
|
||||
[sql appendFormat: @" AND c_version > %d", startVersion];
|
||||
[sql appendFormat: @" AND c_version > %d", (int)startVersion];
|
||||
|
||||
/* execution */
|
||||
records = [self performSQLQuery: sql];
|
||||
@@ -411,15 +422,13 @@ static EOAttribute *textColumn = nil;
|
||||
|
||||
tableName = [self tableName];
|
||||
adaptor = [self tableChannelAdaptor];
|
||||
pathValue = [adaptor formatValue: [NSString stringWithFormat: @"/%@", deviceId]
|
||||
forAttribute: textColumn];
|
||||
|
||||
/* query */
|
||||
sql = [NSMutableString stringWithFormat:
|
||||
@"SELECT * FROM %@ WHERE c_type = %d AND c_deleted <> 1", tableName, objectType];
|
||||
|
||||
if (startVersion > -1)
|
||||
[sql appendFormat: @" AND c_version > %d", startVersion];
|
||||
[sql appendFormat: @" AND c_version > %d", (int)startVersion];
|
||||
|
||||
if (deviceId) {
|
||||
pathValue = [adaptor formatValue: [NSString stringWithFormat: @"/%@%", deviceId]
|
||||
@@ -546,7 +555,7 @@ static EOAttribute *textColumn = nil;
|
||||
|
||||
lastModifiedValue = (NSInteger) [lastModified timeIntervalSince1970];
|
||||
|
||||
if (objectType == -1)
|
||||
if (objectType == (SOGoCacheObjectType) -1)
|
||||
[NSException raise: @"SOGoCacheIOException"
|
||||
format: @"object type has not been set for object '%@'",
|
||||
self];
|
||||
@@ -576,7 +585,7 @@ static EOAttribute *textColumn = nil;
|
||||
@")"),
|
||||
tableName,
|
||||
pathValue, parentPathValue, objectType,
|
||||
creationDateValue, lastModifiedValue,
|
||||
(int)creationDateValue, (int)lastModifiedValue,
|
||||
propsValue];
|
||||
isNew = NO;
|
||||
}
|
||||
@@ -590,7 +599,7 @@ static EOAttribute *textColumn = nil;
|
||||
@" c_version = %d, c_content = %@"
|
||||
@" WHERE c_path = %@"),
|
||||
tableName,
|
||||
lastModifiedValue, deletedValue, version, propsValue,
|
||||
(int)lastModifiedValue, (int)deletedValue, (int)version, propsValue,
|
||||
pathValue];
|
||||
}
|
||||
|
||||
|
||||
@@ -42,8 +42,6 @@
|
||||
- (NSCalendarDate *) creationDate;
|
||||
- (NSCalendarDate *) lastModified;
|
||||
|
||||
- (NSException *) destroy;
|
||||
|
||||
@end
|
||||
|
||||
#endif /* SOGOCACHEOBJECT_H */
|
||||
|
||||
@@ -94,7 +94,7 @@
|
||||
{
|
||||
[self subclassResponsibility: _cmd];
|
||||
|
||||
return nil;
|
||||
return (Class *) nil;
|
||||
}
|
||||
|
||||
- (void) _setRecord: (NSDictionary *) objectRecord
|
||||
@@ -254,6 +254,9 @@
|
||||
- (NSException *) moveToFolder: (SOGoGCSFolder *) newFolder
|
||||
{
|
||||
[self subclassResponsibility: _cmd];
|
||||
|
||||
// TODO: Add exception handling code and return it
|
||||
return (NSException *) nil;
|
||||
}
|
||||
|
||||
- (NSException *) delete
|
||||
@@ -345,7 +348,7 @@
|
||||
|
||||
/* attempt a save */
|
||||
|
||||
error = [self saveComponent: [[self parsingClass] parseSingleFromSource: [rq contentAsString]]
|
||||
error = [self saveComponent: [(id)[self parsingClass] parseSingleFromSource: [rq contentAsString]]
|
||||
baseVersion: baseVersion];
|
||||
if (error)
|
||||
response = (WOResponse *) error;
|
||||
@@ -410,7 +413,7 @@
|
||||
else
|
||||
length = 0;
|
||||
|
||||
return [NSString stringWithFormat: @"%u", length];
|
||||
return [NSString stringWithFormat: @"%u", (unsigned int)length];
|
||||
}
|
||||
|
||||
- (NSException *) davMoveToTargetObject: (id) _target
|
||||
|
||||
@@ -58,6 +58,7 @@
|
||||
SOGoMailDomain = "localhost";
|
||||
SOGoSelectedAddressBook = "collected";
|
||||
SOGoRefreshViewCheck = "manually";
|
||||
SOGoAlternateAvatar = "none";
|
||||
SOGoMailMessageForwarding = "inline";
|
||||
SOGoMailReplyPlacement = "below";
|
||||
SOGoMailSignaturePlacement = "below";
|
||||
|
||||
@@ -107,7 +107,7 @@
|
||||
|
||||
- (void) setDisplayName: (NSString *) newDisplayName
|
||||
{
|
||||
ASSIGN (displayName, newDisplayName);
|
||||
ASSIGN (displayName, (NSMutableString *)newDisplayName);
|
||||
}
|
||||
|
||||
- (NSString *) displayName
|
||||
|
||||
@@ -77,6 +77,9 @@
|
||||
- (id) folderPropertyValueInCategory: (NSString *) theKey
|
||||
forUser: (SOGoUser *) theUser;
|
||||
|
||||
- (BOOL) synchronize;
|
||||
- (void) setSynchronize: (BOOL) new;
|
||||
|
||||
/* lower level fetches */
|
||||
- (void) deleteEntriesWithIds: (NSArray *) ids;
|
||||
|
||||
@@ -128,8 +131,8 @@
|
||||
|
||||
- (NSArray *) syncTokenFieldsWithProperties: (NSDictionary *) properties
|
||||
matchingSyncToken: (NSString *) syncToken
|
||||
fromDate: (NSCalendarDate *) theStartDate;
|
||||
|
||||
fromDate: (NSCalendarDate *) theStartDate
|
||||
initialLoad: (BOOL) initialLoadInProgress;
|
||||
|
||||
/* multiget helper */
|
||||
- (WOResponse *) performMultigetInContext: (WOContext *) queryContext
|
||||
|
||||
@@ -301,6 +301,29 @@ static NSArray *childRecordFields = nil;
|
||||
return name;
|
||||
}
|
||||
|
||||
- (BOOL) synchronize
|
||||
{
|
||||
NSNumber *synchronize;
|
||||
|
||||
synchronize = [self folderPropertyValueInCategory: @"FolderSynchronize"];
|
||||
|
||||
return [synchronize boolValue];
|
||||
}
|
||||
|
||||
- (void) setSynchronize: (BOOL) new
|
||||
{
|
||||
NSNumber *synchronize;
|
||||
|
||||
if (new)
|
||||
synchronize = [NSNumber numberWithBool: YES];
|
||||
else
|
||||
synchronize = nil;
|
||||
|
||||
[self setFolderPropertyValue: synchronize
|
||||
inCategory: @"FolderSynchronize"];
|
||||
}
|
||||
|
||||
|
||||
/* This method fetches the display name defined by the owner, but is also the
|
||||
fallback when a subscriber has not redefined the display name yet in their
|
||||
environment. */
|
||||
@@ -376,12 +399,12 @@ static NSArray *childRecordFields = nil;
|
||||
if (!displayName)
|
||||
{
|
||||
if (activeUserIsOwner)
|
||||
displayName = [self _displayNameFromOwner];
|
||||
displayName = (NSMutableString *)[self _displayNameFromOwner];
|
||||
else
|
||||
{
|
||||
displayName = [self _displayNameFromSubscriber];
|
||||
displayName = (NSMutableString *)[self _displayNameFromSubscriber];
|
||||
if (!displayName)
|
||||
displayName = [self _displayNameFromOwner];
|
||||
displayName = (NSMutableString *)[self _displayNameFromOwner];
|
||||
}
|
||||
[displayName retain];
|
||||
}
|
||||
@@ -829,7 +852,7 @@ static NSArray *childRecordFields = nil;
|
||||
{
|
||||
currentID = [ids objectAtIndex: count];
|
||||
names = [[currentID componentsSeparatedByString: @"/"] objectEnumerator];
|
||||
deleteObject = self;
|
||||
deleteObject = (SOGoContentObject *)self;
|
||||
while ((currentName = [names nextObject]))
|
||||
{
|
||||
deleteObject = [deleteObject lookupName: currentName
|
||||
@@ -1151,6 +1174,7 @@ static NSArray *childRecordFields = nil;
|
||||
- (NSArray *) syncTokenFieldsWithProperties: (NSDictionary *) properties
|
||||
matchingSyncToken: (NSString *) syncToken
|
||||
fromDate: (NSCalendarDate *) theStartDate
|
||||
initialLoad: (BOOL) initialLoadInProgress
|
||||
{
|
||||
/* TODO:
|
||||
- validation:
|
||||
@@ -1200,13 +1224,17 @@ static NSArray *childRecordFields = nil;
|
||||
mRecords = [NSMutableArray arrayWithArray: [self _fetchFields: fields
|
||||
withQualifier: qualifier
|
||||
ignoreDeleted: YES]];
|
||||
qualifier = [EOQualifier qualifierWithQualifierFormat:
|
||||
@"c_lastmodified > %d and c_deleted == 1",
|
||||
syncTokenInt];
|
||||
fields = [NSMutableArray arrayWithObjects: @"c_name", @"c_deleted", nil];
|
||||
[mRecords addObjectsFromArray: [self _fetchFields: fields
|
||||
withQualifier: qualifier
|
||||
ignoreDeleted: NO]];
|
||||
if (!initialLoadInProgress)
|
||||
{
|
||||
qualifier = [EOQualifier qualifierWithQualifierFormat:
|
||||
@"c_lastmodified > %d and c_deleted == 1",
|
||||
syncTokenInt];
|
||||
fields = [NSMutableArray arrayWithObjects: @"c_name", @"c_lastmodified", @"c_deleted", nil];
|
||||
[mRecords addObjectsFromArray: [self _fetchFields: fields
|
||||
withQualifier: qualifier
|
||||
ignoreDeleted: NO]];
|
||||
}
|
||||
|
||||
records = mRecords;
|
||||
}
|
||||
else
|
||||
@@ -1499,7 +1527,9 @@ static NSArray *childRecordFields = nil;
|
||||
properties = [self parseDAVRequestedProperties: propElement];
|
||||
records = [self syncTokenFieldsWithProperties: properties
|
||||
matchingSyncToken: syncToken
|
||||
fromDate: nil];
|
||||
fromDate: nil
|
||||
initialLoad: NO];
|
||||
|
||||
[self _appendComponentProperties: [properties allKeys]
|
||||
fromRecords: records
|
||||
matchingSyncToken: [syncToken intValue]
|
||||
|
||||
@@ -135,7 +135,7 @@
|
||||
{
|
||||
NSArray *allSources;
|
||||
NGLdapEntry *entry;
|
||||
NSObject <SOGoSource> *source;
|
||||
NSObject <SOGoSource, SOGoDNSource> *source;
|
||||
id o;
|
||||
NSEnumerator *gclasses;
|
||||
NSString *gclass;
|
||||
@@ -154,7 +154,7 @@
|
||||
|
||||
for (i = 0; i < [allSources count]; i++)
|
||||
{
|
||||
source = [[SOGoUserManager sharedUserManager] sourceWithID: [allSources objectAtIndex: i]];
|
||||
source = (NSObject <SOGoSource, SOGoDNSource> *) [[SOGoUserManager sharedUserManager] sourceWithID: [allSources objectAtIndex: i]];
|
||||
|
||||
// Our different sources might not all implements groups support
|
||||
if ([source respondsToSelector: theSelector])
|
||||
|
||||
@@ -1066,7 +1066,7 @@
|
||||
[_ms appendFormat:@" name=%@", nameInContainer];
|
||||
if (container)
|
||||
[_ms appendFormat:@" container=0x%08X/%@",
|
||||
container, [container valueForKey:@"nameInContainer"]];
|
||||
(unsigned int)container, [container valueForKey:@"nameInContainer"]];
|
||||
}
|
||||
|
||||
- (NSString *) description
|
||||
@@ -1074,7 +1074,7 @@
|
||||
NSMutableString *ms;
|
||||
|
||||
ms = [NSMutableString stringWithCapacity:64];
|
||||
[ms appendFormat:@"<0x%08X[%@]:", self, NSStringFromClass([self class])];
|
||||
[ms appendFormat:@"<0x%08X[%@]:", (unsigned int) self, NSStringFromClass([self class])];
|
||||
[self appendAttributesToDescription:ms];
|
||||
[ms appendString:@">"];
|
||||
|
||||
@@ -1084,7 +1084,7 @@
|
||||
- (NSString *) loggingPrefix
|
||||
{
|
||||
return [NSString stringWithFormat:@"<0x%08X[%@]:%@>",
|
||||
self, NSStringFromClass([self class]),
|
||||
(unsigned int) self, NSStringFromClass([self class]),
|
||||
[self nameInContainer]];
|
||||
}
|
||||
|
||||
|
||||
@@ -433,7 +433,7 @@ static SoSecurityManager *sm = nil;
|
||||
error = [self appendPersonalSources];
|
||||
if (!error)
|
||||
if ([self respondsToSelector:@selector(appendCollectedSources)])
|
||||
error = [self appendCollectedSources];
|
||||
error = [self performSelector:@selector(appendCollectedSources)];
|
||||
if (!error)
|
||||
error = [self appendSystemSources]; // TODO : Not really a testcase, see function
|
||||
if (error)
|
||||
|
||||
@@ -120,6 +120,9 @@ extern NSString *SOGoWeekStartFirstFullWeek;
|
||||
- (void) setRefreshViewCheck: (NSString *) newValue;
|
||||
- (NSString *) refreshViewCheck;
|
||||
|
||||
- (void) setAlternateAvatar: (NSString *) newValue;
|
||||
- (NSString *) alternateAvatar;
|
||||
|
||||
- (void) setMailComposeMessageType: (NSString *) newValue;
|
||||
- (NSString *) mailComposeMessageType;
|
||||
|
||||
|
||||
@@ -498,6 +498,16 @@ NSString *SOGoWeekStartFirstFullWeek = @"FirstFullWeek";
|
||||
return [self stringForKey: @"SOGoRefreshViewCheck"];
|
||||
}
|
||||
|
||||
- (void) setAlternateAvatar: (NSString *) newValue
|
||||
{
|
||||
[self setObject: newValue forKey: @"SOGoAlternateAvatar"];
|
||||
}
|
||||
|
||||
- (NSString *) alternateAvatar
|
||||
{
|
||||
return [self stringForKey: @"SOGoAlternateAvatar"];
|
||||
}
|
||||
|
||||
- (void) setMailComposeMessageType: (NSString *) newValue
|
||||
{
|
||||
[self setObject: newValue forKey: @"SOGoMailComposeMessageType"];
|
||||
|
||||
@@ -880,7 +880,7 @@
|
||||
|
||||
reason = [NSString stringWithFormat: @"method '%@' is not available"
|
||||
@" for class '%@'", NSStringFromSelector (_cmd),
|
||||
NSStringFromClass (isa)];
|
||||
NSStringFromClass (object_getClass(self))];
|
||||
|
||||
return [NSException exceptionWithName: @"SQLSourceIOException"
|
||||
reason: reason
|
||||
@@ -893,7 +893,7 @@
|
||||
|
||||
reason = [NSString stringWithFormat: @"method '%@' is not available"
|
||||
@" for class '%@'", NSStringFromSelector (_cmd),
|
||||
NSStringFromClass (isa)];
|
||||
NSStringFromClass (object_getClass(self))];
|
||||
|
||||
return [NSException exceptionWithName: @"SQLSourceIOException"
|
||||
reason: reason
|
||||
@@ -906,7 +906,7 @@
|
||||
|
||||
reason = [NSString stringWithFormat: @"method '%@' is not available"
|
||||
@" for class '%@'", NSStringFromSelector (_cmd),
|
||||
NSStringFromClass (isa)];
|
||||
NSStringFromClass (object_getClass(self))];
|
||||
|
||||
return [NSException exceptionWithName: @"SQLSourceIOException"
|
||||
reason: reason
|
||||
@@ -932,7 +932,7 @@
|
||||
|
||||
reason = [NSString stringWithFormat: @"method '%@' is not available"
|
||||
@" for class '%@'", NSStringFromSelector (_cmd),
|
||||
NSStringFromClass (isa)];
|
||||
NSStringFromClass (object_getClass(self))];
|
||||
|
||||
return [NSException exceptionWithName: @"SQLSourceIOException"
|
||||
reason: reason
|
||||
@@ -947,7 +947,7 @@
|
||||
|
||||
reason = [NSString stringWithFormat: @"method '%@' is not available"
|
||||
@" for class '%@'", NSStringFromSelector (_cmd),
|
||||
NSStringFromClass (isa)];
|
||||
NSStringFromClass (object_getClass(self))];
|
||||
|
||||
return [NSException exceptionWithName: @"SQLSourceIOException"
|
||||
reason: reason
|
||||
@@ -961,7 +961,7 @@
|
||||
|
||||
reason = [NSString stringWithFormat: @"method '%@' is not available"
|
||||
@" for class '%@'", NSStringFromSelector (_cmd),
|
||||
NSStringFromClass (isa)];
|
||||
NSStringFromClass (object_getClass(self))];
|
||||
|
||||
return [NSException exceptionWithName: @"SQLSourceIOException"
|
||||
reason: reason
|
||||
|
||||
@@ -180,14 +180,21 @@
|
||||
cc = [self clientCapabilities];
|
||||
|
||||
b = (
|
||||
[[cc userAgent] rangeOfString: @"CFNetwork"].location != NSNotFound
|
||||
&& [[cc userAgent] rangeOfString: @"Darwin"].location != NSNotFound
|
||||
|| (
|
||||
[[cc userAgent] rangeOfString: @"CFNetwork"].location != NSNotFound
|
||||
|| [[cc userAgent] rangeOfString: @"Mac OS X"].location != NSNotFound
|
||||
)
|
||||
&& [[cc userAgent] rangeOfString: @"AddressBook"].location != NSNotFound
|
||||
);
|
||||
(
|
||||
[[cc userAgent] rangeOfString: @"CFNetwork"].location != NSNotFound
|
||||
&& [[cc userAgent] rangeOfString: @"Darwin"].location != NSNotFound
|
||||
)
|
||||
||
|
||||
(
|
||||
[[cc userAgent] rangeOfString: @"CFNetwork"].location != NSNotFound
|
||||
&& [[cc userAgent] rangeOfString: @"AddressBook"].location != NSNotFound
|
||||
)
|
||||
||
|
||||
(
|
||||
[[cc userAgent] rangeOfString: @"Mac OS X"].location != NSNotFound
|
||||
&& [[cc userAgent] rangeOfString: @"AddressBook"].location != NSNotFound
|
||||
)
|
||||
);
|
||||
|
||||
return b;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user