diff options
author | Alexey Rusakov <Kitsune-Ral@users.sf.net> | 2022-02-26 12:57:08 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-26 12:57:08 +0100 |
commit | 62039b527507aa6c45fbf7ac787da6234d2faac3 (patch) | |
tree | be84dde38d9328f6278fce1b4f9e900d7e9dce2a /lib/e2ee/qolmerrors.cpp | |
parent | 2aab2a0c95bbd3f12890badb58a825bb57d8e613 (diff) | |
parent | b0e1455989405ef46eb6d9ed2cd559a1164d04f4 (diff) | |
download | libquotient-62039b527507aa6c45fbf7ac787da6234d2faac3.tar.gz libquotient-62039b527507aa6c45fbf7ac787da6234d2faac3.zip |
Merge pull request #477 from TobiasFella/work/readencryptedmessages
Diffstat (limited to 'lib/e2ee/qolmerrors.cpp')
-rw-r--r-- | lib/e2ee/qolmerrors.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/lib/e2ee/qolmerrors.cpp b/lib/e2ee/qolmerrors.cpp new file mode 100644 index 00000000..5a60b7e6 --- /dev/null +++ b/lib/e2ee/qolmerrors.cpp @@ -0,0 +1,25 @@ +// SPDX-FileCopyrightText: 2021 Carl Schwan <carlschwan@kde.org> +// +// SPDX-License-Identifier: LGPL-2.1-or-later + + +#include "qolmerrors.h" +#include "util.h" +#include <QtCore/QLatin1String> + +Quotient::QOlmError Quotient::fromString(const char* error_raw) { + const QLatin1String error { error_raw }; + if (error_raw == "BAD_ACCOUNT_KEY"_ls) { + return QOlmError::BadAccountKey; + } else if (error_raw == "BAD_MESSAGE_KEY_ID"_ls) { + return QOlmError::BadMessageKeyId; + } else if (error_raw == "INVALID_BASE64"_ls) { + return QOlmError::InvalidBase64; + } else if (error_raw == "NOT_ENOUGH_RANDOM"_ls) { + return QOlmError::NotEnoughRandom; + } else if (error_raw == "OUTPUT_BUFFER_TOO_SMALL"_ls) { + return QOlmError::OutputBufferTooSmall; + } else { + return QOlmError::Unknown; + } +} |