Skip to content

Commit 46a312e

Browse files
grammmikejengelh
authored andcommitted
ews: support GetUserAvailabilityRequest request TimeZoneContext tag
When no timezone is provided for GUA, look for a timezone context instead. References: GXL-576
1 parent 7c01fa9 commit 46a312e

File tree

2 files changed

+22
-2
lines changed

2 files changed

+22
-2
lines changed

doc/install.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
..
22
SPDX-License-Identifier: CC-BY-SA-4.0 or-later
3-
SPDX-FileCopyrightText: 2024 grommunio GmbH
3+
SPDX-FileCopyrightText: 2025 grommunio GmbH
44
55
Dependency installation
66
=======================
@@ -14,7 +14,7 @@ dependencies are needed:
1414
* cURL library
1515
* fmt >= 8
1616
* jsoncpp
17-
* libHX >= 4.27
17+
* libHX >= 4.28
1818
* libiconv (OpenBSD)
1919
* libxml2 (we use this for HTML parsing)
2020
* libzstd >= 1.4

exch/ews/requests.cpp

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include <variant>
1111
#include <vector>
1212
#include <libHX/scope.hpp>
13+
#include <libHX/string.h>
1314
#include <sys/stat.h>
1415
#include <sys/wait.h>
1516
#include <gromox/ab_tree.hpp>
@@ -1137,6 +1138,25 @@ void process(mGetUserAvailabilityRequest&& request, XMLElement* response, const
11371138

11381139
if (!request.FreeBusyViewOptions && !request.SuggestionsViewOptions)
11391140
throw EWSError::InvalidFreeBusyViewType(E3013);
1141+
if (!request.TimeZone) {
1142+
auto tag = ctx.request().header;
1143+
if (tag != nullptr)
1144+
tag = tag->FirstChildElement("t:TimeZoneContext");
1145+
if (tag != nullptr)
1146+
tag = tag->FirstChildElement("t:TimeZoneDefinition");
1147+
if (tag != nullptr)
1148+
tag = tag->FirstChildElement("t:Periods");
1149+
if (tag != nullptr)
1150+
tag = tag->FirstChildElement("t:Period");
1151+
/* Input is like <t:Period Bias="P0DT0H0M0.0S" Name="Standard" Id="Std" /> */
1152+
auto bias = tag != nullptr ? tag->Attribute("Bias") : nullptr;
1153+
if (bias != nullptr) {
1154+
char *end = nullptr;
1155+
auto minutes = HX_strtoull8601p_sec(bias, &end) / 60;
1156+
if (minutes != 0 || end != nullptr)
1157+
request.TimeZone.emplace(minutes);
1158+
}
1159+
}
11401160
if (!request.TimeZone)
11411161
throw EWSError::TimeZone(E3014);
11421162

0 commit comments

Comments
 (0)