summary refs log tree commit diff
path: root/src/timeline/InputBar.cpp
diff options
context:
space:
mode:
authorJoe <rubberduckie3554@gmail.com>2021-07-24 18:26:25 -0400
committerJoe <rubberduckie3554@gmail.com>2021-07-24 18:26:25 -0400
commit3f567a8da7f41a2ce094f15340e39ea8aec55fb3 (patch)
tree42b6f59f0fa36ad738133198333cccf0c4100621 /src/timeline/InputBar.cpp
parentRemove 'respond to key requests' functionality (diff)
parentFix edge case that could lead to no new one time keys being uploaded (diff)
downloadnheko-3f567a8da7f41a2ce094f15340e39ea8aec55fb3.tar.xz
Merge master and fix conflicts
Diffstat (limited to 'src/timeline/InputBar.cpp')
-rw-r--r--src/timeline/InputBar.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/timeline/InputBar.cpp b/src/timeline/InputBar.cpp

index b0747a7c..f17081e5 100644 --- a/src/timeline/InputBar.cpp +++ b/src/timeline/InputBar.cpp
@@ -19,6 +19,7 @@ #include "Cache.h" #include "ChatPage.h" +#include "CombinedImagePackModel.h" #include "CompletionProxyModel.h" #include "Config.h" #include "Logging.h" @@ -502,6 +503,31 @@ InputBar::video(const QString &filename, } void +InputBar::sticker(CombinedImagePackModel *model, int row) +{ + if (!model || row < 0) + return; + + auto img = model->imageAt(row); + + mtx::events::msg::StickerImage sticker{}; + sticker.info = img.info.value_or(mtx::common::ImageInfo{}); + sticker.url = img.url; + sticker.body = img.body; + + if (!room->reply().isEmpty()) { + sticker.relations.relations.push_back( + {mtx::common::RelationType::InReplyTo, room->reply().toStdString()}); + } + if (!room->edit().isEmpty()) { + sticker.relations.relations.push_back( + {mtx::common::RelationType::Replace, room->edit().toStdString()}); + } + + room->sendMessageEvent(sticker, mtx::events::EventType::Sticker); +} + +void InputBar::command(QString command, QString args) { if (command == "me") {