mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-05-21 11:25:24 +00:00
Merge pull request #125 from Zentyal/jgarcia/multidomain-outlook-entryId
All this basically is to make it work on multidomain environment the Reply all functionality of emails but I'm sure there are more use cases as an Outlook client that don't work nowadays without this patch. More info on commit message but basically it was that we were using user instead of user@domain.com in several places.
This commit is contained in:
@@ -5,15 +5,16 @@ Enhancements
|
||||
- Synchronize events, contacts and tasks in reverse chronological order
|
||||
|
||||
Bug fixes
|
||||
- Outlook clients can use reply all functionality on multidomain environment
|
||||
- Optional attendes on events are now shown properly
|
||||
|
||||
2.2.17a-zentyal1 (2014-04-15)
|
||||
2.2.17a-zentyal1 (2015-04-15)
|
||||
--------------------
|
||||
|
||||
Bug fixes
|
||||
- Do not share Outlook metadata between users with the same name and different domain
|
||||
|
||||
2.2.17a (2014-03-15)
|
||||
2.2.17a (2015-03-15)
|
||||
--------------------
|
||||
|
||||
Bug fixes
|
||||
|
||||
@@ -264,7 +264,7 @@ static NSCharacterSet *hexCharacterSet = nil;
|
||||
|
||||
if (contactInfos)
|
||||
{
|
||||
username = [contactInfos objectForKey: @"c_uid"];
|
||||
username = [contactInfos objectForKey: @"sAMAccountName"];
|
||||
recipient->username = [username asUnicodeInMemCtx: msgData];
|
||||
entryId = MAPIStoreInternalEntryId (connInfo->sam_ctx, username);
|
||||
}
|
||||
@@ -365,7 +365,7 @@ static NSCharacterSet *hexCharacterSet = nil;
|
||||
|
||||
if (contactInfos)
|
||||
{
|
||||
username = [contactInfos objectForKey: @"c_uid"];
|
||||
username = [contactInfos objectForKey: @"sAMAccountName"];
|
||||
recipient->username = [username asUnicodeInMemCtx: msgData];
|
||||
entryId = MAPIStoreInternalEntryId (connInfo->sam_ctx, username);
|
||||
}
|
||||
@@ -931,7 +931,7 @@ static NSCharacterSet *hexCharacterSet = nil;
|
||||
contactInfos = [mgr contactInfosForUserWithUIDorEmail: email];
|
||||
if (contactInfos)
|
||||
{
|
||||
username = [contactInfos objectForKey: @"c_uid"];
|
||||
username = [contactInfos objectForKey: @"sAMAccountName"];
|
||||
entryId = MAPIStoreInternalEntryId (connInfo->sam_ctx, username);
|
||||
}
|
||||
else
|
||||
|
||||
@@ -803,7 +803,7 @@ _compareBodyKeysByPriority (id entry1, id entry2, void *data)
|
||||
contactInfos = [mgr contactInfosForUserWithUIDorEmail: email];
|
||||
if (contactInfos)
|
||||
{
|
||||
username = [contactInfos objectForKey: @"c_uid"];
|
||||
username = [contactInfos objectForKey: @"sAMAccountName"];
|
||||
samCtx = [[self context] connectionInfo]->sam_ctx;
|
||||
entryId = MAPIStoreInternalEntryId (samCtx, username);
|
||||
}
|
||||
@@ -1501,10 +1501,10 @@ _compareBodyKeysByPriority (id entry1, id entry2, void *data)
|
||||
if ([cn length] == 0)
|
||||
cn = email;
|
||||
contactInfos = [mgr contactInfosForUserWithUIDorEmail: email];
|
||||
|
||||
|
||||
if (contactInfos)
|
||||
{
|
||||
username = [contactInfos objectForKey: @"c_uid"];
|
||||
username = [contactInfos objectForKey: @"sAMAccountName"];
|
||||
recipient->username = [username asUnicodeInMemCtx: msgData];
|
||||
entryId = MAPIStoreInternalEntryId (samCtx, username);
|
||||
}
|
||||
|
||||
@@ -386,7 +386,7 @@ static NSString *recTypes[] = { @"orig", @"to", @"cc", @"bcc" };
|
||||
contactInfos = [mgr contactInfosForUserWithUIDorEmail: email];
|
||||
if (contactInfos)
|
||||
{
|
||||
username = [contactInfos objectForKey: @"c_uid"];
|
||||
username = [contactInfos objectForKey: @"sAMAccountName"];
|
||||
recipient->username = [username asUnicodeInMemCtx: msgData];
|
||||
entryId = MAPIStoreInternalEntryId (samCtx, username);
|
||||
}
|
||||
|
||||
@@ -96,8 +96,11 @@ MAPIStoreInternalEntryId (struct ldb_context *samCtx, NSString *username)
|
||||
[entryId appendUInt8: 0]; // end of string
|
||||
}
|
||||
else
|
||||
entryId = nil;
|
||||
|
||||
{
|
||||
NSLog (@"Error trying to generate EntryId for `%@`", username);
|
||||
entryId = nil;
|
||||
}
|
||||
|
||||
return entryId;
|
||||
}
|
||||
|
||||
|
||||
@@ -664,7 +664,7 @@ static Class NSNullK;
|
||||
//
|
||||
//
|
||||
- (void) _fillContactInfosForUser: (NSMutableDictionary *) currentUser
|
||||
withUIDorEmail: (NSString *) uid
|
||||
withUIDorEmail: (NSString *) uid
|
||||
inDomain: (NSString *) domain
|
||||
{
|
||||
NSString *sourceID, *cn, *c_domain, *c_uid, *c_imaphostname, *c_imaplogin, *c_sievehostname;
|
||||
@@ -685,12 +685,11 @@ static Class NSNullK;
|
||||
c_sievehostname = nil;
|
||||
|
||||
[currentUser setObject: [NSNumber numberWithBool: YES]
|
||||
forKey: @"CalendarAccess"];
|
||||
forKey: @"CalendarAccess"];
|
||||
[currentUser setObject: [NSNumber numberWithBool: YES]
|
||||
forKey: @"MailAccess"];
|
||||
forKey: @"MailAccess"];
|
||||
|
||||
sogoSources = [[self authenticationSourceIDsInDomain: domain]
|
||||
objectEnumerator];
|
||||
sogoSources = [[self authenticationSourceIDsInDomain: domain] objectEnumerator];
|
||||
userEntry = nil;
|
||||
while (!userEntry && (sourceID = [sogoSources nextObject]))
|
||||
{
|
||||
@@ -698,44 +697,49 @@ static Class NSNullK;
|
||||
userEntry = [currentSource lookupContactEntryWithUIDorEmail: uid
|
||||
inDomain: domain];
|
||||
if (userEntry)
|
||||
{
|
||||
{
|
||||
[currentUser setObject: sourceID forKey: @"SOGoSource"];
|
||||
if (!cn)
|
||||
cn = [userEntry objectForKey: @"c_cn"];
|
||||
if (!c_uid)
|
||||
c_uid = [userEntry objectForKey: @"c_uid"];
|
||||
if (!cn)
|
||||
cn = [userEntry objectForKey: @"c_cn"];
|
||||
if (!c_uid)
|
||||
c_uid = [userEntry objectForKey: @"c_uid"];
|
||||
if (!c_domain)
|
||||
c_domain = [userEntry objectForKey: @"c_domain"];
|
||||
c_emails = [userEntry objectForKey: @"c_emails"];
|
||||
if ([c_emails count])
|
||||
[emails addObjectsFromArray: c_emails];
|
||||
if (!c_imaphostname)
|
||||
c_imaphostname = [userEntry objectForKey: @"c_imaphostname"];
|
||||
c_emails = [userEntry objectForKey: @"c_emails"];
|
||||
if ([c_emails count])
|
||||
[emails addObjectsFromArray: c_emails];
|
||||
if (!c_imaphostname)
|
||||
c_imaphostname = [userEntry objectForKey: @"c_imaphostname"];
|
||||
if (!c_imaplogin)
|
||||
c_imaplogin = [userEntry objectForKey: @"c_imaplogin"];
|
||||
if (!c_sievehostname)
|
||||
c_sievehostname = [userEntry objectForKey: @"c_sievehostname"];
|
||||
access = [[userEntry objectForKey: @"CalendarAccess"] boolValue];
|
||||
if (!access)
|
||||
[currentUser setObject: [NSNumber numberWithBool: NO]
|
||||
forKey: @"CalendarAccess"];
|
||||
access = [[userEntry objectForKey: @"MailAccess"] boolValue];
|
||||
if (!access)
|
||||
[currentUser setObject: [NSNumber numberWithBool: NO]
|
||||
forKey: @"MailAccess"];
|
||||
|
||||
// We check if it's a group
|
||||
access = [[userEntry objectForKey: @"CalendarAccess"] boolValue];
|
||||
if (!access)
|
||||
[currentUser setObject: [NSNumber numberWithBool: NO]
|
||||
forKey: @"CalendarAccess"];
|
||||
access = [[userEntry objectForKey: @"MailAccess"] boolValue];
|
||||
if (!access)
|
||||
[currentUser setObject: [NSNumber numberWithBool: NO]
|
||||
forKey: @"MailAccess"];
|
||||
|
||||
// We check if it's a group
|
||||
isGroup = [userEntry objectForKey: @"isGroup"];
|
||||
if (isGroup)
|
||||
[currentUser setObject: isGroup forKey: @"isGroup"];
|
||||
|
||||
// We also fill the resource attributes, if any
|
||||
if ([userEntry objectForKey: @"isResource"])
|
||||
[currentUser setObject: [userEntry objectForKey: @"isResource"]
|
||||
forKey: @"isResource"];
|
||||
if ([userEntry objectForKey: @"numberOfSimultaneousBookings"])
|
||||
[currentUser setObject: [userEntry objectForKey: @"numberOfSimultaneousBookings"]
|
||||
forKey: @"numberOfSimultaneousBookings"];
|
||||
// We also fill the resource attributes, if any
|
||||
if ([userEntry objectForKey: @"isResource"])
|
||||
[currentUser setObject: [userEntry objectForKey: @"isResource"]
|
||||
forKey: @"isResource"];
|
||||
if ([userEntry objectForKey: @"numberOfSimultaneousBookings"])
|
||||
[currentUser setObject: [userEntry objectForKey: @"numberOfSimultaneousBookings"]
|
||||
forKey: @"numberOfSimultaneousBookings"];
|
||||
|
||||
// This is Active Directory specific attribute (needed on OpenChange/* layer)
|
||||
if ([userEntry objectForKey: @"samaccountname"])
|
||||
[currentUser setObject: [userEntry objectForKey: @"samaccountname"]
|
||||
forKey: @"sAMAccountName"];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -745,7 +749,7 @@ static Class NSNullK;
|
||||
c_uid = @"";
|
||||
if (!c_domain)
|
||||
c_domain = @"";
|
||||
|
||||
|
||||
if (c_imaphostname)
|
||||
[currentUser setObject: c_imaphostname forKey: @"c_imaphostname"];
|
||||
if (c_imaplogin)
|
||||
|
||||
Reference in New Issue
Block a user