diff options
author | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2017-09-26 20:57:28 +0900 |
---|---|---|
committer | Alexey Andreyev <aa13q@ya.ru> | 2019-06-25 14:48:11 +0300 |
commit | 1cf67730a0880a520ae04bdf4ef61592daa9fe06 (patch) | |
tree | 77f67b6fc0f47fb397e5284f002ab451c4c49814 /lib/events | |
parent | 90623dd4a191d4cce2ddd514f313f689d0a135b0 (diff) | |
download | libquotient-1cf67730a0880a520ae04bdf4ef61592daa9fe06.tar.gz libquotient-1cf67730a0880a520ae04bdf4ef61592daa9fe06.zip |
Introduce EncryptionEvent class
This allows to detect if a room has been encrypted (no room state, just
an event as of yet). Closes #84.
Diffstat (limited to 'lib/events')
-rw-r--r-- | lib/events/encryptionevent.cpp | 5 | ||||
-rw-r--r-- | lib/events/encryptionevent.h | 43 |
2 files changed, 48 insertions, 0 deletions
diff --git a/lib/events/encryptionevent.cpp b/lib/events/encryptionevent.cpp new file mode 100644 index 00000000..7b620bce --- /dev/null +++ b/lib/events/encryptionevent.cpp @@ -0,0 +1,5 @@ +// +// Created by rusakov on 26/09/2017. +// + +#include "encryptionevent.h" diff --git a/lib/events/encryptionevent.h b/lib/events/encryptionevent.h new file mode 100644 index 00000000..b44e0eeb --- /dev/null +++ b/lib/events/encryptionevent.h @@ -0,0 +1,43 @@ +/****************************************************************************** + * Copyright (C) 2017 Kitsune Ral <kitsune-ral@users.sf.net> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#pragma once + +#include "roomevent.h" + +namespace QMatrixClient +{ + class EncryptionEvent : public RoomEvent + { + public: + DEFINE_EVENT_TYPEID("m.room.encryption", EncryptionEvent) + + explicit EncryptionEvent(const QJsonObject& obj) + : RoomEvent(typeId(), obj) + , _algorithm(contentJson()["algorithm"].toString()) + { } + + QString algorithm() const { return _algorithm; } + + private: + QString _algorithm; + }; + REGISTER_EVENT_TYPE(EncryptionEvent) + DEFINE_EVENTTYPE_ALIAS(Encryption, EncryptionEvent) +} // namespace QMatrixClient + |