feat(carddav): fix issue where only personal contacts can be synced on macOS (#1981). When , append the addressbook name as a username suffix to force macOS to treat each book as a distinct account. Usernames must not contain . Install via the provisioning profile. Closes #6033.

This commit is contained in:
smizrahi
2026-05-11 14:21:35 +02:00
parent d16a1a9708
commit 761934af42
13 changed files with 136 additions and 9 deletions
+21
View File
@@ -144,11 +144,26 @@
realUID = nil;
domain = nil;
ASSIGN (loginAlias, newLogin);
if ([newLogin isEqualToString: @"anonymous"] || [newLogin isEqualToString: @"freebusy"])
realUID = newLogin;
else
{
sd = [SOGoSystemDefaults sharedSystemDefaults];
/* Per-addressbook CardDAV profile: strip the alias suffix so that a login
of the form <user>!<book> resolves to the real user <user>. The book
part is consumed elsewhere (Main/SOGo.m, SOGoContactFolders) to filter
the addressbook listing. The original alias is kept in loginAlias so
that DAV property hrefs (current-user-principal, etc.) preserve it. */
if ([sd carddavSingleAddressBookProfile])
{
NSRange aliasRange = [newLogin rangeOfString: @"!"];
if (aliasRange.location != NSNotFound)
newLogin = [newLogin substringToIndex: aliasRange.location];
}
if ([sd enableDomainBasedUID] || [[sd loginDomains] count] > 0)
{
r = [newLogin rangeOfString: @"@" options: NSBackwardsSearch];
@@ -243,9 +258,15 @@
[currentPassword release];
[cn release];
[loginInDomain release];
[loginAlias release];
[super dealloc];
}
- (NSString *) loginAlias
{
return [loginAlias length] ? loginAlias : self->login;
}
- (void) setPrimaryRoles: (NSArray *) newRoles
{
ASSIGN (roles, newRoles);