From ccd9e385a0e88b0dc086dc6adf1f44c96ac96309 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Vall=C3=A9s?= Date: Mon, 28 Dec 2015 11:04:39 +0100 Subject: [PATCH] Add the domain in the `uidInDomain` method This method is used to get the login and we weren't returning the domain, which led to problems when creating appointments on multidomain environments like, for instance, not sending the invitation mails. --- SoObjects/Appointments/iCalPerson+SOGo.m | 26 +++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/SoObjects/Appointments/iCalPerson+SOGo.m b/SoObjects/Appointments/iCalPerson+SOGo.m index 986960902..fc14cf0fd 100644 --- a/SoObjects/Appointments/iCalPerson+SOGo.m +++ b/SoObjects/Appointments/iCalPerson+SOGo.m @@ -23,6 +23,7 @@ #import #import #import +#import #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; }