mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-07-15 05:14:53 +00:00
Merge pull request #184 from zentyal/master
Fixes from Zentyal since 2015/12/30
This commit is contained in:
@@ -23,6 +23,7 @@
|
||||
#import <NGObjWeb/WOContext+SoObjects.h>
|
||||
#import <SOGo/SOGoUser.h>
|
||||
#import <SOGo/SOGoUserManager.h>
|
||||
#import <SOGo/SOGoSystemDefaults.h>
|
||||
|
||||
#import "iCalPerson+SOGo.h"
|
||||
|
||||
@@ -64,6 +65,10 @@ static SOGoUserManager *um = nil;
|
||||
return [um getUIDForEmail: [self rfc822Email]];
|
||||
}
|
||||
|
||||
/*
|
||||
It returns the login if the email of the iCalPerson exists on the
|
||||
domain of the current active user
|
||||
*/
|
||||
- (NSString *) uidInContext: (WOContext *) context
|
||||
{
|
||||
NSString *domain;
|
||||
@@ -73,18 +78,29 @@ static SOGoUserManager *um = nil;
|
||||
return [self uidInDomain: domain];
|
||||
}
|
||||
|
||||
/*
|
||||
It returns the login if the email of the iCalPerson exists on the
|
||||
given domain
|
||||
*/
|
||||
- (NSString *) uidInDomain: (NSString *) domain
|
||||
{
|
||||
NSDictionary *contact;
|
||||
NSString *uid;
|
||||
NSString *uid = nil;
|
||||
|
||||
if (!um)
|
||||
um = [SOGoUserManager sharedUserManager];
|
||||
|
||||
uid = nil;
|
||||
contact = [um contactInfosForUserWithUIDorEmail: [self rfc822Email] inDomain: domain];
|
||||
if (contact)
|
||||
uid = [contact valueForKey: @"c_uid"];
|
||||
contact = [um contactInfosForUserWithUIDorEmail: [self rfc822Email]
|
||||
inDomain: domain];
|
||||
if (!contact) return nil;
|
||||
|
||||
uid = [contact valueForKey: @"c_uid"];
|
||||
|
||||
// On multidomain environment without DomainLessLogin enabled the login
|
||||
// must have the @domain suffix
|
||||
if ([[SOGoSystemDefaults sharedSystemDefaults] enableDomainBasedUID]
|
||||
&& ![[contact objectForKey: @"DomainLessLogin"] boolValue])
|
||||
uid = [NSString stringWithFormat:@"%@@%@", uid, domain];
|
||||
|
||||
return uid;
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#import <Foundation/NSAutoreleasePool.h>
|
||||
#import <Foundation/NSData.h>
|
||||
#import <Foundation/NSDictionary.h>
|
||||
#import <Foundation/NSFileManager.h>
|
||||
#import <Foundation/NSKeyValueCoding.h>
|
||||
#import <Foundation/NSProcessInfo.h>
|
||||
#import <Foundation/NSURL.h>
|
||||
@@ -1094,7 +1095,7 @@ static NSString *userAgent = nil;
|
||||
- (NSException *) saveAttachment: (NSData *) _attach
|
||||
withMetadata: (NSDictionary *) metadata
|
||||
{
|
||||
NSString *p, *name, *mimeType;
|
||||
NSString *p, *pmime, *name, *mimeType;
|
||||
NSRange r;
|
||||
|
||||
if (![_attach isNotNull]) {
|
||||
@@ -1126,14 +1127,13 @@ static NSString *userAgent = nil;
|
||||
mimeType = [metadata objectForKey: @"mimetype"];
|
||||
if ([mimeType length] > 0)
|
||||
{
|
||||
p = [self pathToAttachmentWithName:
|
||||
[NSString stringWithFormat: @".%@.mime", name]];
|
||||
if (![[mimeType dataUsingEncoding: NSUTF8StringEncoding]
|
||||
writeToFile: p atomically: YES])
|
||||
{
|
||||
return [NSException exceptionWithHTTPStatus:500 /* Server Error */
|
||||
reason: @"Could not write attachment to draft!"];
|
||||
}
|
||||
pmime = [self pathToAttachmentWithName: [NSString stringWithFormat: @".%@.mime", name]];
|
||||
if (![[mimeType dataUsingEncoding: NSUTF8StringEncoding] writeToFile: pmime atomically: YES])
|
||||
{
|
||||
[[NSFileManager defaultManager] removeItemAtPath: p error: nil];
|
||||
return [NSException exceptionWithHTTPStatus: 500 /* Server Error */
|
||||
reason: @"Could not write attachment to draft!"];
|
||||
}
|
||||
}
|
||||
|
||||
return nil; /* everything OK */
|
||||
|
||||
@@ -492,36 +492,7 @@ static int cssEscapingCount;
|
||||
|
||||
- (NSString *) asQPSubjectString: (NSString *) encoding
|
||||
{
|
||||
NSString *qpString, *subjectString;
|
||||
NSData *subjectData, *destSubjectData;
|
||||
NSUInteger length, destLength;
|
||||
unsigned char *destString;
|
||||
|
||||
#warning "encoding" parameter is not useful
|
||||
subjectData = [self dataUsingEncoding: NSUTF8StringEncoding];
|
||||
length = [subjectData length];
|
||||
destLength = length * 3;
|
||||
destString = calloc (destLength, sizeof (char));
|
||||
|
||||
NGEncodeQuotedPrintableMime ([subjectData bytes], length,
|
||||
destString, destLength);
|
||||
|
||||
destSubjectData = [NSData dataWithBytesNoCopy: destString
|
||||
length: strlen ((char *) destString)
|
||||
freeWhenDone: YES];
|
||||
qpString = [[NSString alloc] initWithData: destSubjectData
|
||||
encoding: NSASCIIStringEncoding];
|
||||
[qpString autorelease];
|
||||
if ([qpString length] > [self length])
|
||||
{
|
||||
qpString = [qpString stringByReplacingString: @" " withString: @"_"];
|
||||
subjectString = [NSString stringWithFormat: @"=?%@?q?%@?=",
|
||||
encoding, qpString];
|
||||
}
|
||||
else
|
||||
subjectString = self;
|
||||
|
||||
return subjectString;
|
||||
return [NGMimeHeaderFieldGenerator encodeQuotedPrintableText: self];
|
||||
}
|
||||
|
||||
- (BOOL) caseInsensitiveMatches: (NSString *) match
|
||||
|
||||
Reference in New Issue
Block a user