From 2cd21052bd64675dbbe4f25b7d6c90df48fff1e2 Mon Sep 17 00:00:00 2001 From: Ludovic Marcotte Date: Thu, 20 Dec 2018 13:34:24 -0500 Subject: [PATCH] (feat) support for basic UserInformation queries (fixes #4614) --- ActiveSync/SOGoActiveSyncDispatcher.m | 42 +++++++++++++++++++++++++++ NEWS | 1 + 2 files changed, 43 insertions(+) diff --git a/ActiveSync/SOGoActiveSyncDispatcher.m b/ActiveSync/SOGoActiveSyncDispatcher.m index 3e57221c3..f7ff756a2 100644 --- a/ActiveSync/SOGoActiveSyncDispatcher.m +++ b/ActiveSync/SOGoActiveSyncDispatcher.m @@ -3622,6 +3622,48 @@ void handle_eas_terminate(int signum) } } + if ([(id)[[(id)[theDocumentElement getElementsByTagName: @"UserInformation"] lastObject] getElementsByTagName: @"Get"] lastObject]) + { + NSArray *identities; + int i; + + identities = [[context activeUser] allIdentities]; + + [s appendString: @""]; + [s appendString: @""]; + + if ([[context objectForKey: @"ASProtocolVersion"] floatValue] >= 14.1) + { + [s appendString: @""]; + [s appendString: @""]; + [s appendFormat: @"%@", [[[identities objectAtIndex: 0] objectForKey: @"fullName"] activeSyncRepresentationInContext: context] ]; + } + + [s appendString: @""]; + + if ([[context objectForKey: @"ASProtocolVersion"] floatValue] >= 14.1) + [s appendFormat: @"%@", [[[identities objectAtIndex: 0] objectForKey: @"email"] activeSyncRepresentationInContext: context] ]; + else + [s appendFormat: @"%@", [[[identities objectAtIndex: 0] objectForKey: @"email"] activeSyncRepresentationInContext: context] ]; + + if ([identities count] > 1) + { + for (i = 1; i < [identities count]; i++) + [s appendFormat: @"%@", [[[identities objectAtIndex: i] objectForKey: @"email"] activeSyncRepresentationInContext: context] ]; + } + + [s appendString: @""]; + + if ([[context objectForKey: @"ASProtocolVersion"] floatValue] >= 14.1) + { + [s appendString: @""]; + [s appendString: @""]; + } + + [s appendString: @""]; + [s appendString: @""]; + } + [s appendString: @""]; d = [[s dataUsingEncoding: NSUTF8StringEncoding] xml2wbxml]; diff --git a/NEWS b/NEWS index 1766fa871..1cbf5e0f3 100644 --- a/NEWS +++ b/NEWS @@ -5,6 +5,7 @@ Bug fixes - [eas] strip '<>' from bodyId and when forwarding mails - [eas] fix search on for Outlook application (#4605 and #4607) - [eas] better handle bogus DTStart values + - [eas] support for basic UserInformation queries (#4614) 4.0.1 (2018-07-10) ------------------