summary refs log tree commit diff
path: root/include/timeline
diff options
context:
space:
mode:
authorKonstantinos Sideris <sideris.konstantin@gmail.com>2018-06-12 22:35:10 +0300
committerKonstantinos Sideris <sideris.konstantin@gmail.com>2018-06-12 22:35:10 +0300
commite5dd64c63a04df6f0b885c737cc73b383e79bd67 (patch)
tree973755bc13c716dd866f35cc531afb9bd734974b /include/timeline
parentFix bug where cache was initialized twice in a row (diff)
downloadnheko-e5dd64c63a04df6f0b885c737cc73b383e79bd67.tar.xz
Add method to convert PendingMessage's to event types
Add more logging during message sending
Diffstat (limited to 'include/timeline')
-rw-r--r--include/timeline/TimelineView.h31
1 files changed, 30 insertions, 1 deletions
diff --git a/include/timeline/TimelineView.h b/include/timeline/TimelineView.h
index 88857222..2c369d5f 100644
--- a/include/timeline/TimelineView.h
+++ b/include/timeline/TimelineView.h
@@ -48,8 +48,37 @@ struct PendingMessage
         uint64_t media_size;
         QString event_id;
         TimelineItem *widget;
+        bool is_encrypted = false;
 };
 
+template<class MessageT>
+MessageT
+toRoomMessage(const PendingMessage &) = delete;
+
+template<>
+mtx::events::msg::Audio
+toRoomMessage<mtx::events::msg::Audio>(const PendingMessage &m);
+
+template<>
+mtx::events::msg::Emote
+toRoomMessage<mtx::events::msg::Emote>(const PendingMessage &m);
+
+template<>
+mtx::events::msg::File
+toRoomMessage<mtx::events::msg::File>(const PendingMessage &);
+
+template<>
+mtx::events::msg::Image
+toRoomMessage<mtx::events::msg::Image>(const PendingMessage &m);
+
+template<>
+mtx::events::msg::Text
+toRoomMessage<mtx::events::msg::Text>(const PendingMessage &);
+
+template<>
+mtx::events::msg::Video
+toRoomMessage<mtx::events::msg::Video>(const PendingMessage &m);
+
 // In which place new TimelineItems should be inserted.
 enum class TimelineDirection
 {
@@ -318,7 +347,7 @@ TimelineView::addUserMessage(const QString &url,
 
         PendingMessage message;
         message.ty         = MsgType;
-        message.txn_id     = mtx::client::utils::random_token();
+        message.txn_id     = http::v2::client()->generate_txn_id();
         message.body       = url;
         message.filename   = trimmed;
         message.mime       = mime;