File indexing completed on 2024-12-22 04:57:04

0001 /*
0002     SPDX-FileCopyrightText: 2015-2019 Krzysztof Nowicki <krissn@op.pl>
0003 
0004     SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #include <QMap>
0008 
0009 #include "ewstypes.h"
0010 
0011 const QString soapEnvNsUri = QStringLiteral("http://schemas.xmlsoap.org/soap/envelope/");
0012 const QString ewsMsgNsUri = QStringLiteral("http://schemas.microsoft.com/exchange/services/2006/messages");
0013 const QString ewsTypeNsUri = QStringLiteral("http://schemas.microsoft.com/exchange/services/2006/types");
0014 
0015 const QList<QString> ewsItemTypeNames = {
0016     QStringLiteral("Item"),
0017     QStringLiteral("Message"),
0018     QStringLiteral("CalendarItem"),
0019     QStringLiteral("Contact"),
0020     QStringLiteral("DistributionList"),
0021     QStringLiteral("MeetingMessage"),
0022     QStringLiteral("MeetingRequest"),
0023     QStringLiteral("MeetingResponse"),
0024     QStringLiteral("MeetingCancellation"),
0025     QStringLiteral("Task"),
0026 };
0027 
0028 static const QMap<QString, EwsResponseCode> ewsResponseCodeMapping = {{QLatin1StringView("NoError"), EwsResponseCodeNoError},
0029                                                                       {QLatin1StringView("ErrorServerBusy"), EwsResponseCodeErrorServerBusy}};
0030 
0031 EwsResponseCode decodeEwsResponseCode(const QString &code)
0032 {
0033     if (ewsResponseCodeMapping.contains(code)) {
0034         return ewsResponseCodeMapping[code];
0035     } else {
0036         return EwsResponseCodeUnknown;
0037     }
0038 }
0039 
0040 bool isEwsResponseCodeTemporaryError(EwsResponseCode code)
0041 {
0042     switch (code) {
0043     case EwsResponseCodeErrorServerBusy:
0044         /* fall through */
0045     case EwsResponseCodeUnauthorized:
0046         return true;
0047     default:
0048         return false;
0049     }
0050     return false;
0051 }