From d92b0341fbd5aa8f7b711a4cec9198dc34ca899c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs=20Garc=C3=ADa=20S=C3=A1ez?= Date: Thu, 28 May 2015 17:28:52 +0200 Subject: [PATCH] sogo-tool restore works in multidomain environments c_uid is not unique globally when multidomain is enabled --- Tools/SOGoToolRestore.m | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/Tools/SOGoToolRestore.m b/Tools/SOGoToolRestore.m index 54e3179bd..a0f411bd9 100644 --- a/Tools/SOGoToolRestore.m +++ b/Tools/SOGoToolRestore.m @@ -40,6 +40,7 @@ #import #import #import +#import #import #import @@ -154,10 +155,22 @@ BOOL rc; SOGoUserManager *lm; NSDictionary *infos; + SOGoSystemDefaults *sd; + NSString *uid = nil; lm = [SOGoUserManager sharedUserManager]; infos = [lm contactInfosForUserWithUIDorEmail: identifier]; - ASSIGN (userID, [infos objectForKey: @"c_uid"]); + if (infos) + { + sd = [SOGoSystemDefaults sharedSystemDefaults]; + if ([sd enableDomainBasedUID]) + uid = [NSString stringWithFormat: @"%@@%@", + [infos objectForKey: @"c_uid"], + [infos objectForKey: @"c_domain"]]; + else + uid = [infos objectForKey: @"c_uid"]; + } + ASSIGN (userID, uid); if (userID) rc = YES; else