aboutsummaryrefslogtreecommitdiff
path: root/lib/e2ee/qolmerrors.cpp
diff options
context:
space:
mode:
authorTobias Fella <fella@posteo.de>2021-12-07 19:08:29 +0100
committerTobias Fella <fella@posteo.de>2021-12-07 19:08:29 +0100
commit2c6fa33ca52842e9dfba0dd3893a9d5526e10e60 (patch)
tree96ffece23a6f671d71328159357db3c68767365a /lib/e2ee/qolmerrors.cpp
parent47bd4dfb2bc720d2b5919b93985f87d918af572a (diff)
downloadlibquotient-2c6fa33ca52842e9dfba0dd3893a9d5526e10e60.tar.gz
libquotient-2c6fa33ca52842e9dfba0dd3893a9d5526e10e60.zip
Rename "crypto" -> "e2ee"
Diffstat (limited to 'lib/e2ee/qolmerrors.cpp')
-rw-r--r--lib/e2ee/qolmerrors.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/lib/e2ee/qolmerrors.cpp b/lib/e2ee/qolmerrors.cpp
new file mode 100644
index 00000000..6db1803c
--- /dev/null
+++ b/lib/e2ee/qolmerrors.cpp
@@ -0,0 +1,22 @@
+// SPDX-FileCopyrightText: 2021 Carl Schwan <carlschwan@kde.org>
+//
+// SPDX-License-Identifier: LGPL-2.1-or-later
+
+
+#include "qolmerrors.h"
+
+Quotient::QOlmError Quotient::fromString(const std::string &error_raw) {
+ if (!error_raw.compare("BAD_ACCOUNT_KEY")) {
+ return QOlmError::BadAccountKey;
+ } else if (!error_raw.compare("BAD_MESSAGE_KEY_ID")) {
+ return QOlmError::BadMessageKeyId;
+ } else if (!error_raw.compare("INVALID_BASE64")) {
+ return QOlmError::InvalidBase64;
+ } else if (!error_raw.compare("NOT_ENOUGH_RANDOM")) {
+ return QOlmError::NotEnoughRandom;
+ } else if (!error_raw.compare("OUTPUT_BUFFER_TOO_SMALL")) {
+ return QOlmError::OutputBufferTooSmall;
+ } else {
+ return QOlmError::Unknown;
+ }
+}