summary refs log tree commit diff
path: root/include
diff options
context:
space:
mode:
authorKonstantinos Sideris <sideris.konstantin@gmail.com>2018-06-13 12:28:00 +0300
committerKonstantinos Sideris <sideris.konstantin@gmail.com>2018-06-13 12:28:00 +0300
commit5d47cc3940076f6e7da4578d985253c869117f21 (patch)
treef851f52a57561787c2ba856d5d2d864825eea215 /include
parentAdd method to convert PendingMessage's to event types (diff)
downloadnheko-5d47cc3940076f6e7da4578d985253c869117f21.tar.xz
Add support for sending encrypted messages
Diffstat (limited to 'include')
-rw-r--r--include/Cache.h8
-rw-r--r--include/Olm.hpp7
-rw-r--r--include/timeline/TimelineView.h1
3 files changed, 14 insertions, 2 deletions
diff --git a/include/Cache.h b/include/Cache.h

index 76266ebd..b4dcdb90 100644 --- a/include/Cache.h +++ b/include/Cache.h
@@ -286,6 +286,9 @@ public: bool isFormatValid(); void setCurrentFormat(); + //! Retrieve all the user ids from a room. + std::vector<std::string> roomMembers(const std::string &room_id); + //! Check if the given user has power leve greater than than //! lowest power level of the given events. bool hasEnoughPowerLevel(const std::vector<mtx::events::EventType> &eventTypes, @@ -358,8 +361,9 @@ public: void saveOutboundMegolmSession(const std::string &room_id, const OutboundGroupSessionData &data, mtx::crypto::OutboundGroupSessionPtr session); - OutboundGroupSessionDataRef getOutboundMegolmSession(const MegolmSessionIndex &index); - bool outboundMegolmSessionExists(const MegolmSessionIndex &index) noexcept; + OutboundGroupSessionDataRef getOutboundMegolmSession(const std::string &room_id); + bool outboundMegolmSessionExists(const std::string &room_id) noexcept; + void updateOutboundMegolmSession(const std::string &room_id, int message_index); // // Inbound Megolm Sessions diff --git a/include/Olm.hpp b/include/Olm.hpp
index 2f7b1d64..0839f01c 100644 --- a/include/Olm.hpp +++ b/include/Olm.hpp
@@ -1,6 +1,7 @@ #pragma once #include <memory> +#include <mtx.hpp> #include <mtxclient/crypto/client.hpp> constexpr auto OLM_ALGO = "m.olm.v1.curve25519-aes-sha2"; @@ -62,4 +63,10 @@ void handle_pre_key_olm_message(const std::string &sender, const std::string &sender_key, const OlmCipherContent &content); + +mtx::events::msg::Encrypted +encrypt_group_message(const std::string &room_id, + const std::string &device_id, + const std::string &body); + } // namespace olm diff --git a/include/timeline/TimelineView.h b/include/timeline/TimelineView.h
index 2c369d5f..5b5c2292 100644 --- a/include/timeline/TimelineView.h +++ b/include/timeline/TimelineView.h
@@ -185,6 +185,7 @@ private: void sendRoomMessageHandler(const std::string &txn_id, const mtx::responses::EventId &res, mtx::http::RequestErr err); + void prepareEncryptedMessage(const PendingMessage &msg); //! Call the /messages endpoint to fill the timeline. void getMessages();